Add option for using large color palette on right button click (#2171)

(cherry picked from commit 403a6474e7e8afeb7920fe39c8312481c21d0d1b)

Co-authored-by: Yuriy Puchkov <yuriy.puchkov@namecheap.com>
This commit is contained in:
Yurii Puchkov
2021-12-21 16:27:13 +02:00
committed by GitHub
parent f0b21b7c4f
commit bd4fc0047a
6 changed files with 64 additions and 13 deletions

View File

@@ -33,8 +33,8 @@ if (APPLE)
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"
)
@@ -215,6 +215,15 @@ if (WIN32)
endif ()
endif ()
# Choose default color palette (small or large)
if($ENV{FLAMESHOT_PREDEFINED_COLOR_PALETTE_LARGE})
set(FLAMESHOT_PREDEFINED_COLOR_PALETTE_LARGE true)
else()
set(FLAMESHOT_PREDEFINED_COLOR_PALETTE_LARGE false)
endif()
message("Flameshot predefined color palette large: " ${FLAMESHOT_PREDEFINED_COLOR_PALETTE_LARGE})
target_compile_definitions(flameshot PRIVATE PREDEFINED_COLOR_PALETTE_LARGE=${FLAMESHOT_PREDEFINED_COLOR_PALETTE_LARGE})
find_package (Git)
if (GIT_FOUND)
message("git found: ${GIT_EXECUTABLE} in version ${GIT_VERSION_STRING}")
@@ -347,7 +356,7 @@ if (WIN32)
if (ENABLE_OPENSSL)
if (EXISTS ${OPENSSL_ROOT_DIR}/bin)
install(
install(
DIRECTORY ${OPENSSL_ROOT_DIR}/bin/
DESTINATION bin
FILES_MATCHING

View File

@@ -53,6 +53,7 @@ GeneralConf::GeneralConf(QWidget* parent)
#if !defined(Q_OS_WIN)
initAutoCloseIdleDaemon();
#endif
initPredefinedColorPaletteLarge();
m_layout->addStretch();
@@ -369,6 +370,20 @@ void GeneralConf::initShowStartupLaunchMessage()
});
}
void GeneralConf::initPredefinedColorPaletteLarge()
{
m_predefinedColorPaletteLarge =
new QCheckBox(tr("Use large predefined color palette"), this);
m_predefinedColorPaletteLarge->setToolTip(
tr("Use large predefined color palette"));
m_scrollAreaLayout->addWidget(m_predefinedColorPaletteLarge);
connect(
m_predefinedColorPaletteLarge, &QCheckBox::clicked, [](bool checked) {
ConfigHandler().setPredefinedColorPaletteLarge(checked);
});
}
void GeneralConf::initCopyAndCloseAfterUpload()
{
m_copyAndCloseAfterUpload =

View File

@@ -66,6 +66,7 @@ private:
void initAntialiasingPinZoom();
void initUseJpgForClipboard();
void initUploadWithoutConfirmation();
void initPredefinedColorPaletteLarge();
void _updateComponents(bool allowEmptySavePath);
@@ -98,4 +99,5 @@ private:
QSpinBox* m_uploadHistoryMax;
QSpinBox* m_undoLimit;
QComboBox* m_setSaveAsFileExtension;
QCheckBox* m_predefinedColorPaletteLarge;
};

View File

@@ -117,6 +117,8 @@ static QMap<class QString, QSharedPointer<ValueHandler>>
OPTION("ignoreUpdateToVersion" ,String ( "" )),
OPTION("keepOpenAppLauncher" ,Bool ( false )),
OPTION("fontFamily" ,String ( "" )),
// PREDEFINED_COLOR_PALETTE_LARGE is defined in src/CMakeList.txt file and can be overwritten in GitHub actions
OPTION("predefinedColorPaletteLarge", Bool ( PREDEFINED_COLOR_PALETTE_LARGE )),
// NOTE: If another tool size is added besides drawThickness and
// drawFontSize, remember to update ConfigHandler::toolSize
};

View File

@@ -68,6 +68,9 @@ public:
CONFIG_GETTER_SETTER(uiColor, setUiColor, QColor)
CONFIG_GETTER_SETTER(contrastUiColor, setContrastUiColor, QColor)
CONFIG_GETTER_SETTER(drawColor, setDrawColor, QColor)
CONFIG_GETTER_SETTER(predefinedColorPaletteLarge,
setPredefinedColorPaletteLarge,
bool)
CONFIG_GETTER_SETTER(fontFamily, setFontFamily, QString)
CONFIG_GETTER_SETTER(showHelp, setShowHelp, bool)
CONFIG_GETTER_SETTER(showSidePanelButton, setShowSidePanelButton, bool)

View File

@@ -417,16 +417,36 @@ QVariant UserColors::process(const QVariant& val)
QVariant UserColors::fallback()
{
return QVariant::fromValue(QVector<QColor>{ Qt::darkRed,
Qt::red,
Qt::yellow,
Qt::green,
Qt::darkGreen,
Qt::cyan,
Qt::blue,
Qt::magenta,
Qt::darkMagenta,
QColor() });
if (ConfigHandler().predefinedColorPaletteLarge()) {
return QVariant::fromValue(QVector<QColor>{ Qt::white,
Qt::red,
Qt::green,
Qt::blue,
Qt::black,
Qt::darkRed,
Qt::darkGreen,
Qt::darkBlue,
Qt::darkGray,
Qt::cyan,
Qt::magenta,
Qt::yellow,
Qt::lightGray,
Qt::darkCyan,
Qt::darkMagenta,
Qt::darkYellow,
QColor() });
} else {
return QVariant::fromValue(QVector<QColor>{ Qt::darkRed,
Qt::red,
Qt::yellow,
Qt::green,
Qt::darkGreen,
Qt::cyan,
Qt::blue,
Qt::magenta,
Qt::darkMagenta,
QColor() });
}
}
QString UserColors::expected()