Merge pull request #1338 from namecheap/nc_0_8_5_10

Namecheap latest updates till 10/02/20121
This commit is contained in:
borgmanJeremy
2021-02-18 08:18:51 -06:00
committed by GitHub
62 changed files with 9797 additions and 5187 deletions

View File

@@ -22,6 +22,27 @@ jobs:
name: macOS Catalina 10.15
runs-on: macos-10.15
env:
APP_NAME: flameshot
DIR_BULD: build
DIR_PKG: build/src
HELPERS_SCRIPTS_PATH: ../../packaging/macos
# Apple developer identity, example: "Developer ID Application: <user name> (code)"
# Note: no signing and notarization will be be proceed if this variable is not set
APPLE_DEV_IDENTITY: ${{ secrets.APPLE_DEV_IDENTITY }}
# Apple ID user
APPLE_DEV_USER: ${{ secrets.APPLE_DEV_USER }}
# Apple ID user password
APPLE_DEV_PASS: ${{ secrets.APPLE_DEV_PASS }}
# Apple certificate with private and public keys in base64 format
APPLE_DEVELOPER_ID_APPLICATION_CERT_DATA: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERT_DATA }}
# Apple certificate password
APPLE_DEVELOPER_ID_APPLICATION_CERT_PASS: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERT_PASS }}
# Any temporary password for keychain, which will be created on github actions CI
APPLE_TEMP_CI_KEYCHAIN_PASS: ${{ secrets.APPLE_TEMP_CI_KEYCHAIN_PASS }}
# Temporary variable for internal use, it will be set on the "Build dmg" step
NOTARIZATION_CHECK: false
steps:
- name: Checkout Source code
uses: actions/checkout@v1
@@ -31,25 +52,25 @@ jobs:
- name: Configure
run: |
mkdir build
mkdir -p "${DIR_BULD}"
cd build
rm -rf ./src/flameshot.dmg ./src/flameshot.app/
cmake .. -DQt5_DIR=$(brew --prefix qt5)/lib/cmake/Qt5
- name: Compile
run: |
cd build
cd "${DIR_BULD}"
make
- name: Create key-chain and import certificate
run: |
cd "${DIR_PKG}"
${HELPERS_SCRIPTS_PATH}/create_keychain.sh flameshot
- name: Build dmg package
run: |
cd build/src
/usr/local/opt/qt5/bin/macdeployqt flameshot.app -dmg
- name: Update dmg package links
run: |
cd build/src
../../packaging/macos/update_package.sh
cd "${DIR_PKG}"
${HELPERS_SCRIPTS_PATH}/siqn_qtapp.sh flameshot
- name: Upload dmg package
shell: bash
@@ -64,3 +85,13 @@ jobs:
with:
name: MacOS-artifact
path: ${{ github.workspace }}/build/src/flameshot.dmg
- name: Notarization status
shell: bash
run: |
if [[ "${NOTARIZATION_CHECK}" == "true" ]]; then
echo "Notarization check succeed"
else
echo "::warning Notarization check failed"
# exit 1
fi

View File

@@ -31,35 +31,37 @@ set(GIT_API_URL "https://api.github.com/repos/flameshot-org/flameshot/releases/l
#endif ()
project(
flameshot
VERSION ${FLAMESHOT_VERSION}
LANGUAGES CXX)
flameshot
VERSION ${FLAMESHOT_VERSION}
LANGUAGES CXX)
set(PROJECT_NAME_CAPITALIZED "Flameshot")
# This can be read from ${PROJECT_NAME} after project() is called
if(APPLE)
if (APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")
# # Required to generate MOC
# add_subdirectory(external/QHotkey)
endif()
# Configuration options
set(DEFAULT_RUN_IN_PLACE FALSE)
if(WIN32)
set(DEFAULT_RUN_IN_PLACE TRUE)
# For Windows RC file.
add_definitions(-DFLAMESHOT_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR})
add_definitions(-DFLAMESHOT_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR})
add_definitions(-DFLAMESHOT_VERSION_BUGFIX=${CMAKE_PROJECT_VERSION_PATCH})
add_definitions(-DFLAMESHOT_VERSION_BUILD=1)
add_definitions(-DFLAMESHOT_VERSION_STRING="${PROJECT_VERSION}")
set(DEFAULT_RUN_IN_PLACE TRUE)
# For Windows RC file.
add_definitions(-DFLAMESHOT_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR})
add_definitions(-DFLAMESHOT_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR})
add_definitions(-DFLAMESHOT_VERSION_BUGFIX=${CMAKE_PROJECT_VERSION_PATCH})
add_definitions(-DFLAMESHOT_VERSION_BUILD=1)
add_definitions(-DFLAMESHOT_VERSION_STRING="${PROJECT_VERSION}")
elseif(APPLE)
set(Qt5_DIR "$(brew --prefix qt5)/lib/cmake/Qt5/" CACHE PATH "directory where Qt5Config.cmake exists.")
set(CMAKE_MACOSX_BUNDLE ON)
set(CMAKE_MACOSX_RPATH ON)
endif()
set(RUN_IN_PLACE
${DEFAULT_RUN_IN_PLACE}
CACHE BOOL "Run directly in source directory structure")
${DEFAULT_RUN_IN_PLACE}
CACHE BOOL "Run directly in source directory structure")
option(GENERATE_TS "Regenerate translation source files" OFF)
@@ -84,20 +86,20 @@ enable_sanitizers(project_options)
# allow for static analysis options include(cmake/StaticAnalyzers.cmake)
set(QAPPLICATION_CLASS
QApplication
CACHE STRING "Inheritance class for SingleApplication")
QApplication
CACHE STRING "Inheritance class for SingleApplication")
add_subdirectory(external/singleapplication)
if(USE_EXTERNAL_SPDLOG)
find_package(spdlog REQUIRED)
message(STATUS "Using external spdlog library")
find_package(spdlog REQUIRED)
message(STATUS "Using external spdlog library")
else()
add_subdirectory(external/spdlog)
add_subdirectory(external/spdlog)
endif()
IF (APPLE)
if (APPLE)
add_subdirectory(external/QHotkey)
ENDIF ()
endif()
add_subdirectory(src)
# CPack
@@ -107,9 +109,9 @@ set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_HOMEPAGE_URL "https://flameshot.org")
set(CPACK_PACKAGE_CONTACT "flameshot-org developers <info@flameshot.org>")
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/data/img/app/org.flameshot.Flameshot.svg") # TODO: Can any generator make
# use of this?
# use of this?
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") # TODO: Where is this used? Do we need a better
# source?
# source?
if(WIN32)
# Include all dynamically linked runtime libraries such as MSVCRxxx.dll

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -99,6 +99,10 @@
<source>Delay:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Full Screen (Current Display)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CaptureWidget</name>
@@ -173,6 +177,10 @@ Press Space to open the side panel.</source>
<source>Shortcuts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Storage</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Controller</name>
@@ -311,71 +319,110 @@ Press Space to open the side panel.</source>
<name>GeneneralConf</name>
<message>
<source>Show help message</source>
<translation>Mutassa a segítséget</translation>
<translation type="vanished">Mutassa a segítséget</translation>
</message>
<message>
<source>Show the help message at the beginning in the capture mode.</source>
<translation>Mutassa a segítséget a felvevő mód kezdetekor.</translation>
<translation type="vanished">Mutassa a segítséget a felvevő mód kezdetekor.</translation>
</message>
<message>
<source>Show desktop notifications</source>
<translation>Mutassa az asztali üzeneteket</translation>
<translation type="vanished">Mutassa az asztali üzeneteket</translation>
</message>
<message>
<source>Show tray icon</source>
<translation>Tray ikon mutatása</translation>
<translation type="vanished">Tray ikon mutatása</translation>
</message>
<message>
<source>Show the systemtray icon</source>
<translation>Systemtray ikon mutatása</translation>
<translation type="vanished">Systemtray ikon mutatása</translation>
</message>
<message>
<source>Import</source>
<translation>Importálás</translation>
<translation type="vanished">Importálás</translation>
</message>
<message>
<source>Error</source>
<translation>Hiba</translation>
<translation type="vanished">Hiba</translation>
</message>
<message>
<source>Unable to read file.</source>
<translation>Nem lehet olvasni a fájlt.</translation>
<translation type="vanished">Nem lehet olvasni a fájlt.</translation>
</message>
<message>
<source>Unable to write file.</source>
<translation>Nem lehet írni a fájlt.</translation>
<translation type="vanished">Nem lehet írni a fájlt.</translation>
</message>
<message>
<source>Save File</source>
<translation>Fájl mentése</translation>
<translation type="vanished">Fájl mentése</translation>
</message>
<message>
<source>Confirm Reset</source>
<translation>Visszaállítás elfogadása</translation>
<translation type="vanished">Visszaállítás elfogadása</translation>
</message>
<message>
<source>Are you sure you want to reset the configuration?</source>
<translation>Biztos vagy benne hogy viszaállítod a beállításokat?</translation>
<translation type="vanished">Biztos vagy benne hogy viszaállítod a beállításokat?</translation>
</message>
<message>
<source>Configuration File</source>
<translation>Konfigurációs fájl</translation>
<translation type="vanished">Konfigurációs fájl</translation>
</message>
<message>
<source>Export</source>
<translation>Export</translation>
<translation type="vanished">Export</translation>
</message>
<message>
<source>Reset</source>
<translation>Visszaállítás</translation>
<translation type="vanished">Visszaállítás</translation>
</message>
<message>
<source>Launch at startup</source>
<translation>Indítás rendszerinduláskor</translation>
<translation type="vanished">Indítás rendszerinduláskor</translation>
</message>
<message>
<source>Launch Flameshot</source>
<translation>Flameshot indítása</translation>
<translation type="vanished">Flameshot indítása</translation>
</message>
</context>
<context>
<name>GeneralConf</name>
<message>
<source>Import</source>
<translation type="unfinished">Importálás</translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished">Hiba</translation>
</message>
<message>
<source>Unable to read file.</source>
<translation type="unfinished">Nem lehet olvasni a fájlt.</translation>
</message>
<message>
<source>Unable to write file.</source>
<translation type="unfinished">Nem lehet írni a fájlt.</translation>
</message>
<message>
<source>Save File</source>
<translation type="unfinished">Fájl mentése</translation>
</message>
<message>
<source>Confirm Reset</source>
<translation type="unfinished">Visszaállítás elfogadása</translation>
</message>
<message>
<source>Are you sure you want to reset the configuration?</source>
<translation type="unfinished">Biztos vagy benne hogy viszaállítod a beállításokat?</translation>
</message>
<message>
<source>Show help message</source>
<translation type="unfinished">Mutassa a segítséget</translation>
</message>
<message>
<source>Show the help message at the beginning in the capture mode.</source>
<translation type="unfinished">Mutassa a segítséget a felvevő mód kezdetekor.</translation>
</message>
<message>
<source>Show the side panel button</source>
@@ -385,6 +432,58 @@ Press Space to open the side panel.</source>
<source>Show the side panel toggle button in the capture mode.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show desktop notifications</source>
<translation type="unfinished">Mutassa az asztali üzeneteket</translation>
</message>
<message>
<source>Show tray icon</source>
<translation type="unfinished">Tray ikon mutatása</translation>
</message>
<message>
<source>Show the systemtray icon</source>
<translation type="unfinished">Systemtray ikon mutatása</translation>
</message>
<message>
<source>Confirmation required to delete screenshot from the latest uploads</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Configuration File</source>
<translation type="unfinished">Konfigurációs fájl</translation>
</message>
<message>
<source>Export</source>
<translation type="unfinished">Export</translation>
</message>
<message>
<source>Reset</source>
<translation type="unfinished">Visszaállítás</translation>
</message>
<message>
<source>Automatic check for updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Launch at startup</source>
<translation type="unfinished">Indítás rendszerinduláskor</translation>
</message>
<message>
<source>Launch Flameshot</source>
<translation type="unfinished">Flameshot indítása</translation>
</message>
<message>
<source>Show welcome message on launch</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy URL after upload</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy URL and close window after upload</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save image after copy</source>
<translation type="unfinished"></translation>
@@ -401,6 +500,14 @@ Press Space to open the side panel.</source>
<source>Change...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use fixed path for screenshots to save</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy file path after save</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose a Folder</source>
<translation type="unfinished"></translation>
@@ -409,14 +516,6 @@ Press Space to open the side panel.</source>
<source>Unable to write to directory.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use fixed path for screenshots to save</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use JPG format for clipboard (PNG default)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HistoryWidget</name>
@@ -440,51 +539,121 @@ Press Space to open the side panel.</source>
<source>Open in browser</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Confirm to delete</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete a screenshot from the latest uploads and server?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImgS3Uploader</name>
<message>
<source>Upload image to S3</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Uploading Image</source>
<translation type="obsolete">Kép felötlése</translation>
</message>
<message>
<source>Delete image from S3</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleting image...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>URL copied to clipboard.</source>
<translation type="obsolete">URL másolva a vágólapra.</translation>
<translation type="unfinished">URL másolva a vágólapra.</translation>
</message>
<message>
<source>S3 Creds URL is not found in your configuration file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Uploading Image...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Retrieving configuration file with s3 creds...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="obsolete">Hiba</translation>
<translation type="unfinished">Hiba</translation>
</message>
<message>
<source>Unable to get s3 credentials, please check your VPN connection and try again</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to upload screenshot, please check your internet connection and try again</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImgS3UploaderTool</name>
<message>
<source>Upload the selection to S3 bucket</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImgUploader</name>
<message>
<source>Upload image to S3</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Uploading Image</source>
<translation type="obsolete">Kép felötlése</translation>
</message>
<message>
<source>Unable to open the URL.</source>
<translation type="obsolete">Nem lehet az URL-t megnyitni.</translation>
<translation type="unfinished">Nem lehet az URL-t megnyitni.</translation>
</message>
<message>
<source>URL copied to clipboard.</source>
<translation type="obsolete">URL másolva a vágólapra.</translation>
<translation type="unfinished">URL másolva a vágólapra.</translation>
</message>
<message>
<source>Screenshot copied to clipboard.</source>
<translation type="obsolete">Képernyőmentés másolva a vágólapra.</translation>
<translation type="unfinished">Képernyőmentés másolva a vágólapra.</translation>
</message>
<message>
<source>Deleting image...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy URL</source>
<translation type="obsolete">URL másolása</translation>
<translation type="unfinished">URL másolása</translation>
</message>
<message>
<source>Open URL</source>
<translation type="obsolete">URL megnyitása</translation>
<translation type="unfinished">URL megnyitása</translation>
</message>
<message>
<source>Delete image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Image to Clipboard.</source>
<translation type="obsolete">Kép a vágolapra.</translation>
<translation type="unfinished">Kép a vágolapra.</translation>
</message>
<message>
<source>Uploading Image...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ImgUploaderTool</name>
<message>
<source>Image uploader tool</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
@@ -495,19 +664,19 @@ Press Space to open the side panel.</source>
</message>
<message>
<source>Uploading Image</source>
<translation>Kép felötlése</translation>
<translation type="vanished">Kép felötlése</translation>
</message>
<message>
<source>Copy URL</source>
<translation>URL másolása</translation>
<translation type="vanished">URL másolása</translation>
</message>
<message>
<source>Open URL</source>
<translation>URL megnyitása</translation>
<translation type="vanished">URL megnyitása</translation>
</message>
<message>
<source>Image to Clipboard.</source>
<translation>Kép a vágolapra.</translation>
<translation type="vanished">Kép a vágolapra.</translation>
</message>
<message>
<source>Unable to open the URL.</source>
@@ -515,15 +684,11 @@ Press Space to open the side panel.</source>
</message>
<message>
<source>URL copied to clipboard.</source>
<translation>URL másolva a vágólapra.</translation>
<translation type="vanished">URL másolva a vágólapra.</translation>
</message>
<message>
<source>Screenshot copied to clipboard.</source>
<translation>Képernyőmentés másolva a vágólapra.</translation>
</message>
<message>
<source>Delete image</source>
<translation type="unfinished"></translation>
<translation type="vanished">Képernyőmentés másolva a vágólapra.</translation>
</message>
</context>
<context>
@@ -718,7 +883,7 @@ Press Space to open the side panel.</source>
</message>
<message>
<source>URL copied to clipboard.</source>
<translation type="obsolete">URL másolva a vágólapra.</translation>
<translation type="unfinished">URL másolva a vágólapra.</translation>
</message>
<message>
<source>Options</source>
@@ -850,6 +1015,15 @@ You may need to escape the &apos;#&apos; sign as in &apos;\#FFF&apos;</source>
<source>Capture saved to clipboard.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hi, I&apos;m already running!
You can find me in the system tray.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hello, I&apos;m here! Click icon in the tray to take a screenshot or click with a right button to see more options.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle side panel</source>
<translation type="unfinished"></translation>
@@ -918,22 +1092,6 @@ You may need to escape the &apos;#&apos; sign as in &apos;\#FFF&apos;</source>
<source>Per default runs Flameshot in the background and adds a tray icon for configuration.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Print geometry of the selection in the format W H X Y. Does nothing if raw is specified</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select entire screen</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Commit text in text area</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error while saving to clipboard</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RectangleTool</name>
@@ -1243,6 +1401,21 @@ You may need to escape the &apos;#&apos; sign as in &apos;\#FFF&apos;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UploadStorageConfig</name>
<message>
<source>Upload storage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Imgur storage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>S3 storage (require config.ini file with s3 credentials)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UtilityPanel</name>
<message>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,33 @@
#!/bin/bash
# Inspired by
# https://localazy.com/blog/how-to-automatically-sign-macos-apps-using-github-actions
TEMP_CI_CERT_FILENAME="temp_ci_appleDistribution.p12"
# Get the following variables from MacOS-pack.yaml:
# APP_NAME
# APPLE_DEV_IDENTITY
# APPLE_DEVELOPER_ID_APPLICATION_CERT_PASS
# APPLE_DEVELOPER_ID_APPLICATION_CERT_DATA
# APPLE_TEMP_CI_KEYCHAIN_PASS
# For the Community (if no Apple Developer ID available)
if [[ "${APPLE_DEV_IDENTITY}" == "" ]]; then
echo "WARNING: No credentials for signing found"
echo "WARNING: Cannot create keychain for signing"
echo "WARNING: dmg package won't be signed and notarized"
exit 0
fi
# create keychain
security create-keychain -p "${APPLE_TEMP_CI_KEYCHAIN_PASS}" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "${APPLE_TEMP_CI_KEYCHAIN_PASS}" build.keychain
# import certificate
[ -r "${TEMP_CI_CERT_FILENAME}" ] && rm ${TEMP_CI_CERT_FILENAME}
echo "${APPLE_DEVELOPER_ID_APPLICATION_CERT_DATA}" | base64 --decode > "${TEMP_CI_CERT_FILENAME}"
security import "${TEMP_CI_CERT_FILENAME}" -P "${APPLE_DEVELOPER_ID_APPLICATION_CERT_PASS}" -k build.keychain -T /usr/bin/codesign
[ -r "${TEMP_CI_CERT_FILENAME}" ] && rm ${TEMP_CI_CERT_FILENAME}
security find-identity -v
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${APPLE_TEMP_CI_KEYCHAIN_PASS}" build.keychain

80
packaging/macos/siqn_qtapp.sh Executable file
View File

@@ -0,0 +1,80 @@
#!/bin/bash
# Inspired by
# https://localazy.com/blog/how-to-automatically-sign-macos-apps-using-github-actions
# https://forum.qt.io/topic/96652/how-to-notarize-qt-application-on-macos/18
# Get the following variables from the MacOS-pack.yaml:
# APP_NAME
# APPLE_DEV_IDENTITY
# APPLE_DEV_USER
# APPLE_DEV_PASS
# For the Community (if no Apple Developer ID available)
if [[ "${APPLE_DEV_IDENTITY}" == "" ]]; then
echo "WARNING: No credentials for signing found"
echo "WARNING: dmg package won't be signed and notarized"
echo "--> Start packaging process"
"$(brew --prefix qt5)/bin/macdeployqt" "${APP_NAME}.app" -dmg
echo "--> Update dmg package links"
"./${HELPERS_SCRIPTS_PATH}/update_package.sh"
exit 0
fi
echo "--> Start application signing process"
codesign --sign "${APPLE_DEV_IDENTITY}" --verbose --deep ${APP_NAME}.app
echo "--> Start packaging process"
"$(brew --prefix qt5)/bin/macdeployqt" "${APP_NAME}.app" -dmg -sign-for-notarization="${APPLE_DEV_IDENTITY}"
echo "--> Update dmg package links"
"./${HELPERS_SCRIPTS_PATH}/update_package.sh"
echo "--> Start dmg signing process"
codesign --sign "${APPLE_DEV_IDENTITY}" --verbose --deep "${APP_NAME}.dmg"
echo "--> Start Notarization process"
response=$(xcrun altool -t osx -f "${APP_NAME}.dmg" --primary-bundle-id "org.namecheap.${APP_NAME}" --notarize-app -u "${APPLE_DEV_USER}" -p "${APPLE_DEV_PASS}")
requestUUID=$(echo "${response}" | tr ' ' '\n' | tail -1)
for ((ATTEMPT=5; ATTEMPT>=1; ATTEMPT--))
do
echo "--> Checking notarization status"
statusCheckResponse=$(xcrun altool --notarization-info "${requestUUID}" -u "${APPLE_DEV_USER}" -p "${APPLE_DEV_PASS}")
isSuccess=$(echo "${statusCheckResponse}" | grep "success")
isFailure=$(echo "${statusCheckResponse}" | grep "invalid")
if [[ "${isSuccess}" != "" ]]; then
echo "Notarization done!"
xcrun stapler staple "${APP_NAME}.dmg"
EXIT_CODE=$?
if [ ${EXIT_CODE} -ne 0 ]; then
echo "Stapler failed!"
exit ${EXIT_CODE}
fi
echo "Stapler done!"
break
fi
if [[ "${isFailure}" != "" ]]; then
echo "${statusCheckResponse}"
echo "Notarization failed"
exit 1
fi
echo "Notarization not finished yet, sleep 2m then check again..."
for num in {1..12}
do
sleep 10
echo "Elapsed: ${num}0 sec"
done
done
if [[ "${ATTEMPT}" == 0 ]]; then
export NOTARIZATION_CHECK="false"
echo "::warning Notarization check failed"
else
export NOTARIZATION_CHECK="true"
fi
echo "--> Start verify signing process"
codesign -dv --verbose=4 "${APP_NAME}.dmg"

View File

@@ -40,6 +40,11 @@ if (APPLE)
COMMAND bash "-c" "rm -R flameshot.iconset"
)
execute_process(
# copy icon from cache generated on the localhost if generation on CI failed
COMMAND bash "-c" "[[ -r 'flameshot.icns' ]] || cp ../packaging/macos/flameshot.icns ./"
)
# Set application icon
set(MACOSX_BUNDLE_ICON_FILE flameshot.icns)
@@ -61,7 +66,6 @@ if (WIN32)
endif ()
endif ()
add_subdirectory(cli)
add_subdirectory(config)
add_subdirectory(core)
@@ -188,7 +192,7 @@ endif ()
target_compile_definitions(flameshot PRIVATE APP_PREFIX="${CMAKE_INSTALL_PREFIX}")
target_compile_definitions(flameshot PRIVATE APP_VERSION="v${PROJECT_VERSION}")
target_compile_definitions(flameshot PRIVATE IMGUR_CLIENT_ID="313baf0c7b4d3ff")
target_compile_definitions(flameshot PRIVATE QAPPLICATION_CLASS=QApplication)
#target_compile_definitions(flameshot PRIVATE QAPPLICATION_CLASS=QApplication)
target_compile_definitions(flameshot PRIVATE FLAMESHOT_APP_VERSION_URL="${GIT_API_URL}")
foreach (FILE ${QM_FILES})

View File

@@ -5,7 +5,7 @@ target_sources(
configwindow.cpp
extendedslider.cpp
filenameeditor.cpp
geneneralconf.cpp
generalconf.cpp
strftimechooserwidget.cpp
styleoverride.cpp
uicoloreditor.cpp

View File

@@ -17,7 +17,7 @@
#include "configwindow.h"
#include "src/config/filenameeditor.h"
#include "src/config/geneneralconf.h"
#include "src/config/generalconf.h"
#include "src/config/shortcutswidget.h"
#include "src/config/strftimechooserwidget.h"
#include "src/config/visualseditor.h"
@@ -69,7 +69,7 @@ ConfigWindow::ConfigWindow(QWidget* parent)
tr("Filename Editor"));
// general
m_generalConfig = new GeneneralConf();
m_generalConfig = new GeneralConf();
addTab(m_generalConfig, QIcon(modifier + "config.svg"), tr("General"));
// shortcuts
@@ -88,7 +88,7 @@ ConfigWindow::ConfigWindow(QWidget* parent)
connect(this,
&ConfigWindow::updateChildren,
m_generalConfig,
&GeneneralConf::updateComponents);
&GeneralConf::updateComponents);
}
void ConfigWindow::keyPressEvent(QKeyEvent* e)

View File

@@ -21,7 +21,7 @@
class FileNameEditor;
class ShortcutsWidget;
class GeneneralConf;
class GeneralConf;
class QFileSystemWatcher;
class VisualsEditor;
@@ -40,7 +40,7 @@ protected:
private:
FileNameEditor* m_filenameEditor;
ShortcutsWidget* m_shortcuts;
GeneneralConf* m_generalConfig;
GeneralConf* m_generalConfig;
VisualsEditor* m_visuals;
QFileSystemWatcher* m_configWatcher;
};

View File

