From 61461d0a87a79a8382e65b4502e4f972f81bdc0b Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 4 Jul 2017 16:59:00 +0300 Subject: [PATCH] Improve boxes with checks / radios layout. --- Telegram/SourceFiles/boxes/autolock_box.cpp | 4 ++-- Telegram/SourceFiles/boxes/connection_box.cpp | 2 +- Telegram/SourceFiles/boxes/download_path_box.cpp | 6 +++--- Telegram/SourceFiles/boxes/language_box.cpp | 8 ++++---- Telegram/SourceFiles/boxes/report_box.cpp | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Telegram/SourceFiles/boxes/autolock_box.cpp b/Telegram/SourceFiles/boxes/autolock_box.cpp index 86f7f4e43b..92ef5046c9 100644 --- a/Telegram/SourceFiles/boxes/autolock_box.cpp +++ b/Telegram/SourceFiles/boxes/autolock_box.cpp @@ -34,12 +34,12 @@ void AutoLockBox::prepare() { auto options = { 60, 300, 3600, 18000 }; auto group = std::make_shared(Global::AutoLock()); - auto y = st::boxOptionListPadding.top(); + auto y = st::boxOptionListPadding.top() + st::langsButton.margin.top(); auto count = int(options.size()); _options.reserve(count); for (auto seconds : options) { _options.emplace_back(this, group, seconds, (seconds % 3600) ? lng_passcode_autolock_minutes(lt_count, seconds / 60) : lng_passcode_autolock_hours(lt_count, seconds / 3600), st::langsButton); - _options.back()->move(st::boxPadding.left() + st::boxOptionListPadding.left(), y); + _options.back()->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), y); y += _options.back()->heightNoMargins() + st::boxOptionListSkip; } group->setChangedCallback([this](int value) { durationChanged(value); }); diff --git a/Telegram/SourceFiles/boxes/connection_box.cpp b/Telegram/SourceFiles/boxes/connection_box.cpp index 0a937bed8c..aa2e1e88c3 100644 --- a/Telegram/SourceFiles/boxes/connection_box.cpp +++ b/Telegram/SourceFiles/boxes/connection_box.cpp @@ -127,7 +127,7 @@ void ConnectionBox::resizeEvent(QResizeEvent *e) { void ConnectionBox::updateControlsPosition() { auto type = _typeGroup->value(); - _autoRadio->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), st::boxOptionListPadding.top()); + _autoRadio->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _autoRadio->getMargins().top() + st::boxOptionListPadding.top()); _httpProxyRadio->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _autoRadio->bottomNoMargins() + st::boxOptionListSkip); auto inputy = 0; diff --git a/Telegram/SourceFiles/boxes/download_path_box.cpp b/Telegram/SourceFiles/boxes/download_path_box.cpp index dbb9913e15..674f7e3e66 100644 --- a/Telegram/SourceFiles/boxes/download_path_box.cpp +++ b/Telegram/SourceFiles/boxes/download_path_box.cpp @@ -57,11 +57,11 @@ void DownloadPathBox::updateControlsVisibility() { auto custom = (_group->value() == Directory::Custom); _pathLink->setVisible(custom); - auto newHeight = st::boxOptionListPadding.top() + _default->heightNoMargins() + st::boxOptionListSkip + _temp->heightNoMargins() + st::boxOptionListSkip + _dir->heightNoMargins(); + auto newHeight = st::boxOptionListPadding.top() + _default->getMargins().top() + _default->heightNoMargins() + st::boxOptionListSkip + _temp->heightNoMargins() + st::boxOptionListSkip + _dir->heightNoMargins(); if (custom) { newHeight += st::downloadPathSkip + _pathLink->height(); } - newHeight += st::boxOptionListPadding.bottom(); + newHeight += st::boxOptionListPadding.bottom() + _dir->getMargins().bottom(); setDimensions(st::boxWideWidth, newHeight); } @@ -69,7 +69,7 @@ void DownloadPathBox::updateControlsVisibility() { void DownloadPathBox::resizeEvent(QResizeEvent *e) { BoxContent::resizeEvent(e); - _default->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), st::boxOptionListPadding.top()); + _default->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), st::boxOptionListPadding.top() + _default->getMargins().top()); _temp->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _default->bottomNoMargins() + st::boxOptionListSkip); _dir->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _temp->bottomNoMargins() + st::boxOptionListSkip); auto inputx = st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultBoxCheckbox.textPosition.x(); diff --git a/Telegram/SourceFiles/boxes/language_box.cpp b/Telegram/SourceFiles/boxes/language_box.cpp index 4be503d976..577fc3444a 100644 --- a/Telegram/SourceFiles/boxes/language_box.cpp +++ b/Telegram/SourceFiles/boxes/language_box.cpp @@ -67,17 +67,17 @@ void LanguageBox::Inner::refresh() { } _buttons.clear(); - auto y = st::boxOptionListPadding.top(); + auto y = st::boxOptionListPadding.top() + st::langsButton.margin.top(); _buttons.reserve(_languages->size()); auto index = 0; for_const (auto &language, *_languages) { _buttons.emplace_back(this, _group, index++, language.nativeName, st::langsButton); auto button = _buttons.back().data(); - button->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), y + st::langsButton.margin.top()); + button->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), y); button->show(); y += button->heightNoMargins() + st::boxOptionListSkip; } - auto newHeight = y + st::boxOptionListPadding.bottom() + st::boxPadding.bottom(); + auto newHeight = y - st::boxOptionListSkip + st::boxOptionListPadding.bottom() + st::langsButton.margin.bottom(); resize(st::langsWidth, newHeight); } @@ -131,7 +131,7 @@ void LanguageBox::refresh() { refreshLanguages(); _inner->refresh(); - auto maxHeight = st::boxOptionListPadding.top() + _languages.size() * (st::langsButton.height + st::boxOptionListSkip) + st::boxOptionListPadding.bottom() + st::boxPadding.bottom(); + auto maxHeight = st::boxOptionListPadding.top() + st::langsButton.margin.top() + _languages.size() * (st::langsButton.height + st::boxOptionListSkip) - st::boxOptionListSkip + st::boxOptionListPadding.bottom() + st::langsButton.margin.bottom() + st::boxPadding.bottom(); setDimensions(st::langsWidth, qMin(maxHeight, st::boxMaxListHeight)); } diff --git a/Telegram/SourceFiles/boxes/report_box.cpp b/Telegram/SourceFiles/boxes/report_box.cpp index b15cbd05d3..81b0a2cb88 100644 --- a/Telegram/SourceFiles/boxes/report_box.cpp +++ b/Telegram/SourceFiles/boxes/report_box.cpp @@ -51,7 +51,7 @@ void ReportBox::prepare() { void ReportBox::resizeEvent(QResizeEvent *e) { BoxContent::resizeEvent(e); - _reasonSpam->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), st::boxOptionListPadding.top()); + _reasonSpam->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), st::boxOptionListPadding.top() + _reasonSpam->getMargins().top()); _reasonViolence->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonSpam->bottomNoMargins() + st::boxOptionListSkip); _reasonPornography->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonViolence->bottomNoMargins() + st::boxOptionListSkip); _reasonOther->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonPornography->bottomNoMargins() + st::boxOptionListSkip); @@ -131,7 +131,7 @@ bool ReportBox::reportFail(const RPCError &error) { } void ReportBox::updateMaxHeight() { - auto newHeight = st::boxOptionListPadding.top() + 4 * _reasonSpam->heightNoMargins() + 3 * st::boxOptionListSkip + st::boxOptionListPadding.bottom(); + auto newHeight = st::boxOptionListPadding.top() + _reasonSpam->getMargins().top() + 4 * _reasonSpam->heightNoMargins() + 3 * st::boxOptionListSkip + _reasonSpam->getMargins().bottom() + st::boxOptionListPadding.bottom(); if (_reasonOtherText) { newHeight += st::newGroupDescriptionPadding.top() + _reasonOtherText->height() + st::newGroupDescriptionPadding.bottom(); }