Improve color picker for icons
* Add note about Drag & Drop * Allow picking from multiple presets
This commit is contained in:
parent
0369a43b49
commit
05e49c86ce
|
@ -10,7 +10,7 @@ set(META_APP_CATEGORIES "Network;FileTransfer")
|
|||
set(META_GUI_OPTIONAL false)
|
||||
set(META_VERSION_MAJOR 0)
|
||||
set(META_VERSION_MINOR 10)
|
||||
set(META_VERSION_PATCH 3)
|
||||
set(META_VERSION_PATCH 4)
|
||||
set(META_VERSION_EXACT_SONAME ON)
|
||||
set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON)
|
||||
|
||||
|
|
|
@ -187,6 +187,30 @@ StatusIconSettings::StatusIconSettings()
|
|||
{
|
||||
}
|
||||
|
||||
StatusIconSettings::StatusIconSettings(StatusIconSettings::DarkTheme)
|
||||
: defaultColor({ QStringLiteral("#00000000"), QStringLiteral("#00000000"), QStringLiteral("#FFFFFFFF") })
|
||||
, errorColor({ QStringLiteral("#00000000"), QStringLiteral("#00000000"), QStringLiteral("#FFFFAEA5") })
|
||||
, warningColor({ QStringLiteral("#00FFFFFF"), QStringLiteral("#00FFFFFF"), QStringLiteral("#FFFFF6A5") })
|
||||
, idleColor({ QStringLiteral("#00FFFFFF"), QStringLiteral("#00FFFFFF"), QStringLiteral("#FFFFFFFF") })
|
||||
, scanningColor({ QStringLiteral("#00FFFFFF"), QStringLiteral("#00FFFFFF"), QStringLiteral("#FFA5EFFF") })
|
||||
, synchronizingColor({ QStringLiteral("#00FFFFFF"), QStringLiteral("#00FFFFFF"), QStringLiteral("#FFA5EFFF") })
|
||||
, pausedColor({ QStringLiteral("#00000000"), QStringLiteral("#00FFFFFF"), QStringLiteral("#FFA7A7A7") })
|
||||
, disconnectedColor({ QStringLiteral("#00000000"), QStringLiteral("#00000000"), QStringLiteral("#FFA7A7A7") })
|
||||
{
|
||||
}
|
||||
|
||||
StatusIconSettings::StatusIconSettings(StatusIconSettings::BrightTheme)
|
||||
: defaultColor({ QStringLiteral("#00FFFFFF"), QStringLiteral("#00FFFFFF"), QStringLiteral("#FF000000") })
|
||||
, errorColor({ QStringLiteral("#00FFFFFF"), QStringLiteral("#00FFFFFF"), QStringLiteral("#FFDB3C26") })
|
||||
, warningColor({ QStringLiteral("#00000000"), QStringLiteral("#00000000"), QStringLiteral("#FFC9CE3B") })
|
||||
, idleColor({ QStringLiteral("#00000000"), QStringLiteral("#00000000"), QStringLiteral("#FF000000") })
|
||||
, scanningColor({ QStringLiteral("#00000000"), QStringLiteral("#00000000"), QStringLiteral("#FF26B6DB") })
|
||||
, synchronizingColor({ QStringLiteral("#00000000"), QStringLiteral("#00000000"), QStringLiteral("#FF26B6DB") })
|
||||
, pausedColor({ QStringLiteral("#00FFFFFF"), QStringLiteral("#00FFFFFF"), QStringLiteral("#FFA7A7A7") })
|
||||
, disconnectedColor({ QStringLiteral("#00FFFFFF"), QStringLiteral("#00FFFFFF"), QStringLiteral("#FFA7A7A7") })
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<StatusIconSettings::ColorMapping> StatusIconSettings::colorMapping()
|
||||
{
|
||||
return std::vector<ColorMapping>({
|
||||
|
|
|
@ -61,7 +61,14 @@ QPixmap LIB_SYNCTHING_MODEL_EXPORT renderSvgImage(const QByteArray &contents, co
|
|||
QByteArray LIB_SYNCTHING_MODEL_EXPORT loadFontAwesomeIcon(const QString &iconName, const QColor &color, bool solid = true);
|
||||
|
||||
struct LIB_SYNCTHING_MODEL_EXPORT StatusIconSettings {
|
||||
struct DarkTheme {
|
||||
};
|
||||
struct BrightTheme {
|
||||
};
|
||||
|
||||
explicit StatusIconSettings();
|
||||
explicit StatusIconSettings(DarkTheme);
|
||||
explicit StatusIconSettings(BrightTheme);
|
||||
explicit StatusIconSettings(const QString &str);
|
||||
|
||||
StatusIconColorSet defaultColor;
|
||||
|
|
|
@ -53,6 +53,7 @@ set(TS_FILES translations/${META_PROJECT_NAME}_cs_CZ.ts translations/${META_PROJ
|
|||
translations/${META_PROJECT_NAME}_en_US.ts)
|
||||
|
||||
set(REQUIRED_ICONS
|
||||
color-profile
|
||||
preferences-other
|
||||
process-stop
|
||||
list-add
|
||||
|
|
|
@ -16,6 +16,13 @@
|
|||
<item>
|
||||
<widget class="QCheckBox" name="contextCheckBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="dragAndDropInfoLabel">
|
||||
<property name="text">
|
||||
<string>Use Drag & Drop to re-use a selected color at a different position.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="statusIconsGroupBox">
|
||||
<property name="title">
|
||||
|
@ -105,11 +112,10 @@
|
|||
<item>
|
||||
<widget class="QPushButton" name="restoreDefaultsPushButton">
|
||||
<property name="text">
|
||||
<string>Restore defaults</string>
|
||||
<string>Use preset</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="edit-undo">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
<iconset theme="color-profile"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#endif
|
||||
#include <QApplication>
|
||||
#include <QFontDatabase>
|
||||
#include <QMenu>
|
||||
#include <QStringBuilder>
|
||||
#include <QStyle>
|
||||
#include <QTextBlock>
|
||||
|
@ -588,11 +589,25 @@ QWidget *IconsOptionPage::setupWidget()
|
|||
}
|
||||
}
|
||||
|
||||
// setup additional buttons
|
||||
QObject::connect(ui()->restoreDefaultsPushButton, &QPushButton::clicked, [this] {
|
||||
// setup presets menu
|
||||
auto *const presetsMenu = new QMenu(widget);
|
||||
presetsMenu->addAction(QCoreApplication::translate("QtGui::IconsOptionPageBase", "Colorful background with gradient (default)"), [this] {
|
||||
m_settings = Data::StatusIconSettings();
|
||||
update();
|
||||
});
|
||||
presetsMenu->addAction(
|
||||
QCoreApplication::translate("QtGui::IconsOptionPageBase", "Transparent background and dark foreground (for bright themes)"), [this] {
|
||||
m_settings = Data::StatusIconSettings(Data::StatusIconSettings::BrightTheme{});
|
||||
update();
|
||||
});
|
||||
presetsMenu->addAction(
|
||||
QCoreApplication::translate("QtGui::IconsOptionPageBase", "Transparent background and bright foreground (for dark themes)"), [this] {
|
||||
m_settings = Data::StatusIconSettings(Data::StatusIconSettings::DarkTheme{});
|
||||
update();
|
||||
});
|
||||
|
||||
// setup additional buttons
|
||||
ui()->restoreDefaultsPushButton->setMenu(presetsMenu);
|
||||
QObject::connect(ui()->restorePreviousPushButton, &QPushButton::clicked, [this] { reset(); });
|
||||
|
||||
return widget;
|
||||
|
|
Loading…
Reference in New Issue