@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with Flameshot. If not, see <http://www.gnu.org/licenses/>.
#include "geneneralconf.h"
#include "generalconf.h"
#include "src/core/controller.h"
#include "src/utils/confighandler.h"
#include <QCheckBox>
@@ -29,8 +29,9 @@
#include <QTextCodec>
#include <QVBoxLayout>
GeneneralConf::GeneneralConf(QWidget* parent)
GeneralConf::GeneralConf(QWidget* parent)
: QWidget(parent)
, m_historyConfirmationToDelete(nullptr)
{
m_layout = new QVBoxLayout(this);
m_layout->setAlignment(Qt::AlignTop);
@@ -38,7 +39,12 @@ GeneneralConf::GeneneralConf(QWidget* parent)
initShowSidePanelButton();
initShowDesktopNotification();
initShowTrayIcon();
initHistoryConfirmationToDelete();
initCheckForUpdates();
initAutostart();
initShowStartupLaunchMessage();
initCopyAndCloseAfterUpload();
initCopyPathAfterSave();
initUseJpgForClipboard();
initSaveAfterCopy();
@@ -47,14 +53,17 @@ GeneneralConf::GeneneralConf(QWidget* parent)
updateComponents();
}
void GeneneralConf::updateComponents()
void GeneralConf::updateComponents()
{
ConfigHandler config;
m_helpMessage->setChecked(config.showHelpValue());
m_sidePanelButton->setChecked(config.showSidePanelButtonValue());
m_sysNotifications->setChecked(config.desktopNotificationValue());
m_autostart->setChecked(config.startupLaunchValue());
m_copyAndCloseAfterUpload->setChecked(
config.copyAndCloseAfterUploadEnabled());
m_saveAfterCopy->setChecked(config.saveAfterCopyValue());
m_copyPathAfterSave->setChecked(config.copyPathAfterSaveEnabled());
m_useJpgForClipboard->setChecked(config.useJpgForClipboard());
if (!config.savePath().isEmpty()) {
@@ -68,22 +77,22 @@ void GeneneralConf::updateComponents()
#endif
}
void GeneneralConf::showHelpChanged(bool checked)
void GeneralConf::showHelpChanged(bool checked)
{
ConfigHandler().setShowHelp(checked);
}
void GeneneralConf::showSidePanelButtonChanged(bool checked)
void GeneralConf::showSidePanelButtonChanged(bool checked)
{
ConfigHandler().setShowSidePanelButton(checked);
}
void GeneneralConf::showDesktopNotificationChanged(bool checked)
void GeneralConf::showDesktopNotificationChanged(bool checked)
{
ConfigHandler().setDesktopNotification(checked);
}
void GeneneralConf::showTrayIconChanged(bool checked)
void GeneralConf::showTrayIconChanged(bool checked)
{
auto controller = Controller::getInstance();
if (checked) {
@@ -93,12 +102,18 @@ void GeneneralConf::showTrayIconChanged(bool checked)
}
}
void GeneneralConf::autostartChanged(bool checked)
void GeneralConf::checkForUpdatesChanged(bool checked)
{
ConfigHandler().setCheckForUpdates(checked);
Controller::getInstance()->setCheckForUpdatesEnabled(checked);
}
void GeneralConf::autostartChanged(bool checked)
{
ConfigHandler().setStartupLaunch(checked);
}
void GeneneralConf::importConfiguration()
void GeneralConf::importConfiguration()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Import"));
if (fileName.isEmpty()) {
@@ -122,7 +137,7 @@ void GeneneralConf::importConfiguration()
config.close();
}
void GeneneralConf::exportFileConfiguration()
void GeneralConf::exportFileConfiguration()
{
QString fileName = QFileDialog::getSaveFileName(
this, tr("Save File"), QStringLiteral("flameshot.conf"));
@@ -142,7 +157,7 @@ void GeneneralConf::exportFileConfiguration()
}
}
void GeneneralConf::resetConfiguration()
void GeneralConf::resetConfiguration()
{
QMessageBox::StandardButton reply;
reply = QMessageBox::question(
@@ -157,7 +172,7 @@ void GeneneralConf::resetConfiguration()
}
}
void GeneneralConf::initShowHelp()
void GeneralConf::initShowHelp()
{
m_helpMessage = new QCheckBox(tr("Show help message"), this);
ConfigHandler config;
@@ -167,13 +182,11 @@ void GeneneralConf::initShowHelp()
"in the capture mode."));
m_layout->addWidget(m_helpMessage);
connect(m_helpMessage,
&QCheckBox::clicked,
this,
&GeneneralConf::showHelpChanged);
connect(
m_helpMessage, &QCheckBox::clicked, this, &GeneralConf::showHelpChanged);
}
void GeneneralConf::initShowSidePanelButton()
void GeneralConf::initShowSidePanelButton()
{
m_sidePanelButton = new QCheckBox(tr("Show the side panel button"), this);
m_sidePanelButton->setChecked(ConfigHandler().showSidePanelButtonValue());
@@ -184,9 +197,9 @@ void GeneneralConf::initShowSidePanelButton()
connect(m_sidePanelButton,
&QCheckBox::clicked,
this,
&GeneneralConf::showSidePanelButtonChanged);
&GeneralConf::showSidePanelButtonChanged);
}
void GeneneralConf::initShowDesktopNotification()
void GeneralConf::initShowDesktopNotification()
{
m_sysNotifications = new QCheckBox(tr("Show desktop notifications"), this);
ConfigHandler config;
@@ -198,10 +211,10 @@ void GeneneralConf::initShowDesktopNotification()
connect(m_sysNotifications,
&QCheckBox::clicked,
this,
&GeneneralConf::showDesktopNotificationChanged);
&GeneralConf::showDesktopNotificationChanged);
}
void GeneneralConf::initShowTrayIcon()
void GeneralConf::initShowTrayIcon()
{
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
m_showTray = new QCheckBox(tr("Show tray icon"), this);
@@ -214,11 +227,28 @@ void GeneneralConf::initShowTrayIcon()
connect(m_showTray,
&QCheckBox::stateChanged,
this,
&GeneneralConf::showTrayIconChanged);
&GeneralConf::showTrayIconChanged);
#endif
}
void GeneneralConf::initConfigButtons()
void GeneralConf::initHistoryConfirmationToDelete()
{
m_historyConfirmationToDelete = new QCheckBox(
tr("Confirmation required to delete screenshot from the latest uploads"),
this);
m_historyConfirmationToDelete->setChecked(
ConfigHandler().historyConfirmationToDelete());
m_historyConfirmationToDelete->setToolTip(
tr("Confirmation required to delete screenshot from the latest uploads"));
m_layout->addWidget(m_historyConfirmationToDelete);
connect(m_historyConfirmationToDelete,
&QCheckBox::clicked,
this,
&GeneralConf::historyConfirmationToDelete);
}
void GeneralConf::initConfigButtons()
{
QHBoxLayout* buttonLayout = new QHBoxLayout();
m_layout->addStretch();
@@ -232,24 +262,37 @@ void GeneneralConf::initConfigButtons()
connect(m_exportButton,
&QPushButton::clicked,
this,
&GeneneralConf::exportFileConfiguration);
&GeneralConf::exportFileConfiguration);
m_importButton = new QPushButton(tr("Import"));
buttonLayout->addWidget(m_importButton);
connect(m_importButton,
&QPushButton::clicked,
this,
&GeneneralConf::importConfiguration);
&GeneralConf::importConfiguration);
m_resetButton = new QPushButton(tr("Reset"));
buttonLayout->addWidget(m_resetButton);
connect(m_resetButton,
&QPushButton::clicked,
this,
&GeneneralConf::resetConfiguration);
&GeneralConf::resetConfiguration);
}
void GeneneralConf::initAutostart()
void GeneralConf::initCheckForUpdates()
{
m_checkForUpdates = new QCheckBox(tr("Automatic check for updates"), this);
m_checkForUpdates->setChecked(ConfigHandler().checkForUpdates());
m_checkForUpdates->setToolTip(tr("Automatic check for updates"));
m_layout->addWidget(m_checkForUpdates);
connect(m_checkForUpdates,
&QCheckBox::clicked,
this,
&GeneralConf::checkForUpdatesChanged);
}
void GeneralConf::initAutostart()
{
m_autostart = new QCheckBox(tr("Launch at startup"), this);
ConfigHandler config;
@@ -259,10 +302,41 @@ void GeneneralConf::initAutostart()
m_layout->addWidget(m_autostart);
connect(
m_autostart, &QCheckBox::clicked, this, &GeneneralConf::autostartChanged);
m_autostart, &QCheckBox::clicked, this, &GeneralConf::autostartChanged);
}
void GeneneralConf::initSaveAfterCopy()
void GeneralConf::initShowStartupLaunchMessage()
{
m_showStartupLaunchMessage =
new QCheckBox(tr("Show welcome message on launch"), this);
ConfigHandler config;
bool checked = config.showStartupLaunchMessage();
m_showStartupLaunchMessage->setChecked(checked);
m_showStartupLaunchMessage->setToolTip(tr("Launch Flameshot"));
m_layout->addWidget(m_showStartupLaunchMessage);
connect(m_showStartupLaunchMessage, &QCheckBox::clicked, [](bool checked) {
ConfigHandler().setShowStartupLaunchMessage(checked);
});
}
void GeneralConf::initCopyAndCloseAfterUpload()
{
m_copyAndCloseAfterUpload =
new QCheckBox(tr("Copy URL after upload"), this);
ConfigHandler config;
m_copyAndCloseAfterUpload->setChecked(
config.copyAndCloseAfterUploadEnabled());
m_copyAndCloseAfterUpload->setToolTip(
tr("Copy URL and close window after upload"));
m_layout->addWidget(m_copyAndCloseAfterUpload);
connect(m_copyAndCloseAfterUpload, &QCheckBox::clicked, [](bool checked) {
ConfigHandler().setCopyAndCloseAfterUploadEnabled(checked);
});
}
void GeneralConf::initSaveAfterCopy()
{
m_saveAfterCopy = new QCheckBox(tr("Save image after copy"), this);
m_saveAfterCopy->setToolTip(tr("Save image file after copying it"));
@@ -270,7 +344,7 @@ void GeneneralConf::initSaveAfterCopy()
connect(m_saveAfterCopy,
&QCheckBox::clicked,
this,
&GeneneralConf::saveAfterCopyChanged);
&GeneralConf::saveAfterCopyChanged);
QGroupBox* box = new QGroupBox(tr("Save Path"));
box->setFlat(true);
@@ -298,7 +372,7 @@ void GeneneralConf::initSaveAfterCopy()
connect(m_changeSaveButton,
&QPushButton::clicked,
this,
&GeneneralConf::changeSavePath);
&GeneralConf::changeSavePath);
m_screenshotPathFixedCheck =
new QCheckBox(tr("Use fixed path for screenshots to save"), this);
@@ -312,7 +386,12 @@ void GeneneralConf::initSaveAfterCopy()
vboxLayout->addWidget(m_screenshotPathFixedCheck);
}
void GeneneralConf::initUseJpgForClipboard()
void GeneralConf::historyConfirmationToDelete(bool checked)
{
ConfigHandler().setHistoryConfirmationToDelete(checked);
}
void GeneralConf::initUseJpgForClipboard()
{
m_useJpgForClipboard =
new QCheckBox(tr("Use JPG format for clipboard (PNG default)"), this);
@@ -326,29 +405,41 @@ void GeneneralConf::initUseJpgForClipboard()
connect(m_useJpgForClipboard,
&QCheckBox::clicked,
this,
&GeneneralConf::useJpgForClipboardChanged);
&GeneralConf::useJpgForClipboardChanged);
}
void GeneneralConf::saveAfterCopyChanged(bool checked)
void GeneralConf::saveAfterCopyChanged(bool checked)
{
ConfigHandler().setSaveAfterCopy(checked);
}
void GeneneralConf::changeSavePath()
void GeneralConf::changeSavePath()
{
QString path = ConfigHandler().savePath();
if (path.isEmpty()) {
path =
QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
}
chooseFolder(path);
path = chooseFolder(path);
if (!path.isEmpty()) {
m_savePath->setText(path);
ConfigHandler().setSavePath(path);
}
}
const QString GeneneralConf::chooseFolder(const QString pathDefault)
void GeneralConf::initCopyPathAfterSave()
{
m_copyPathAfterSave = new QCheckBox(tr("Copy file path after save"), this);
ConfigHandler config;
m_copyPathAfterSave->setChecked(config.copyPathAfterSaveEnabled());
m_copyPathAfterSave->setToolTip(tr("Copy file path after save"));
m_layout->addWidget(m_copyPathAfterSave);
connect(m_copyPathAfterSave, &QCheckBox::clicked, [](bool checked) {
ConfigHandler().setCopyPathAfterSaveEnabled(checked);
});
}
const QString GeneralConf::chooseFolder(const QString pathDefault)
{
QString path;
if (pathDefault.isEmpty()) {
@@ -373,12 +464,12 @@ const QString GeneneralConf::chooseFolder(const QString pathDefault)
return path;
}
void GeneneralConf::togglePathFixed()
void GeneralConf::togglePathFixed()
{
ConfigHandler().setSavePathFixed(m_screenshotPathFixedCheck->isChecked());
}
void GeneneralConf::useJpgForClipboardChanged(bool checked)
void GeneralConf::useJpgForClipboardChanged(bool checked)
{
ConfigHandler().setUseJpgForClipboard(checked);
}

View File

@@ -25,11 +25,11 @@ class QPushButton;
class QLabel;
class QLineEdit;
class GeneneralConf : public QWidget
class GeneralConf : public QWidget
{
Q_OBJECT
public:
explicit GeneneralConf(QWidget* parent = nullptr);
explicit GeneralConf(QWidget* parent = nullptr);
public slots:
void updateComponents();
@@ -39,7 +39,9 @@ private slots:
void showSidePanelButtonChanged(bool checked);
void showDesktopNotificationChanged(bool checked);
void showTrayIconChanged(bool checked);
void checkForUpdatesChanged(bool checked);
void autostartChanged(bool checked);
void historyConfirmationToDelete(bool checked);
void saveAfterCopyChanged(bool checked);
void changeSavePath();
void importConfiguration();
@@ -55,9 +57,14 @@ private:
void initShowSidePanelButton();
void initShowDesktopNotification();
void initShowTrayIcon();
void initHistoryConfirmationToDelete();
void initConfigButtons();
void initCheckForUpdates();
void initAutostart();
void initShowStartupLaunchMessage();
void initCopyAndCloseAfterUpload();
void initSaveAfterCopy();
void initCopyPathAfterSave();
void initUseJpgForClipboard();
// class members
@@ -66,7 +73,11 @@ private:
QCheckBox* m_showTray;
QCheckBox* m_helpMessage;
QCheckBox* m_sidePanelButton;
QCheckBox* m_checkForUpdates;
QCheckBox* m_autostart;
QCheckBox* m_showStartupLaunchMessage;
QCheckBox* m_copyAndCloseAfterUpload;
QCheckBox* m_copyPathAfterSave;
QPushButton* m_importButton;
QPushButton* m_exportButton;
QPushButton* m_resetButton;
@@ -74,5 +85,6 @@ private:
QLineEdit* m_savePath;
QPushButton* m_changeSaveButton;
QCheckBox* m_screenshotPathFixedCheck;
QCheckBox* m_historyConfirmationToDelete;
QCheckBox* m_useJpgForClipboard;
};

View File

@@ -17,6 +17,7 @@
#include "shortcutswidget.h"
#include "setshortcutwidget.h"
#include "src/core/qguiappcurrentscreen.h"
#include <QHeaderView>
#include <QIcon>
#include <QKeyEvent>
@@ -28,7 +29,6 @@
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
#include <QCursor>
#include <QGuiApplication>
#include <QRect>
#include <QScreen>
#endif
@@ -42,7 +42,7 @@ ShortcutsWidget::ShortcutsWidget(QWidget* parent)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
QRect position = frameGeometry();
QScreen* screen = QGuiApplication::screenAt(QCursor::pos());
QScreen* screen = QGuiAppCurrentScreen().currentScreen();
position.moveCenter(screen->availableGeometry().center());
move(position.topLeft());
#endif
@@ -94,9 +94,6 @@ void ShortcutsWidget::initInfoTable()
? default_key_sequence
: m_config.shortcut(identifier);
#if defined(Q_OS_MACOS)
// QTableWidgetItem* item =
// new
// QTableWidgetItem(nativeOSHotKeyText(m_shortcuts.at(i).at(2)));
QTableWidgetItem* item =
new QTableWidgetItem(nativeOSHotKeyText(key_sequence));
#else
@@ -151,8 +148,7 @@ void ShortcutsWidget::slotShortcutCellClicked(int row, int col)
}
if (m_config.setShortcut(shortcutName, shortcutValue.toString())) {
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
QTableWidgetItem* item = new QTableWidgetItem(
nativeOSHotKeyText(shortcutValue.toString()));
#else
@@ -168,8 +164,7 @@ void ShortcutsWidget::slotShortcutCellClicked(int row, int col)
}
}
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
const QString& ShortcutsWidget::nativeOSHotKeyText(const QString& text)
{
m_res = text;
@@ -179,4 +174,4 @@ const QString& ShortcutsWidget::nativeOSHotKeyText(const QString& text)
m_res.replace("Shift+", "");
return m_res;
}
#endif
#endif

View File

