display more readable strings in custom skin colors
This commit is contained in:
parent
efe3c3f8db
commit
a03df018bb
@ -243,8 +243,14 @@ void SettingsGui::loadSettings() {
|
|||||||
lay->addWidget(clr_btn);
|
lay->addWidget(clr_btn);
|
||||||
lay->addWidget(rst_btn);
|
lay->addWidget(rst_btn);
|
||||||
|
|
||||||
m_ui->m_layoutCustomColors->setWidget(row, QFormLayout::ItemRole::LabelRole, new QLabel(enumer.key(i), this));
|
m_ui->m_layoutCustomColors->setWidget(row,
|
||||||
m_ui->m_layoutCustomColors->setLayout(row, QFormLayout::ItemRole::FieldRole, lay);
|
QFormLayout::ItemRole::LabelRole,
|
||||||
|
new QLabel(
|
||||||
|
TextFactory::capitalizeFirstLetter(SkinEnums::palleteColorText(SkinEnums::PaletteColors(enumer.value(i)))),
|
||||||
|
this));
|
||||||
|
m_ui->m_layoutCustomColors->setLayout(row,
|
||||||
|
QFormLayout::ItemRole::FieldRole,
|
||||||
|
lay);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,3 +348,25 @@ QVariant Skin::colorForModel(SkinEnums::PaletteColors type, bool ignore_custom_c
|
|||||||
? m_colorPalette[type]
|
? m_colorPalette[type]
|
||||||
: QVariant();
|
: QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString SkinEnums::palleteColorText(PaletteColors col) {
|
||||||
|
switch (col) {
|
||||||
|
case SkinEnums::PaletteColors::FgInteresting:
|
||||||
|
return QObject::tr("interesting stuff");
|
||||||
|
|
||||||
|
case SkinEnums::PaletteColors::FgSelectedInteresting:
|
||||||
|
return QObject::tr("interesting stuff (highlighted)");;
|
||||||
|
|
||||||
|
case SkinEnums::PaletteColors::FgError:
|
||||||
|
return QObject::tr("errored items");
|
||||||
|
|
||||||
|
case SkinEnums::PaletteColors::FgSelectedError:
|
||||||
|
return QObject::tr("errored items (highlighted)");
|
||||||
|
|
||||||
|
case SkinEnums::PaletteColors::Allright:
|
||||||
|
return QObject::tr("OK-ish color");
|
||||||
|
|
||||||
|
default:
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -32,6 +32,8 @@ class SkinEnums : public QObject {
|
|||||||
Allright = 16
|
Allright = 16
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static QString palleteColorText(PaletteColors col);
|
||||||
|
|
||||||
Q_ENUM(PaletteColors)
|
Q_ENUM(PaletteColors)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -151,6 +151,15 @@ QString TextFactory::newline() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString TextFactory::capitalizeFirstLetter(const QString& sts) {
|
||||||
|
if (sts.isEmpty()) {
|
||||||
|
return sts;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return sts[0].toUpper() + sts.mid(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString TextFactory::shorten(const QString& input, int text_length_limit) {
|
QString TextFactory::shorten(const QString& input, int text_length_limit) {
|
||||||
if (input.size() > text_length_limit) {
|
if (input.size() > text_length_limit) {
|
||||||
return input.left(text_length_limit - ELLIPSIS_LENGTH) + QString(ELLIPSIS_LENGTH, QL1C('.'));
|
return input.left(text_length_limit - ELLIPSIS_LENGTH) + QString(ELLIPSIS_LENGTH, QL1C('.'));
|
||||||
|
@ -31,6 +31,7 @@ class TextFactory {
|
|||||||
static QString encrypt(const QString& text, quint64 key = 0);
|
static QString encrypt(const QString& text, quint64 key = 0);
|
||||||
static QString decrypt(const QString& text, quint64 key = 0);
|
static QString decrypt(const QString& text, quint64 key = 0);
|
||||||
static QString newline();
|
static QString newline();
|
||||||
|
static QString capitalizeFirstLetter(const QString& sts);
|
||||||
|
|
||||||
// Shortens input string according to given length limit.
|
// Shortens input string according to given length limit.
|
||||||
static QString shorten(const QString& input, int text_length_limit = TEXT_TITLE_LIMIT);
|
static QString shorten(const QString& input, int text_length_limit = TEXT_TITLE_LIMIT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user