diff --git a/.github/workflows/MacOS-pack.yml b/.github/workflows/MacOS-pack.yml index 0ae8e523..228b88d0 100644 --- a/.github/workflows/MacOS-pack.yml +++ b/.github/workflows/MacOS-pack.yml @@ -55,7 +55,7 @@ jobs: mkdir -p "${DIR_BULD}" cd "${DIR_BULD}" rm -rf ./src/flameshot.dmg ./src/flameshot.app/ - cmake .. -DQt5_DIR=$(brew --prefix qt5)/lib/cmake/Qt5 + cmake .. -DQt5_DIR=$(brew --prefix qt5)/lib/cmake/Qt5 -DUSE_MONOCHROME_ICON=True - name: Compile run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 22566839..dc36ade8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,7 @@ set(RUN_IN_PLACE option(FLAMESHOT_DEBUG_CAPTURE "Enable mode to make debugging easier" OFF) +option(USE_MONOCHROME_ICON "Build using monochrome icon as default" OFF) option(GENERATE_TS "Regenerate translation source files" OFF) option(USE_EXTERNAL_SINGLEAPPLICATION "Use external QtSingleApplication library" OFF) option(USE_EXTERNAL_SPDLOG "Use external spdlog library" OFF) diff --git a/data/graphics.qrc b/data/graphics.qrc index 98b25a73..565cab9c 100644 --- a/data/graphics.qrc +++ b/data/graphics.qrc @@ -4,6 +4,8 @@ img/app/flameshot.svg img/app/org.flameshot.Flameshot.png img/app/flameshot.png + img/app/flameshot.monochrome.png + img/app/flameshot.monochrome.svg img/app/keyboard.svg img/material/black/accept.svg img/material/black/arrow-bottom-left.svg diff --git a/data/img/app/flameshot.monochrome-1024.png b/data/img/app/flameshot.monochrome-1024.png new file mode 100644 index 00000000..fcff07c1 Binary files /dev/null and b/data/img/app/flameshot.monochrome-1024.png differ diff --git a/data/img/app/flameshot.monochrome.png b/data/img/app/flameshot.monochrome.png new file mode 100644 index 00000000..beffefeb Binary files /dev/null and b/data/img/app/flameshot.monochrome.png differ diff --git a/data/img/app/flameshot.monochrome.svg b/data/img/app/flameshot.monochrome.svg new file mode 100644 index 00000000..1b7f2256 --- /dev/null +++ b/data/img/app/flameshot.monochrome.svg @@ -0,0 +1,49 @@ + + + + + + + + diff --git a/packaging/macos/Info.plist b/packaging/macos/Info.plist index 887f22b2..1ae6106a 100644 --- a/packaging/macos/Info.plist +++ b/packaging/macos/Info.plist @@ -7,7 +7,7 @@ CFBundleIconFile flameshot CFBundleIdentifier - com.lupodharkael.flameshot + com.Flameshot.flameshot CFBundlePackageType APPL CFBundleSignature diff --git a/packaging/macos/flameshot.icns b/packaging/macos/flameshot.icns index 27a94ff3..b8db080f 100644 Binary files a/packaging/macos/flameshot.icns and b/packaging/macos/flameshot.icns differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 42af5931..f9b76777 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,18 +21,20 @@ if (APPLE) COMMAND bash "-c" "mkdir -p flameshot.iconset" ) execute_process( - COMMAND bash "-c" "sips -z 16 16 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.png --out flameshot.iconset/icon_16x16.png" - COMMAND bash "-c" "sips -z 32 32 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.png --out flameshot.iconset/icon_16x16@2x.png" - COMMAND bash "-c" "sips -z 32 32 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.png --out flameshot.iconset/icon_32x32.png" - COMMAND bash "-c" "sips -z 64 64 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.png --out flameshot.iconset/icon_32x32@2x.png" - COMMAND bash "-c" "sips -z 64 64 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.png --out flameshot.iconset/icon_64x64x.png" - COMMAND bash "-c" "sips -z 128 128 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.png --out flameshot.iconset/icon_64x64@2.png" - COMMAND bash "-c" "sips -z 128 128 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.png --out flameshot.iconset/icon_128x128.png" - COMMAND bash "-c" "sips -z 256 256 \"${CMAKE_SOURCE_DIR}\"/data/img/app/org.flameshot.Flameshot-1024.png --out flameshot.iconset/icon_128x128@2x.png" - COMMAND bash "-c" "sips -z 256 256 \"${CMAKE_SOURCE_DIR}\"/data/img/app/org.flameshot.Flameshot-1024.png --out flameshot.iconset/icon_256x256.png" - COMMAND bash "-c" "sips -z 512 512 \"${CMAKE_SOURCE_DIR}\"/data/img/app/org.flameshot.Flameshot-1024.png --out flameshot.iconset/icon_256x256@2x.png" - COMMAND bash "-c" "sips -z 512 512 \"${CMAKE_SOURCE_DIR}\"/data/img/app/org.flameshot.Flameshot-1024.png --out flameshot.iconset/icon_512x512.png" - COMMAND bash "-c" "sips -z 1024 1024 \"${CMAKE_SOURCE_DIR}\"/data/img/app/org.flameshot.Flameshot-1024.png --out flameshot.iconset/icon_512x512@2x.png" + COMMAND bash "-c" "sips -z 16 16 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.monochrome.png --out flameshot.iconset/icon_16x16.png" + COMMAND bash "-c" "sips -z 32 32 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.monochrome.png --out flameshot.iconset/icon_16x16@2x.png" + COMMAND bash "-c" "sips -z 32 32 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.monochrome.png --out flameshot.iconset/icon_32x32.png" + COMMAND bash "-c" "sips -z 64 64 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.monochrome.png --out flameshot.iconset/icon_32x32@2x.png" + COMMAND bash "-c" "sips -z 64 64 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.monochrome.png --out flameshot.iconset/icon_64x64x.png" + COMMAND bash "-c" "sips -z 128 128 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.monochrome.png --out flameshot.iconset/icon_64x64@2.png" + COMMAND bash "-c" "sips -z 128 128 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.monochrome-1024.png --out flameshot.iconset/icon_128x128.png" + COMMAND bash "-c" "sips -z 256 256 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.monochrome-1024.png --out flameshot.iconset/icon_128x128@2x.png" + COMMAND bash "-c" "sips -z 256 256 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.monochrome-1024.png --out flameshot.iconset/icon_256x256.png" + COMMAND bash "-c" "sips -z 512 512 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.monochrome-1024.png --out flameshot.iconset/icon_256x256@2x.png" + COMMAND bash "-c" "sips -z 512 512 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.monochrome-1024.png --out flameshot.iconset/icon_512x512.png" + COMMAND bash "-c" "sips -z 1024 1024 \"${CMAKE_SOURCE_DIR}\"/data/img/app/flameshot.monochrome-1024.png --out flameshot.iconset/icon_512x512@2x.png" + + COMMAND bash "-c" "iconutil -c icns flameshot.iconset" ) @@ -233,6 +235,10 @@ if (FLAMESHOT_DEBUG_CAPTURE) target_compile_definitions(flameshot PRIVATE FLAMESHOT_DEBUG_CAPTURE) endif () +if (USE_MONOCHROME_ICON) + target_compile_definitions(flameshot PRIVATE USE_MONOCHROME_ICON) +endif () + foreach (FILE ${QM_FILES}) get_filename_component(F_NAME ${FILE} NAME) add_custom_command( diff --git a/src/config/configwindow.cpp b/src/config/configwindow.cpp index c23dcadc..de93b081 100644 --- a/src/config/configwindow.cpp +++ b/src/config/configwindow.cpp @@ -36,7 +36,7 @@ ConfigWindow::ConfigWindow(QWidget* parent) layout->addWidget(m_tabWidget); setAttribute(Qt::WA_DeleteOnClose); - setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowIcon(QIcon(GlobalValues::iconPath())); setWindowTitle(tr("Configuration")); connect(ConfigHandler::getInstance(), diff --git a/src/config/setshortcutwidget.cpp b/src/config/setshortcutwidget.cpp index fcd5efcb..82704600 100644 --- a/src/config/setshortcutwidget.cpp +++ b/src/config/setshortcutwidget.cpp @@ -2,6 +2,7 @@ // SPDX-FileCopyrightText: 2020 Yurii Puchkov at Namecheap & Contributors #include "setshortcutwidget.h" +#include "src/utils/globalvalues.h" #include #include #include @@ -12,7 +13,7 @@ SetShortcutDialog::SetShortcutDialog(QDialog* parent) : QDialog(parent) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowIcon(QIcon(GlobalValues::iconPath())); setWindowTitle(tr("Set Shortcut")); m_ks = QKeySequence(); diff --git a/src/config/shortcutswidget.cpp b/src/config/shortcutswidget.cpp index 99171788..8aa5477a 100644 --- a/src/config/shortcutswidget.cpp +++ b/src/config/shortcutswidget.cpp @@ -5,6 +5,7 @@ #include "capturetool.h" #include "setshortcutwidget.h" #include "src/core/qguiappcurrentscreen.h" +#include "src/utils/globalvalues.h" #include "toolfactory.h" #include #include @@ -25,7 +26,7 @@ ShortcutsWidget::ShortcutsWidget(QWidget* parent) : QWidget(parent) { setAttribute(Qt::WA_DeleteOnClose); - setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowIcon(QIcon(GlobalValues::iconPath())); setWindowTitle(tr("Hot Keys")); #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 3433ba01..c36dd378 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -10,6 +10,7 @@ #include "src/config/configwindow.h" #include "src/core/qguiappcurrentscreen.h" #include "src/utils/confighandler.h" +#include "src/utils/globalvalues.h" #include "src/utils/history.h" #include "src/utils/screengrabber.h" #include "src/utils/systemnotification.h" @@ -465,7 +466,7 @@ void Controller::enableTrayIcon() m_trayIcon->setContextMenu(m_trayIconMenu); #endif QIcon trayIcon = - QIcon::fromTheme("flameshot-tray", QIcon(":img/app/flameshot.png")); + QIcon::fromTheme("flameshot-tray", QIcon(GlobalValues::iconPathPNG())); m_trayIcon->setIcon(trayIcon); #if defined(Q_OS_MACOS) @@ -527,7 +528,7 @@ void Controller::sendTrayNotification(const QString& text, { if (m_trayIcon) { m_trayIcon->showMessage( - title, text, QIcon(":img/app/flameshot.svg"), timeout); + title, text, QIcon(GlobalValues::iconPath()), timeout); } } diff --git a/src/tools/imgur/imguruploader.cpp b/src/tools/imgur/imguruploader.cpp index 0b9bac00..9a222254 100644 --- a/src/tools/imgur/imguruploader.cpp +++ b/src/tools/imgur/imguruploader.cpp @@ -4,6 +4,7 @@ #include "imguruploader.h" #include "src/utils/confighandler.h" #include "src/utils/filenamehandler.h" +#include "src/utils/globalvalues.h" #include "src/utils/history.h" #include "src/utils/systemnotification.h" #include "src/widgets/imagelabel.h" @@ -37,7 +38,7 @@ ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent) , m_pixmap(capture) { setWindowTitle(tr("Upload to Imgur")); - setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowIcon(QIcon(GlobalValues::iconPath())); #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) QRect position = frameGeometry(); diff --git a/src/tools/launcher/applauncherwidget.cpp b/src/tools/launcher/applauncherwidget.cpp index 14443adc..0569ef85 100644 --- a/src/tools/launcher/applauncherwidget.cpp +++ b/src/tools/launcher/applauncherwidget.cpp @@ -39,7 +39,7 @@ AppLauncherWidget::AppLauncherWidget(const QPixmap& p, QWidget* parent) , m_pixmap(p) { setAttribute(Qt::WA_DeleteOnClose); - setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowIcon(QIcon(GlobalValues::iconPath())); setWindowTitle(tr("Open With")); m_keepOpen = ConfigHandler().keepOpenAppLauncher(); diff --git a/src/tools/pin/pinwidget.cpp b/src/tools/pin/pinwidget.cpp index c2d104aa..7d6e9499 100644 --- a/src/tools/pin/pinwidget.cpp +++ b/src/tools/pin/pinwidget.cpp @@ -4,6 +4,7 @@ #include "pinwidget.h" #include "qguiappcurrentscreen.h" #include "src/utils/confighandler.h" +#include "src/utils/globalvalues.h" #include #include #include @@ -17,7 +18,7 @@ PinWidget::PinWidget(const QPixmap& pixmap, : QWidget(parent) , m_pixmap(pixmap) { - setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowIcon(QIcon(GlobalValues::iconPath())); setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint); // set the bottom widget background transparent setAttribute(Qt::WA_TranslucentBackground); diff --git a/src/utils/globalvalues.cpp b/src/utils/globalvalues.cpp index 6aee2188..0556ae48 100644 --- a/src/utils/globalvalues.cpp +++ b/src/utils/globalvalues.cpp @@ -15,3 +15,21 @@ QString GlobalValues::versionInfo() return QStringLiteral("Flameshot " APP_VERSION " (" FLAMESHOT_GIT_HASH ")" "\nCompiled with Qt " QT_VERSION_STR); } + +QString GlobalValues::iconPath() +{ +#if USE_MONOCHROME_ICON + return QString(":img/app/flameshot.monochrome.svg"); +#else + return QString(":img/app/flameshot.svg"); +#endif +} + +QString GlobalValues::iconPathPNG() +{ +#if USE_MONOCHROME_ICON + return QString(":img/app/flameshot.monochrome.png"); +#else + return QString(":img/app/flameshot.png"); +#endif +} \ No newline at end of file diff --git a/src/utils/globalvalues.h b/src/utils/globalvalues.h index c51b5555..4683753e 100644 --- a/src/utils/globalvalues.h +++ b/src/utils/globalvalues.h @@ -9,5 +9,6 @@ namespace GlobalValues { int buttonBaseSize(); QString versionInfo(); - +QString iconPath(); +QString iconPathPNG(); } diff --git a/src/utils/screenshotsaver.cpp b/src/utils/screenshotsaver.cpp index 2777eed8..02b488ba 100644 --- a/src/utils/screenshotsaver.cpp +++ b/src/utils/screenshotsaver.cpp @@ -5,6 +5,7 @@ #include "src/core/controller.h" #include "src/utils/confighandler.h" #include "src/utils/filenamehandler.h" +#include "src/utils/globalvalues.h" #include "src/utils/systemnotification.h" #include "utils/desktopinfo.h" #include @@ -216,7 +217,7 @@ bool ScreenshotSaver::saveToFilesystemGUI(const QPixmap& capture) QMessageBox saveErrBox( QMessageBox::Warning, QObject::tr("Save Error"), msg); - saveErrBox.setWindowIcon(QIcon(":img/app/flameshot.svg")); + saveErrBox.setWindowIcon(QIcon(GlobalValues::iconPath())); saveErrBox.exec(); } diff --git a/src/widgets/capturelauncher.cpp b/src/widgets/capturelauncher.cpp index b2fb3c7a..67ed3619 100644 --- a/src/widgets/capturelauncher.cpp +++ b/src/widgets/capturelauncher.cpp @@ -3,6 +3,7 @@ #include "capturelauncher.h" #include "src/core/controller.h" +#include "src/utils/globalvalues.h" #include "src/utils/screengrabber.h" #include "src/utils/screenshotsaver.h" #include "src/widgets/imagelabel.h" @@ -23,7 +24,7 @@ CaptureLauncher::CaptureLauncher(QDialog* parent) , m_id(0) { setAttribute(Qt::WA_DeleteOnClose); - setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowIcon(QIcon(GlobalValues::iconPath())); m_imageLabel = new ImageLabel(this); bool ok; m_imageLabel->setScreenshot(ScreenGrabber().grabEntireDesktop(ok)); diff --git a/src/widgets/historywidget.cpp b/src/widgets/historywidget.cpp index 68ad27ae..5240582d 100644 --- a/src/widgets/historywidget.cpp +++ b/src/widgets/historywidget.cpp @@ -1,5 +1,6 @@ #include "historywidget.h" #include "src/utils/confighandler.h" +#include "src/utils/globalvalues.h" #include "src/utils/history.h" #include "src/widgets/notificationwidget.h" #include @@ -17,11 +18,10 @@ #include #include #include - HistoryWidget::HistoryWidget(QWidget* parent) : QDialog(parent) { - setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowIcon(QIcon(GlobalValues::iconPath())); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowTitle(tr("Latest Uploads")); resize(QDesktopWidget().availableGeometry(this).size() * 0.5); diff --git a/src/widgets/imguruploaddialog.cpp b/src/widgets/imguruploaddialog.cpp index 29615f6e..1d76e228 100644 --- a/src/widgets/imguruploaddialog.cpp +++ b/src/widgets/imguruploaddialog.cpp @@ -3,6 +3,7 @@ #include "imguruploaddialog.h" #include "src/utils/confighandler.h" +#include "src/utils/globalvalues.h" #include #include #include @@ -13,7 +14,7 @@ ImgurUploadDialog::ImgurUploadDialog(QDialog* parent) { setAttribute(Qt::WA_DeleteOnClose); setMinimumSize(400, 120); - setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowIcon(QIcon(GlobalValues::iconPath())); setWindowTitle(tr("Upload Confirmation")); layout = new QVBoxLayout(this); diff --git a/src/widgets/infowindow.cpp b/src/widgets/infowindow.cpp index e1eb41ed..00a8916f 100644 --- a/src/widgets/infowindow.cpp +++ b/src/widgets/infowindow.cpp @@ -27,7 +27,7 @@ InfoWindow::InfoWindow(QWidget* parent) : QWidget(parent) { setAttribute(Qt::WA_DeleteOnClose); - setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowIcon(QIcon(GlobalValues::iconPath())); setWindowTitle(tr("About")); #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) @@ -46,7 +46,7 @@ InfoWindow::InfoWindow(QWidget* parent) void InfoWindow::initLabels() { auto* icon = new QLabel(); - icon->setPixmap(QPixmap(":img/app/flameshot.svg")); + icon->setPixmap(QPixmap(GlobalValues::iconPath())); icon->setAlignment(Qt::AlignHCenter); m_layout->addWidget(icon);