@@ -22,7 +22,6 @@
#include "src/utils/confighandler.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QVBoxLayout>
VisualsEditor::VisualsEditor(QWidget* parent)
: QWidget(parent)
@@ -46,10 +45,6 @@ void VisualsEditor::initOpacitySlider()
m_opacitySlider->setFocusPolicy(Qt::NoFocus);
m_opacitySlider->setOrientation(Qt::Horizontal);
m_opacitySlider->setRange(0, 100);
connect(m_opacitySlider,
&ExtendedSlider::modificationsEnded,
this,
&VisualsEditor::saveOpacity);
QHBoxLayout* localLayout = new QHBoxLayout();
localLayout->addWidget(new QLabel(QStringLiteral("0%")));
localLayout->addWidget(m_opacitySlider);
@@ -57,10 +52,15 @@ void VisualsEditor::initOpacitySlider()
QLabel* label = new QLabel();
QString labelMsg = tr("Opacity of area outside selection:") + " %1%";
ExtendedSlider* opacitySlider = m_opacitySlider;
connect(m_opacitySlider,
&ExtendedSlider::valueChanged,
this,
[labelMsg, label](int val) { label->setText(labelMsg.arg(val)); });
[labelMsg, label, opacitySlider](int val) {
label->setText(labelMsg.arg(val));
ConfigHandler().setContrastOpacity(
opacitySlider->mappedValue(0, 255));
});
m_layout->addWidget(label);
m_layout->addLayout(localLayout);
@@ -68,12 +68,6 @@ void VisualsEditor::initOpacitySlider()
m_opacitySlider->setMapedValue(0, opacity, 255);
}
void VisualsEditor::saveOpacity()
{
int value = m_opacitySlider->mappedValue(0, 255);
ConfigHandler().setContrastOpacity(value);
}
void VisualsEditor::initWidgets()
{
m_colorEditor = new UIcolorEditor();

View File

@@ -33,9 +33,6 @@ public:
public slots:
void updateComponents();
private slots:
void saveOpacity();
private:
QVBoxLayout* m_layout;
ButtonListView* m_buttonList;

View File

@@ -1,8 +1,6 @@
# Required to generate MOC
target_sources(flameshot PRIVATE controller.h flameshotdbusadapter.h qguiappcurrentscreen.h)
target_sources(flameshot PRIVATE controller.h flameshotdbusadapter.h)
target_sources(flameshot PRIVATE capturerequest.cpp controller.cpp flameshotdbusadapter.cpp)
target_sources(flameshot PRIVATE capturerequest.cpp controller.cpp flameshotdbusadapter.cpp qguiappcurrentscreen.cpp)
IF (WIN32)
target_sources(flameshot PRIVATE globalshortcutfilter.h globalshortcutfilter.cpp)

View File

@@ -18,6 +18,7 @@
#include "controller.h"
#include "external/QHotkey/QHotkey"
#include "src/config/configwindow.h"
#include "src/core/qguiappcurrentscreen.h"
#include "src/utils/confighandler.h"
#include "src/utils/history.h"
#include "src/utils/screengrabber.h"
@@ -36,17 +37,19 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <QMenu>
#include <QMessageBox>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QOperatingSystemVersion>
#include <QSystemTrayIcon>
#include <QThread>
#ifdef Q_OS_WIN
#include "src/core/globalshortcutfilter.h"
#endif
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
#include <QOperatingSystemVersion>
#include <QScreen>
#endif
@@ -57,11 +60,11 @@
Controller::Controller()
: m_captureWindow(nullptr)
, m_history(nullptr)
, m_trayIcon(nullptr)
, m_trayIconMenu(nullptr)
, m_networkCheckUpdates(nullptr)
, m_showCheckAppUpdateStatus(false)
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
, m_HotkeyScreenshotCapture(nullptr)
, m_HotkeyScreenshotHistory(nullptr)
#endif
@@ -90,12 +93,11 @@ Controller::Controller()
QString StyleSheet = CaptureButton::globalStyleSheet();
qApp->setStyleSheet(StyleSheet);
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
// Try to take a test screenshot, MacOS will request a "Screen Recording"
// permissions on the first run. Otherwise it will be hidden under the
// CaptureWidget
QScreen* currentScreen = QGuiApplication::screenAt(QCursor::pos());
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
currentScreen->grabWindow(QApplication::desktop()->winId(), 0, 0, 1, 1);
// set global shortcuts for MacOS
@@ -135,6 +137,15 @@ void Controller::enableExports()
this, &Controller::captureFailed, this, &Controller::handleCaptureFailed);
}
void Controller::setCheckForUpdatesEnabled(const bool enabled)
{
m_appUpdates->setVisible(enabled);
m_appUpdates->setEnabled(enabled);
if (enabled) {
getLatestAvailableVersion();
}
}
void Controller::getLatestAvailableVersion()
{
// This features is required for MacOS and Windows user and for Linux users
@@ -149,19 +160,45 @@ void Controller::getLatestAvailableVersion()
// check for updates each 24 hours
doLater(1000 * 60 * 60 * 24, this, [this]() {
this->getLatestAvailableVersion();
if (ConfigHandler().checkForUpdates()) {
this->getLatestAvailableVersion();
}
});
}
void Controller::handleReplyCheckUpdates(QNetworkReply* reply)
{
if (!ConfigHandler().checkForUpdates()) {
return;
}
if (reply->error() == QNetworkReply::NoError) {
QJsonDocument response = QJsonDocument::fromJson(reply->readAll());
QJsonObject json = response.object();
m_appLatestVersion = json["tag_name"].toString().replace("v", "");
if (QStringLiteral(APP_VERSION)
.replace("v", "")
.compare(m_appLatestVersion) < 0) {
// Transform strings version for correct comparison
QStringList appLatestVersion =
m_appLatestVersion.replace("v", "").split(".");
QStringList currentVersion =
QStringLiteral(APP_VERSION).replace("v", "").split(".");
// transform versions to the string which can be compared correctly,
// example: versions "0.8.5.9" and "0.8.5.10" are transformed into:
// "0000.0008.0005.0009" and "0000.0008.0005.0010"
// For string comparison you'll get:
// "0.8.5.9" < "0.8.5.10" INCORRECT (lower version is bigger)
// "0000.0008.0005.0009" > "0000.0008.0005.0010" CORRECT
std::transform(
appLatestVersion.begin(),
appLatestVersion.end(),
appLatestVersion.begin(),
[](QString c) -> QString { return c = ("0000" + c).right(4); });
std::transform(
currentVersion.begin(),
currentVersion.end(),
currentVersion.begin(),
[](QString c) -> QString { return c = ("0000" + c).right(4); });
if (currentVersion.join(".").compare(appLatestVersion.join(".")) < 0) {
m_appLatestUrl = json["html_url"].toString();
QString newVersion =
tr("New version %1 is available").arg(m_appLatestVersion);
@@ -233,15 +270,36 @@ void Controller::requestCapture(const CaptureRequest& request)
void Controller::startVisualCapture(const uint id,
const QString& forcedSavePath)
{
if (!m_captureWindow) {
#if defined(Q_OS_MACOS)
// This is required on MacOS because of Mission Control. If you'll switch to
// another Desktop you cannot take a new screenshot from the tray, you have
// to switch back to the Flameshot Desktop manually. It is not obvious and a
// large number of users are confused and report a bug.
if (m_captureWindow) {
m_captureWindow->close();
delete m_captureWindow;
m_captureWindow = nullptr;
}
#endif
if (nullptr == m_captureWindow) {
int timeout = 5000; // 5 seconds
const int delay = 100;
QWidget* modalWidget = nullptr;
do {
for (; timeout >= 0; timeout -= delay) {
modalWidget = qApp->activeModalWidget();
if (modalWidget) {
modalWidget->close();
modalWidget->deleteLater();
if (nullptr == modalWidget) {
break;
}
} while (modalWidget);
modalWidget->close();
modalWidget->deleteLater();
QThread::msleep(delay);
}
if (0 == timeout) {
QMessageBox::warning(
nullptr, tr("Error"), tr("Unable to close active modal widgets"));
return;
}
m_captureWindow = new CaptureWidget(id, forcedSavePath);
// m_captureWindow = new CaptureWidget(id, forcedSavePath, false); //
@@ -257,8 +315,7 @@ void Controller::startVisualCapture(const uint id,
#ifdef Q_OS_WIN
m_captureWindow->show();
#elif (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#elif defined(Q_OS_MACOS)
// In "Emulate fullscreen mode"
m_captureWindow->showFullScreen();
m_captureWindow->activateWindow();
@@ -302,8 +359,7 @@ void Controller::openConfigWindow()
if (!m_configWindow) {
m_configWindow = new ConfigWindow();
m_configWindow->show();
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
m_configWindow->activateWindow();
m_configWindow->raise();
#endif
@@ -315,8 +371,7 @@ void Controller::openInfoWindow()
{
if (!m_infoWindow) {
m_infoWindow = new InfoWindow();
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
m_infoWindow->activateWindow();
m_infoWindow->raise();
#endif
@@ -329,8 +384,7 @@ void Controller::openLauncherWindow()
m_launcherWindow = new CaptureLauncher();
}
m_launcherWindow->show();
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
m_launcherWindow->activateWindow();
m_launcherWindow->raise();
#endif
@@ -341,13 +395,27 @@ void Controller::enableTrayIcon()
if (m_trayIcon) {
return;
}
m_trayIconMenu = new QMenu();
if (nullptr == m_trayIconMenu) {
m_trayIconMenu = new QMenu();
Q_ASSERT(m_trayIconMenu);
}
ConfigHandler().setDisabledTrayIcon(false);
QAction* captureAction = new QAction(tr("&Take Screenshot"), this);
connect(captureAction, &QAction::triggered, this, [this]() {
// Wait 400 ms to hide the QMenu
#if defined(Q_OS_MACOS)
auto currentMacOsVersion = QOperatingSystemVersion::current();
if (currentMacOsVersion >= currentMacOsVersion.MacOSBigSur) {
startVisualCapture();
} else {
// It seems it is not relevant for MacOS BigSur (Wait 400 ms to hide
// the QMenu)
doLater(400, this, [this]() { this->startVisualCapture(); });
}
#else
// Wait 400 ms to hide the QMenu
doLater(400, this, [this]() { this->startVisualCapture(); });
#endif
});
QAction* launcherAction = new QAction(tr("&Open Launcher"), this);
connect(launcherAction,
@@ -383,11 +451,14 @@ void Controller::enableTrayIcon()
m_trayIconMenu->addAction(infoAction);
m_trayIconMenu->addSeparator();
m_trayIconMenu->addAction(quitAction);
setCheckForUpdatesEnabled(ConfigHandler().checkForUpdates());
m_trayIcon = new QSystemTrayIcon();
if (nullptr == m_trayIcon) {
m_trayIcon = new QSystemTrayIcon();
Q_ASSERT(m_trayIcon);
}
m_trayIcon->setToolTip(QStringLiteral("Flameshot"));
#if defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX)
#if defined(Q_OS_MACOS)
// Because of the following issues on MacOS "Catalina":
// https://bugreports.qt.io/browse/QTBUG-86393
// https://developer.apple.com/forums/thread/126072
@@ -398,12 +469,11 @@ void Controller::enableTrayIcon()
#else
m_trayIcon->setContextMenu(m_trayIconMenu);
#endif
QIcon trayicon =
QIcon trayIcon =
QIcon::fromTheme("flameshot-tray", QIcon(":img/app/flameshot.png"));
m_trayIcon->setIcon(trayicon);
m_trayIcon->setIcon(trayIcon);
#if defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX)
#if defined(Q_OS_MACOS)
if (currentMacOsVersion < currentMacOsVersion.MacOSBigSur) {
// Because of the following issues on MacOS "Catalina":
// https://bugreports.qt.io/browse/QTBUG-86393
@@ -434,6 +504,15 @@ void Controller::enableTrayIcon()
#endif
m_trayIcon->show();
if (ConfigHandler().showStartupLaunchMessage()) {
m_trayIcon->showMessage(
"Flameshot",
QObject::tr(
"Hello, I'm here! Click icon in the tray to take a screenshot or "
"click with a right button to see more options."),
QSystemTrayIcon::Information,
3000);
}
}
void Controller::disableTrayIcon()
@@ -479,8 +558,7 @@ void Controller::showRecentScreenshots()
}
m_history->loadHistory();
m_history->show();
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
m_history->activateWindow();
m_history->raise();
#endif

View File

@@ -54,6 +54,8 @@ public:
void enableExports();
void updateRecentScreenshots();
void setCheckForUpdatesEnabled(const bool enabled);
signals:
void captureTaken(uint id, QPixmap p, QRect selection);
void captureFailed(uint id);

View File

@@ -0,0 +1,64 @@
//
// Created by yuriypuchkov on 09.02.2021.
//
#include "qguiappcurrentscreen.h"
#include <QCursor>
#include <QDesktopWidget>
#include <QGuiApplication>
#include <QPoint>
#include <QScreen>
QGuiAppCurrentScreen::QGuiAppCurrentScreen()
{
m_currentScreen = nullptr;
}
QScreen* QGuiAppCurrentScreen::currentScreen()
{
return currentScreen(QCursor::pos());
}
QScreen* QGuiAppCurrentScreen::currentScreen(const QPoint& pos)
{
m_currentScreen = screenAt(pos);
#if defined(Q_OS_MACOS)
// On the MacOS if mouse position is at the edge of bottom or right sides
// qGuiApp->screenAt will return nullptr, so we need to try to find current
// screen by moving 1 pixel inside to the current desktop area
if (!m_currentScreen && pos.x() > 0) {
QPoint posCorrected(pos.x() - 1, pos.y());
m_currentScreen = screenAt(posCorrected);
}
if (!m_currentScreen && pos.y() > 0) {
QPoint posCorrected(pos.x(), pos.y() - 1);
m_currentScreen = screenAt(posCorrected);
}
if (!m_currentScreen && pos.x() > 0 && pos.y() > 0) {
QPoint posCorrected(pos.x() - 1, pos.y() - 1);
m_currentScreen = screenAt(posCorrected);
}
#endif
if (!m_currentScreen) {
qCritical("Unable to get current screen, starting to use primary "
"screen. It may be a cause of logical error and working with "
"a wrong screen.");
m_currentScreen = qGuiApp->primaryScreen();
}
return m_currentScreen;
}
QScreen* QGuiAppCurrentScreen::screenAt(const QPoint& pos)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
m_currentScreen = qGuiApp->screenAt(pos);
#else
for (QScreen* const screen : QGuiApplication::screens()) {
m_currentScreen = screen;
if (screen->geometry().contains(pos)) {
break;
}
}
#endif
return m_currentScreen;
}

View File

@@ -0,0 +1,27 @@
//
// Created by yuriypuchkov on 09.02.2021.
//
#ifndef FLAMESHOT_QGUIAPPCURRENTSCREEN_H
#define FLAMESHOT_QGUIAPPCURRENTSCREEN_H
#include <QPoint>
class QScreen;
class QGuiAppCurrentScreen
{
public:
explicit QGuiAppCurrentScreen();
QScreen* currentScreen();
QScreen* currentScreen(const QPoint& pos);
private:
QScreen* screenAt(const QPoint& pos);
// class members
private:
QScreen* m_currentScreen;
};
#endif // FLAMESHOT_QGUIAPPCURRENTSCREEN_H

View File

@@ -108,8 +108,7 @@ int main(int argc, char* argv[])
app.setOrganizationName(QStringLiteral("flameshot"));
auto c = Controller::getInstance();
#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX) || defined(Q_OS_WIN))
#if not(defined(Q_OS_MACOS) || defined(Q_OS_WIN))
new FlameshotDBusAdapter(c);
QDBusConnection dbus = QDBusConnection::sessionBus();
if (!dbus.isConnected()) {
@@ -125,8 +124,7 @@ int main(int argc, char* argv[])
return app.exec();
}
#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX) || defined(Q_OS_WIN))
#if not(defined(Q_OS_MACOS) || defined(Q_OS_WIN))
/*--------------|
* CLI parsing |
* ------------*/

View File

@@ -46,8 +46,7 @@ bool AbstractPathTool::showMousePreview() const
void AbstractPathTool::undo(QPixmap& pixmap)
{
QPainter p(&pixmap);
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
// Not sure how will it work on 4k and fullHd on Linux or Windows with a
// capture of different displays with different DPI, so let it be MacOS
// specific only.
@@ -86,8 +85,7 @@ void AbstractPathTool::updateBackup(const QPixmap& pixmap)
QRect AbstractPathTool::backupRect(const QPixmap& pixmap) const
{
const QRect& limits = pixmap.rect();
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
// Not sure how will it work on 4k and fullHd on Linux or Windows with a
// capture of different displays with different DPI, so let it be MacOS
// specific only.

View File

@@ -17,7 +17,6 @@
#include "abstracttwopointtool.h"
#include <QCursor>
#include <QGuiApplication>
#include <QScreen>
#include <cmath>
@@ -74,8 +73,7 @@ bool AbstractTwoPointTool::showMousePreview() const
void AbstractTwoPointTool::undo(QPixmap& pixmap)
{
QPainter p(&pixmap);
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
// Not sure how will it work on 4k and fullHd on Linux or Windows with a
// capture of different displays with different DPI, so let it be MacOS
// specific only.
@@ -123,8 +121,7 @@ QRect AbstractTwoPointTool::backupRect(const QPixmap& pixmap) const
{
const QRect& limits = pixmap.rect();
QRect r = QRect(m_points.first, m_points.second).normalized();
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
// Not sure how will it work on 4k and fullHd on Linux or Windows with a
// capture of different displays with different DPI, so let it be MacOS
// specific only.

View File

@@ -108,8 +108,14 @@ void ImgurUploader::handleReply(QNetworkReply* reply)
imageName = history.packFileName("imgur", deleteToken, imageName);
history.save(m_pixmap, imageName);
onUploadOk();
if (ConfigHandler().copyAndCloseAfterUploadEnabled()) {
QApplication::clipboard()->setText(m_imageURL.toString());
SystemNotification().sendMessage(
QObject::tr("URL copied to clipboard."));
close();
} else {
onUploadOk();
}
} else {
m_infoLabel->setText(reply->errorString());
}

View File

@@ -16,7 +16,9 @@
// along with Flameshot. If not, see <http://www.gnu.org/licenses/>.
#include "pintool.h"
#include "src/core/qguiappcurrentscreen.h"
#include "src/tools/pin/pinwidget.h"
#include <QScreen>
PinTool::PinTool(QObject* parent)
: AbstractActionTool(parent)
@@ -49,10 +51,31 @@ QString PinTool::description() const
QWidget* PinTool::widget()
{
qreal devicePixelRatio = 1;
#if defined(Q_OS_MACOS)
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
if (currentScreen) {
devicePixelRatio = currentScreen->devicePixelRatio();
}
#endif
PinWidget* w = new PinWidget(m_pixmap);
const int&& m = w->margin();
const int m = w->margin() * devicePixelRatio;
QRect adjusted_pos = m_geometry + QMargins(m, m, m, m);
w->setGeometry(adjusted_pos);
#if defined(Q_OS_MACOS)
if (currentScreen) {
QPoint topLeft = currentScreen->geometry().topLeft();
adjusted_pos.setX((adjusted_pos.x() - topLeft.x()) / devicePixelRatio +
topLeft.x());
adjusted_pos.setY((adjusted_pos.y() - topLeft.y()) / devicePixelRatio +
topLeft.y());
adjusted_pos.setWidth(adjusted_pos.size().width() / devicePixelRatio);
adjusted_pos.setHeight(adjusted_pos.size().height() / devicePixelRatio);
w->resize(0, 0);
w->move(adjusted_pos.x(), adjusted_pos.y());
}
#endif
return w;
}

View File

@@ -27,6 +27,7 @@ PinWidget::PinWidget(const QPixmap& pixmap, QWidget* parent)
: QWidget(parent)
, m_pixmap(pixmap)
{
setWindowIcon(QIcon(":img/app/flameshot.svg"));
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
// set the bottom widget background transparent
setAttribute(Qt::WA_TranslucentBackground);

View File

@@ -18,8 +18,7 @@
#include "savetool.h"
#include "src/utils/screenshotsaver.h"
#include <QPainter>
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
#include "src/widgets/capture/capturewidget.h"
#include <QApplication>
#include <QWidget>
@@ -61,13 +60,13 @@ CaptureTool* SaveTool::copy(QObject* parent)
void SaveTool::pressed(const CaptureContext& context)
{
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
for (QWidget* widget : qApp->topLevelWidgets()) {
QString className(widget->metaObject()->className());
if (0 ==
className.compare(CaptureWidget::staticMetaObject.className())) {
widget->showNormal();
widget->hide();
break;
}
}

View File

@@ -130,8 +130,7 @@ CaptureTool* TextTool::copy(QObject* parent)
void TextTool::undo(QPixmap& pixmap)
{
QPainter p(&pixmap);
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
// Not sure how will it work on 4k and fullHd on Linux or Windows with a
// capture of different displays with different DPI, so let it be MacOS
// specific only.
@@ -166,8 +165,7 @@ QRect TextTool::backupRect(const QPixmap& pixmap) const
{
const QRect& limits = pixmap.rect();
QRect r = m_backupArea.normalized();
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
const qreal pixelRatio = pixmap.devicePixelRatio();
const int val = 5 * pixelRatio;
if (1 != pixelRatio) {

View File

@@ -92,8 +92,7 @@ CaptureTool* ToolFactory::CreateTool(CaptureToolButton::ButtonType t,
case CaptureToolButton::TYPE_REDO:
tool = new RedoTool(parent);
break;
#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if not defined(Q_OS_MACOS)
case CaptureToolButton::TYPE_OPEN_APP:
tool = new AppLauncher(parent);
break;

View File

@@ -62,8 +62,7 @@ QVector<CaptureToolButton::ButtonType> ConfigHandler::getButtons()
<< CaptureToolButton::TYPE_COPY << CaptureToolButton::TYPE_SAVE
<< CaptureToolButton::TYPE_EXIT
<< CaptureToolButton::TYPE_IMAGEUPLOADER
#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if not defined(Q_OS_MACOS)
<< CaptureToolButton::TYPE_OPEN_APP
#endif
<< CaptureToolButton::TYPE_PIN << CaptureToolButton::TYPE_TEXT
@@ -309,10 +308,23 @@ void ConfigHandler::setKeepOpenAppLauncher(const bool keepOpen)
m_settings.setValue(QStringLiteral("keepOpenAppLauncher"), keepOpen);
}
bool ConfigHandler::checkForUpdates()
{
bool res = true;
if (m_settings.contains(QStringLiteral("checkForUpdates"))) {
res = m_settings.value(QStringLiteral("checkForUpdates")).toBool();
}
return res;
}
void ConfigHandler::setCheckForUpdates(const bool checkForUpdates)
{
m_settings.setValue(QStringLiteral("checkForUpdates"), checkForUpdates);
}
bool ConfigHandler::startupLaunchValue()
{
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
bool res = false;
#else
bool res = true;
@@ -351,8 +363,7 @@ void ConfigHandler::setStartupLaunch(const bool start)
if (start == m_settings.value(QStringLiteral("startupLaunch")).toBool()) {
return;
}
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
/* TODO - there should be more correct way via API, but didn't find it
without extra dependencies, there should be something like that:
https://stackoverflow.com/questions/3358410/programmatically-run-at-startup-on-mac-os-x
@@ -431,6 +442,22 @@ void ConfigHandler::setStartupLaunch(const bool start)
m_settings.setValue(QStringLiteral("startupLaunch"), start);
}
bool ConfigHandler::showStartupLaunchMessage()
{
if (!m_settings.contains(QStringLiteral("showStartupLaunchMessage"))) {
m_settings.setValue(QStringLiteral("showStartupLaunchMessage"), true);
}
return m_settings.value(QStringLiteral("showStartupLaunchMessage"))
.toBool();
}
void ConfigHandler::setShowStartupLaunchMessage(
const bool showStartupLaunchMessage)
{
m_settings.setValue(QStringLiteral("showStartupLaunchMessage"),
showStartupLaunchMessage);
}
int ConfigHandler::contrastOpacityValue()
{
int opacity = 190;
@@ -446,6 +473,36 @@ void ConfigHandler::setContrastOpacity(const int transparency)
m_settings.setValue(QStringLiteral("contrastOpacity"), transparency);
}
bool ConfigHandler::copyAndCloseAfterUploadEnabled()
{
bool res = true;
if (m_settings.contains(QStringLiteral("copyAndCloseAfterUpload"))) {
res =
m_settings.value(QStringLiteral("copyAndCloseAfterUpload")).toBool();
}
return res;
}
void ConfigHandler::setCopyAndCloseAfterUploadEnabled(const bool value)
{
m_settings.setValue(QStringLiteral("copyAndCloseAfterUpload"), value);
}
bool ConfigHandler::historyConfirmationToDelete()
{
bool res = true;
if (m_settings.contains(QStringLiteral("historyConfirmationToDelete"))) {
res = m_settings.value(QStringLiteral("historyConfirmationToDelete"))
.toBool();
}
return res;
}
void ConfigHandler::setHistoryConfirmationToDelete(const bool check)
{
m_settings.setValue(QStringLiteral("historyConfirmationToDelete"), check);
}
bool ConfigHandler::saveAfterCopyValue()
{
return m_settings.value(QStringLiteral("saveAfterCopy")).toBool();

View File

@@ -70,13 +70,23 @@ public:
bool keepOpenAppLauncherValue();
void setKeepOpenAppLauncher(const bool);
bool checkForUpdates();
void setCheckForUpdates(const bool);
bool verifyLaunchFile();
bool startupLaunchValue();
void setStartupLaunch(const bool);
bool showStartupLaunchMessage();
void setShowStartupLaunchMessage(const bool);
int contrastOpacityValue();
void setContrastOpacity(const int);
bool copyAndCloseAfterUploadEnabled();
void setCopyAndCloseAfterUploadEnabled(const bool);
bool historyConfirmationToDelete();
void setHistoryConfirmationToDelete(const bool save);
bool saveAfterCopyValue();
void setSaveAfterCopy(const bool);

View File

@@ -62,17 +62,20 @@ const QVector<QStringList>& ConfigShortcuts::captureShortcutsDefault(
m_shortcuts << (QStringList() << "" << QObject::tr("Quit capture")
<< QKeySequence(Qt::Key_Escape).toString());
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
m_shortcuts << (QStringList()
<< "" << QObject::tr("Screenshot history") << "⇧⌘⌥H");
m_shortcuts << (QStringList()
<< "" << QObject::tr("Capture screen") << "⇧⌘⌥4");
#else
#elif defined(Q_OS_WIN)
m_shortcuts << (QStringList() << "" << QObject::tr("Screenshot history")
<< "Shift+Print Screen");
m_shortcuts << (QStringList()
<< "" << QObject::tr("Capture screen") << "Print Screen");
#else
// TODO - Linux doesn't support global shortcuts for (XServer and Wayland),
// possibly it will be solved in the QHotKey library later. So it is
// disabled for now.
#endif
m_shortcuts << (QStringList()
<< "" << QObject::tr("Show color picker") << "Right Click");
@@ -128,8 +131,7 @@ const QKeySequence& ConfigShortcuts::captureShortcutDefault(
case CaptureToolButton::ButtonType::TYPE_IMAGEUPLOADER:
m_ks = QKeySequence(Qt::Key_Return);
break;
#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if not defined(Q_OS_MACOS)
case CaptureToolButton::ButtonType::TYPE_OPEN_APP:
m_ks = QKeySequence(Qt::CTRL + Qt::Key_O);
break;

View File

@@ -16,6 +16,7 @@
// along with Flameshot. If not, see <http://www.gnu.org/licenses/>.
#include "screengrabber.h"
#include "src/core/qguiappcurrentscreen.h"
#include "src/utils/filenamehandler.h"
#include "src/utils/systemnotification.h"
#include <QApplication>
@@ -38,9 +39,8 @@ ScreenGrabber::ScreenGrabber(QObject* parent)
QPixmap ScreenGrabber::grabEntireDesktop(bool& ok)
{
ok = true;
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
QScreen* currentScreen = QGuiApplication::screenAt(QCursor::pos());
#if defined(Q_OS_MACOS)
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
QPixmap screenPixmap(
currentScreen->grabWindow(QApplication::desktop()->winId(),
currentScreen->geometry().x(),

View File

@@ -27,6 +27,9 @@
#include <QImageWriter>
#include <QMessageBox>
#include <QMimeData>
#if defined(Q_OS_MACOS)
#include "src/widgets/capture/capturewidget.h"
#endif
ScreenshotSaver::ScreenshotSaver()
: m_id(0)
@@ -117,6 +120,17 @@ bool ScreenshotSaver::saveToFilesystemGUI(const QPixmap& capture)
while (!ok) {
ConfigHandler config;
QString savePath = FileNameHandler().absoluteSavePath();
#if defined(Q_OS_MACOS)
for (QWidget* widget : qApp->topLevelWidgets()) {
QString className(widget->metaObject()->className());
if (0 == className.compare(
CaptureWidget::staticMetaObject.className())) {
widget->showNormal();
widget->hide();
break;
}
}
#endif
if (!config.savePathFixed()) {
savePath = QFileDialog::getSaveFileName(
nullptr,

View File

@@ -4,8 +4,7 @@
#include <QApplication>
#include <QUrl>
#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX) || defined(Q_OS_WIN))
#if not(defined(Q_OS_MACOS) || defined(Q_OS_WIN))
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDBusMessage>
@@ -15,8 +14,7 @@ SystemNotification::SystemNotification(QObject* parent)
: QObject(parent)
, m_interface(nullptr)
{
#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX) || defined(Q_OS_WIN))
#if not(defined(Q_OS_MACOS) || defined(Q_OS_WIN))
m_interface =
new QDBusInterface(QStringLiteral("org.freedesktop.Notifications"),
QStringLiteral("/org/freedesktop/Notifications"),
@@ -41,8 +39,7 @@ void SystemNotification::sendMessage(const QString& text,
return;
}
#if defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX) || defined(Q_OS_WIN)
#if defined(Q_OS_MACOS) || defined(Q_OS_WIN)
Controller::getInstance()->sendTrayNotification(text, title, timeout);
#else
QList<QVariant> args;

View File

@@ -17,7 +17,6 @@
#include "buttonhandler.h"
#include "src/utils/globalvalues.h"
#include <QGuiApplication>
#include <QPoint>
#include <QScreen>

View File

@@ -134,8 +134,7 @@ static std::map<CaptureToolButton::ButtonType, int> buttonTypeOrder
{ CaptureToolButton::TYPE_COPY, 14 },
{ CaptureToolButton::TYPE_SAVE, 15 },
{ CaptureToolButton::TYPE_IMAGEUPLOADER, 16 },
#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if not defined(Q_OS_MACOS)
{ CaptureToolButton::TYPE_OPEN_APP, 17 },
{ CaptureToolButton::TYPE_EXIT, 18 }, { CaptureToolButton::TYPE_PIN, 19 },
#else
@@ -169,8 +168,7 @@ QVector<CaptureToolButton::ButtonType>
CaptureToolButton::TYPE_SAVE,
CaptureToolButton::TYPE_EXIT,
CaptureToolButton::TYPE_IMAGEUPLOADER,
#if not(defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if not defined(Q_OS_MACOS)
CaptureToolButton::TYPE_OPEN_APP,
#endif
CaptureToolButton::TYPE_PIN,

View File

@@ -25,6 +25,7 @@
#include "capturewidget.h"
#include "src/core/controller.h"
#include "src/core/qguiappcurrentscreen.h"
#include "src/tools/toolfactory.h"
#include "src/utils/colorutils.h"
#include "src/utils/screengrabber.h"
@@ -40,7 +41,6 @@
#include <QApplication>
#include <QDateTime>
#include <QDesktopWidget>
#include <QGuiApplication>
#include <QPaintEvent>
#include <QPainter>
#include <QScreen>
@@ -92,8 +92,7 @@ CaptureWidget::CaptureWidget(const uint id,
initContext(savePath, fullScreen);
initShortcuts();
m_context.circleCount = 1;
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_MAC64) || \
defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_WIN) || defined(Q_OS_MACOS))
// Top left of the whole set of screens
QPoint topLeft(0, 0);
#endif
@@ -113,18 +112,14 @@ CaptureWidget::CaptureWidget(const uint id,
for (QScreen* const screen : QGuiApplication::screens()) {
QPoint topLeftScreen = screen->geometry().topLeft();
if (topLeftScreen.x() < topLeft.x()) {
topLeft.setX(topLeftScreen.x());
}
if (topLeftScreen.y() < topLeft.y()) {
topLeft.setY(topLeftScreen.y());
if (topLeft.x() > topLeftScreen.x() ||
topLeft.y() > topLeftScreen.y()) {
topLeft = topLeftScreen;
}
}
move(topLeft);
resize(pixmap().size());
#elif (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#elif defined(Q_OS_MACOS)
// Emulate fullscreen mode
// setWindowFlags(Qt::WindowStaysOnTopHint |
// Qt::BypassWindowManagerHint |
@@ -132,7 +127,7 @@ CaptureWidget::CaptureWidget(const uint id,
// Qt::NoDropShadowWindowHint | Qt::ToolTip |
// Qt::Popup
// );
QScreen* currentScreen = QGuiApplication::screenAt(QCursor::pos());
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
move(currentScreen->geometry().x(), currentScreen->geometry().y());
resize(currentScreen->size());
#else
@@ -146,33 +141,31 @@ CaptureWidget::CaptureWidget(const uint id,
updateButtons();
QVector<QRect> areas;
if (m_context.fullscreen) {
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
QPoint currentPos = QCursor::pos();
QPoint topLeftOffset = QPoint(0, 0);
#if defined(Q_OS_WIN)
topLeftOffset - topLeft;
#endif
#if defined(Q_OS_MACOS)
// MacOS works just with one active display, so we need to append
// just one current display and keep multiple displays logic for
// other OS
QRect r;
QScreen* screen = QGuiAppCurrentScreen().currentScreen();
r = screen->geometry();
// all calculations are processed according to (0, 0) start
// point so we need to move current object to (0, 0)
r.moveTo(0, 0);
areas.append(r);
#else
for (QScreen* const screen : QGuiApplication::screens()) {
QRect r = screen->geometry();
r.moveTo(r.x() / screen->devicePixelRatio(),
r.y() / screen->devicePixelRatio());
#if defined(Q_OS_WIN)
r.moveTo(r.topLeft() - topLeft);
#endif
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
// MacOS works just with one active display, so we need to append
// just one current display and keep multiple displays logic for
// other OS
if (r.contains(currentPos)) {
// all calculations are processed according to (0, 0) start
// point so we need to move current object to (0, 0)
r.moveTo(0, 0);
areas.append(r);
break;
}
#else
r.moveTo(r.topLeft() - topLeftOffset);
areas.append(r);
#endif
}
#endif
} else {
areas.append(rect());
}
@@ -340,16 +333,16 @@ void CaptureWidget::paintEvent(QPaintEvent*)
painter.setClipRect(rect());
if (m_showInitialMsg) {
#if (defined(Q_OS_LINUX) && QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
QRect helpRect = QGuiApplication::primaryScreen()->geometry();
#else
#if defined(Q_OS_MACOS)
QRect helpRect;
QScreen* currentScreen = QGuiApplication::screenAt(QCursor::pos());
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
if (currentScreen) {
helpRect = currentScreen->geometry();
} else {
helpRect = QGuiApplication::primaryScreen()->geometry();
}
#else
QRect helpRect = QGuiApplication::primaryScreen()->geometry();
#endif
helpRect.moveTo(mapFromGlobal(helpRect.topLeft()));
@@ -473,7 +466,6 @@ void CaptureWidget::mouseMoveEvent(QMouseEvent* e)
QPoint newTopLeft =
initialRect.topLeft() + (e->pos() - m_dragStartPoint);
inputRect = QRect(newTopLeft, initialRect.size());
} else {
// Dragging a handle
inputRect = m_selection->savedGeometry();
@@ -730,7 +722,8 @@ void CaptureWidget::initPanel()
panelRect.moveTo(panelRect.x() / devicePixelRatio,
panelRect.y() / devicePixelRatio);
#else
QScreen* currentScreen = QGuiApplication::screenAt(QCursor::pos());
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
if (currentScreen) {
panelRect = currentScreen->geometry();
auto devicePixelRatio = currentScreen->devicePixelRatio();
@@ -769,9 +762,8 @@ void CaptureWidget::initPanel()
m_panel = new UtilityPanel(this);
m_panel->hide();
makeChild(m_panel);
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
QScreen* currentScreen = QGuiApplication::screenAt(QCursor::pos());
#if defined(Q_OS_MACOS)
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
panelRect.moveTo(mapFromGlobal(panelRect.topLeft()));
m_panel->setFixedWidth(m_colorPicker->width() * 1.5);
m_panel->setFixedHeight(currentScreen->geometry().height());
@@ -809,24 +801,31 @@ void CaptureWidget::initPanel()
void CaptureWidget::showAppUpdateNotification(const QString& appLatestVersion,
const QString& appLatestUrl)
{
if (!ConfigHandler().checkForUpdates()) {
// option check for updates disabled
return;
}
if (nullptr == m_updateNotificationWidget) {
m_updateNotificationWidget =
new UpdateNotificationWidget(this, appLatestVersion, appLatestUrl);
}
#if (defined(Q_OS_LINUX) && QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
#if defined(Q_OS_MACOS)
int ax = (width() - m_updateNotificationWidget->width()) / 2;
#elif (defined(Q_OS_LINUX) && QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
QRect helpRect = QGuiApplication::primaryScreen()->geometry();
int ax = helpRect.left() +
((helpRect.width() - m_updateNotificationWidget->width()) / 2);
#else
QRect helpRect;
QScreen* currentScreen = QGuiApplication::screenAt(QCursor::pos());
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
if (currentScreen) {
helpRect = currentScreen->geometry();
} else {
helpRect = QGuiApplication::primaryScreen()->geometry();
}
#endif
int ax = helpRect.left() +
((helpRect.width() - m_updateNotificationWidget->width()) / 2);
#endif
m_updateNotificationWidget->move(ax, 0);
makeChild(m_updateNotificationWidget);
m_updateNotificationWidget->show();
@@ -1235,8 +1234,7 @@ void CaptureWidget::copyScreenshot()
void CaptureWidget::saveScreenshot()
{
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
showNormal();
#endif
m_captureDone = true;

View File

@@ -60,8 +60,7 @@ CaptureLauncher::CaptureLauncher(QDialog* parent)
m_captureType->insertItem(
1, tr("Rectangular Region"), CaptureRequest::GRAPHICAL_MODE);
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if defined(Q_OS_MACOS)
// Following to MacOS philosophy (one application cannot be displayed on
// more than one display)
m_captureType->insertItem(

View File

@@ -1,4 +1,5 @@
#include "historywidget.h"
#include "src/utils/confighandler.h"
#include "src/utils/history.h"
#include "src/widgets/notificationwidget.h"
#include <QApplication>
@@ -10,10 +11,10 @@
#include <QIcon>
#include <QLabel>
#include <QLayoutItem>
#include <QMessageBox>
#include <QPixmap>
#include <QPushButton>
#include <QScrollArea>
#include <QSettings>
#include <QUrl>
#include <QVBoxLayout>
@@ -95,7 +96,7 @@ void HistoryWidget::addLine(const QString& path, const QString& fileName)
History history;
HISTORY_FILE_NAME unpackFileName = history.unpackFileName(fileName);
QString url;
QString url = "https://imgur.com/" + unpackFileName.file;
// load pixmap
QPixmap pixmap;
@@ -152,6 +153,16 @@ void HistoryWidget::addLine(const QString& path, const QString& fileName)
buttonDelete->setIcon(QIcon(":/img/material/black/delete.svg"));
buttonDelete->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT);
connect(buttonDelete, &QPushButton::clicked, this, [=]() {
if (ConfigHandler().historyConfirmationToDelete() &&
QMessageBox::No ==
QMessageBox::question(
this,
tr("Confirm to delete"),
tr("Are you sure you want to delete a screenshot from the "
"latest uploads and server?"),
QMessageBox::Yes | QMessageBox::No)) {
return;
}
QDesktopServices::openUrl(
QUrl(QStringLiteral("https://imgur.com/delete/%1")
.arg(unpackFileName.token)));

View File

@@ -16,6 +16,7 @@
// along with Flameshot. If not, see <http://www.gnu.org/licenses/>.
#include "infowindow.h"
#include "src/core/qguiappcurrentscreen.h"
#include <QHeaderView>
#include <QIcon>
#include <QKeyEvent>
@@ -23,8 +24,6 @@
#include <QVBoxLayout>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
#include <QCursor>
#include <QGuiApplication>
#include <QRect>
#include <QScreen>
#endif
@@ -40,7 +39,7 @@ InfoWindow::InfoWindow(QWidget* parent)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
QRect position = frameGeometry();
QScreen* screen = QGuiApplication::screenAt(QCursor::pos());
QScreen* screen = QGuiAppCurrentScreen().currentScreen();
position.moveCenter(screen->availableGeometry().center());
move(position.topLeft());
#endif

View File

@@ -16,6 +16,7 @@
// along with Flameshot. If not, see <http://www.gnu.org/licenses/>.
#include "sidepanelwidget.h"
#include "src/core/qguiappcurrentscreen.h"
#include "src/utils/colorutils.h"
#include "src/utils/pathinfo.h"
#include <QFormLayout>
@@ -24,6 +25,9 @@
#include <QPushButton>
#include <QSlider>
#include <QVBoxLayout>
#if defined(Q_OS_MACOS)
#include <QScreen>
#endif
class QColorPickingEventFilter : public QObject
{
@@ -161,7 +165,19 @@ QColor SidePanelWidget::grabPixmapColor(const QPoint& p)
{
QColor c;
if (m_pixmap) {
#if defined(Q_OS_MACOS)
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
QPoint point = p;
if (currentScreen) {
point = QPoint((p.x() - currentScreen->geometry().x()) *
currentScreen->devicePixelRatio(),
(p.y() - currentScreen->geometry().y()) *
currentScreen->devicePixelRatio());
}
QPixmap pixel = m_pixmap->copy(QRect(point, point));
#else
QPixmap pixel = m_pixmap->copy(QRect(p, p));
#endif
c = pixel.toImage().pixel(0, 0);
}
return c;

View File

@@ -43,8 +43,7 @@ UtilityPanel::UtilityPanel(QWidget* parent)
m_internalPanel,
&QWidget::hide);
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_MAC64) || \
defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_WIN) || defined(Q_OS_MACOS))
move(0, 0);
#endif
}
@@ -86,8 +85,7 @@ void UtilityPanel::show()
m_showAnimation->setEndValue(QRect(0, 0, width(), height()));
m_internalPanel->show();
m_showAnimation->start();
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_MAC64) || \
defined(Q_OS_MACOS) || defined(Q_OS_MACX))
#if (defined(Q_OS_WIN) || defined(Q_OS_MACOS))
move(0, 0);
#endif
QWidget::show();