Updated lib_ui sources to TDesktop version 2.2
This commit is contained in:
commit
6886246fc5
5 changed files with 123 additions and 4 deletions
|
|
@ -102,6 +102,7 @@ PRIVATE
|
||||||
ui/style/style_core_scale.h
|
ui/style/style_core_scale.h
|
||||||
ui/style/style_core_types.cpp
|
ui/style/style_core_types.cpp
|
||||||
ui/style/style_core_types.h
|
ui/style/style_core_types.h
|
||||||
|
ui/text/qtextitemint.cpp
|
||||||
ui/text/text.cpp
|
ui/text/text.cpp
|
||||||
ui/text/text.h
|
ui/text/text.h
|
||||||
ui/text/text_block.cpp
|
ui/text/text_block.cpp
|
||||||
|
|
|
||||||
|
|
@ -233,8 +233,8 @@ emojiReplaceHeight: 56px;
|
||||||
emojiReplaceInnerHeight: 42px;
|
emojiReplaceInnerHeight: 42px;
|
||||||
emojiReplacePadding: 14px;
|
emojiReplacePadding: 14px;
|
||||||
|
|
||||||
dragFont: font(28px semibold);
|
dragFont: font(27px semibold);
|
||||||
dragSubfont: font(20px semibold);
|
dragSubfont: font(19px semibold);
|
||||||
dragColor: windowSubTextFg;
|
dragColor: windowSubTextFg;
|
||||||
dragDropColor: windowActiveTextFg;
|
dragDropColor: windowActiveTextFg;
|
||||||
|
|
||||||
|
|
|
||||||
54
ui/text/qtextitemint.cpp
Normal file
54
ui/text/qtextitemint.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
// This file is part of Desktop App Toolkit,
|
||||||
|
// a set of libraries for developing nice desktop applications.
|
||||||
|
//
|
||||||
|
// For license and copyright information please follow this link:
|
||||||
|
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
//
|
||||||
|
#ifdef DESKTOP_APP_USE_PACKAGED
|
||||||
|
#include <private/qtextengine_p.h>
|
||||||
|
|
||||||
|
QTextItemInt::QTextItemInt(
|
||||||
|
const QGlyphLayout &g,
|
||||||
|
QFont *font,
|
||||||
|
const QChar *chars_,
|
||||||
|
int numChars,
|
||||||
|
QFontEngine *fe,
|
||||||
|
const QTextCharFormat &format)
|
||||||
|
: flags(0)
|
||||||
|
, justified(false)
|
||||||
|
, underlineStyle(QTextCharFormat::NoUnderline)
|
||||||
|
, charFormat(format)
|
||||||
|
, num_chars(numChars)
|
||||||
|
, chars(chars_)
|
||||||
|
, logClusters(0)
|
||||||
|
, f(font)
|
||||||
|
, glyphs(g)
|
||||||
|
, fontEngine(fe) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void QTextItemInt::initWithScriptItem(const QScriptItem &si) {
|
||||||
|
// explicitly initialize flags so that initFontAttributes can be called
|
||||||
|
// multiple times on the same TextItem
|
||||||
|
flags = 0;
|
||||||
|
if (si.analysis.bidiLevel %2)
|
||||||
|
flags |= QTextItem::RightToLeft;
|
||||||
|
ascent = si.ascent;
|
||||||
|
descent = si.descent;
|
||||||
|
|
||||||
|
if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
|
||||||
|
underlineStyle = charFormat.underlineStyle();
|
||||||
|
} else if (charFormat.boolProperty(QTextFormat::FontUnderline)
|
||||||
|
|| f->d->underline) {
|
||||||
|
underlineStyle = QTextCharFormat::SingleUnderline;
|
||||||
|
}
|
||||||
|
|
||||||
|
// compat
|
||||||
|
if (underlineStyle == QTextCharFormat::SingleUnderline)
|
||||||
|
flags |= QTextItem::Underline;
|
||||||
|
|
||||||
|
if (f->d->overline || charFormat.fontOverline())
|
||||||
|
flags |= QTextItem::Overline;
|
||||||
|
if (f->d->strikeOut || charFormat.fontStrikeOut())
|
||||||
|
flags |= QTextItem::StrikeOut;
|
||||||
|
}
|
||||||
|
#endif // !DESKTOP_APP_USE_PACKAGED
|
||||||
|
|
@ -394,7 +394,37 @@ Checkbox::Checkbox(
|
||||||
const style::Toggle &toggleSt)
|
const style::Toggle &toggleSt)
|
||||||
: Checkbox(
|
: Checkbox(
|
||||||
parent,
|
parent,
|
||||||
text,
|
rpl::single(text),
|
||||||
|
st,
|
||||||
|
std::make_unique<ToggleView>(
|
||||||
|
toggleSt,
|
||||||
|
checked)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
Checkbox::Checkbox(
|
||||||
|
QWidget *parent,
|
||||||
|
rpl::producer<QString> &&text,
|
||||||
|
bool checked,
|
||||||
|
const style::Checkbox &st,
|
||||||
|
const style::Check &checkSt)
|
||||||
|
: Checkbox(
|
||||||
|
parent,
|
||||||
|
std::move(text),
|
||||||
|
st,
|
||||||
|
std::make_unique<CheckView>(
|
||||||
|
checkSt,
|
||||||
|
checked)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
Checkbox::Checkbox(
|
||||||
|
QWidget *parent,
|
||||||
|
rpl::producer<QString> &&text,
|
||||||
|
bool checked,
|
||||||
|
const style::Checkbox &st,
|
||||||
|
const style::Toggle &toggleSt)
|
||||||
|
: Checkbox(
|
||||||
|
parent,
|
||||||
|
std::move(text),
|
||||||
st,
|
st,
|
||||||
std::make_unique<ToggleView>(
|
std::make_unique<ToggleView>(
|
||||||
toggleSt,
|
toggleSt,
|
||||||
|
|
@ -406,17 +436,34 @@ Checkbox::Checkbox(
|
||||||
const QString &text,
|
const QString &text,
|
||||||
const style::Checkbox &st,
|
const style::Checkbox &st,
|
||||||
std::unique_ptr<AbstractCheckView> check)
|
std::unique_ptr<AbstractCheckView> check)
|
||||||
|
: Checkbox(
|
||||||
|
parent,
|
||||||
|
rpl::single(text),
|
||||||
|
st,
|
||||||
|
std::move(check)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
Checkbox::Checkbox(
|
||||||
|
QWidget *parent,
|
||||||
|
rpl::producer<QString> &&text,
|
||||||
|
const style::Checkbox &st,
|
||||||
|
std::unique_ptr<AbstractCheckView> check)
|
||||||
: RippleButton(parent, st.ripple)
|
: RippleButton(parent, st.ripple)
|
||||||
, _st(st)
|
, _st(st)
|
||||||
, _check(std::move(check))
|
, _check(std::move(check))
|
||||||
, _text(
|
, _text(
|
||||||
_st.style,
|
_st.style,
|
||||||
text,
|
QString(),
|
||||||
_checkboxOptions,
|
_checkboxOptions,
|
||||||
countTextMinWidth()) {
|
countTextMinWidth()) {
|
||||||
_check->setUpdateCallback([=] { update(); });
|
_check->setUpdateCallback([=] { update(); });
|
||||||
resizeToText();
|
resizeToText();
|
||||||
setCursor(style::cur_pointer);
|
setCursor(style::cur_pointer);
|
||||||
|
std::move(
|
||||||
|
text
|
||||||
|
) | rpl::start_with_next([=](QString &&value) {
|
||||||
|
setText(std::move(value));
|
||||||
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
int Checkbox::countTextMinWidth() const {
|
int Checkbox::countTextMinWidth() const {
|
||||||
|
|
|
||||||
|
|
@ -146,11 +146,28 @@ public:
|
||||||
bool checked,
|
bool checked,
|
||||||
const style::Checkbox &st,
|
const style::Checkbox &st,
|
||||||
const style::Toggle &toggleSt);
|
const style::Toggle &toggleSt);
|
||||||
|
Checkbox(
|
||||||
|
QWidget *parent,
|
||||||
|
rpl::producer<QString> &&text,
|
||||||
|
bool checked = false,
|
||||||
|
const style::Checkbox &st = st::defaultCheckbox,
|
||||||
|
const style::Check &checkSt = st::defaultCheck);
|
||||||
|
Checkbox(
|
||||||
|
QWidget *parent,
|
||||||
|
rpl::producer<QString> &&text,
|
||||||
|
bool checked,
|
||||||
|
const style::Checkbox &st,
|
||||||
|
const style::Toggle &toggleSt);
|
||||||
Checkbox(
|
Checkbox(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
const QString &text,
|
const QString &text,
|
||||||
const style::Checkbox &st,
|
const style::Checkbox &st,
|
||||||
std::unique_ptr<AbstractCheckView> check);
|
std::unique_ptr<AbstractCheckView> check);
|
||||||
|
Checkbox(
|
||||||
|
QWidget *parent,
|
||||||
|
rpl::producer<QString> &&text,
|
||||||
|
const style::Checkbox &st,
|
||||||
|
std::unique_ptr<AbstractCheckView> check);
|
||||||
|
|
||||||
void setText(const QString &text, bool rich = false);
|
void setText(const QString &text, bool rich = false);
|
||||||
void setCheckAlignment(style::align alignment);
|
void setCheckAlignment(style::align alignment);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue