Port Qt-based title widget to lib_ui

This commit is contained in:
Ilya Fedin 2021-02-03 14:43:31 +04:00 committed by John Preston
parent 153c949a88
commit 57ca6e23b9
17 changed files with 27 additions and 49 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 927 B

View file

@ -22,20 +22,6 @@ CallSignalBars {
inactiveOpacity: double;
}
callRadius: 6px;
callShadow: Shadow {
left: icon {{ "calls/call_shadow_left", windowShadowFg }};
topLeft: icon {{ "calls/call_shadow_top_left", windowShadowFg }};
top: icon {{ "calls/call_shadow_top", windowShadowFg }};
topRight: icon {{ "calls/call_shadow_top_left-flip_horizontal", windowShadowFg }};
right: icon {{ "calls/call_shadow_left-flip_horizontal", windowShadowFg }};
bottomRight: icon {{ "calls/call_shadow_top_left-flip_vertical-flip_horizontal", windowShadowFg }};
bottom: icon {{ "calls/call_shadow_top-flip_vertical", windowShadowFg }};
bottomLeft: icon {{ "calls/call_shadow_top_left-flip_vertical", windowShadowFg }};
extend: margins(9px, 8px, 9px, 10px);
fallback: windowShadowFgFallback;
}
callWidthMin: 300px;
callHeightMin: 440px;
callWidth: 720px;

View file

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "calls/calls_group_common.h"
#include "calls/calls_group_members.h"
#include "calls/calls_group_settings.h"
#include "ui/platform/ui_platform_window_title.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/window.h"
#include "ui/widgets/call_button.h"
@ -38,10 +39,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_calls.h"
#include "styles/style_layers.h"
#ifdef Q_OS_WIN
#include "ui/platform/win/ui_window_title_win.h"
#endif // Q_OS_WIN
#include <QtWidgets/QDesktopWidget>
#include <QtWidgets/QApplication>
#include <QtGui/QWindow>
@ -304,11 +301,11 @@ GroupPanel::GroupPanel(not_null<GroupCall*> call)
, _peer(call->peer())
, _window(std::make_unique<Ui::Window>(Core::App().getModalParent()))
, _layerBg(std::make_unique<Ui::LayerManager>(_window->body()))
#ifdef Q_OS_WIN
#ifndef Q_OS_MAC
, _controls(std::make_unique<Ui::Platform::TitleControls>(
_window.get(),
_window->body(),
st::groupCallTitle))
#endif // Q_OS_WIN
#endif // !Q_OS_MAC
, _members(widget(), call)
, _settings(widget(), st::groupCallSettings)
, _mute(std::make_unique<Ui::CallMuteButton>(
@ -749,9 +746,9 @@ void GroupPanel::kickMemberSure(not_null<UserData*> user) {
void GroupPanel::initLayout() {
initGeometry();
#ifdef Q_OS_WIN
#ifndef Q_OS_MAC
_controls->raise();
#endif // Q_OS_WIN
#endif // !Q_OS_MAC
}
void GroupPanel::showControls() {
@ -783,14 +780,12 @@ int GroupPanel::computeMembersListTop() const {
}
std::optional<QRect> GroupPanel::computeTitleRect() const {
#ifdef Q_OS_WIN
#ifdef Q_OS_MAC
return QRect(70, 0, widget()->width() - 70, 28);
#else // Q_OS_MAC
const auto controls = _controls->geometry();
return QRect(0, 0, controls.x(), controls.height());
#elif defined Q_OS_MAC // Q_OS_WIN
return QRect(70, 0, widget()->width() - 70, 28);
#else // Q_OS_WIN || Q_OS_MAC
return std::nullopt;
#endif // Q_OS_WIN || Q_OS_MAC
#endif // !Q_OS_MAC
}
void GroupPanel::updateControlsGeometry() {

View file

@ -110,9 +110,9 @@ private:
const std::unique_ptr<Ui::Window> _window;
const std::unique_ptr<Ui::LayerManager> _layerBg;
#ifdef Q_OS_WIN
#ifndef Q_OS_MAC
std::unique_ptr<Ui::Platform::TitleControls> _controls;
#endif // Q_OS_WIN
#endif // !Q_OS_MAC
rpl::lifetime _callLifetime;

View file

@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "calls/calls_signal_bars.h"
#include "calls/calls_userpic.h"
#include "calls/calls_video_bubble.h"
#include "ui/platform/ui_platform_window_title.h"
#include "ui/widgets/call_button.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/labels.h"
@ -45,10 +46,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_calls.h"
#include "styles/style_chat.h"
#ifdef Q_OS_WIN
#include "ui/platform/win/ui_window_title_win.h"
#endif // Q_OS_WIN
#include <QtWidgets/QDesktopWidget>
#include <QtWidgets/QApplication>
#include <QtGui/QWindow>
@ -189,12 +186,12 @@ Panel::Panel(not_null<Call*> call)
: _call(call)
, _user(call->user())
, _window(std::make_unique<Ui::Window>(Core::App().getModalParent()))
#ifdef Q_OS_WIN
#ifndef Q_OS_MAC
, _controls(std::make_unique<Ui::Platform::TitleControls>(
_window.get(),
_window->body(),
st::callTitle,
[=](bool maximized) { toggleFullScreen(maximized); }))
#endif // Q_OS_WIN
#endif // !Q_OS_MAC
, _bodySt(&st::callBodyLayout)
, _answerHangupRedial(widget(), st::callAnswer, &st::callHangup)
, _decline(widget(), object_ptr<Ui::CallButton>(widget(), st::callHangup))
@ -270,11 +267,11 @@ void Panel::initWindow() {
if (!widget()->rect().contains(widgetPoint)) {
return Flag::None | Flag(0);
}
#ifdef Q_OS_WIN
#ifndef Q_OS_MAC
if (_controls->geometry().contains(widgetPoint)) {
return Flag::None | Flag(0);
}
#endif // Q_OS_WIN
#endif // !Q_OS_MAC
const auto buttonWidth = st::callCancel.button.width;
const auto buttonsWidth = buttonWidth * 4;
const auto inControls = (_fingerprint
@ -595,9 +592,9 @@ void Panel::initLayout() {
updateControlsGeometry();
}, widget()->lifetime());
#ifdef Q_OS_WIN
#ifndef Q_OS_MAC
_controls->raise();
#endif // Q_OS_WIN
#endif // !Q_OS_MAC
}
void Panel::showControls() {
@ -669,10 +666,10 @@ void Panel::updateControlsGeometry() {
refreshIncomingGeometry();
}
if (_fingerprint) {
#ifdef Q_OS_WIN
#ifndef Q_OS_MAC
const auto minRight = _controls->geometry().width()
+ st::callFingerprintTop;
#else // Q_OS_WIN
#else // !Q_OS_MAC
const auto minRight = 0;
#endif // _controls
const auto desired = (widget()->width() - _fingerprint->width()) / 2;

View file

@ -108,9 +108,9 @@ private:
const std::unique_ptr<Ui::Window> _window;
std::unique_ptr<Incoming> _incoming;
#ifdef Q_OS_WIN
#ifndef Q_OS_MAC
std::unique_ptr<Ui::Platform::TitleControls> _controls;
#endif // Q_OS_WIN
#endif // !Q_OS_MAC
QSize _incomingFrameSize;

View file

@ -28,9 +28,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/shadow.h"
#include "ui/text/format_values.h"
#include "window/window_controller.h"
#include "styles/style_widgets.h"
#include "styles/style_window.h"
#include "styles/style_media_view.h"
#include "styles/style_calls.h" // st::callShadow
#include <QtGui/QWindow>
#include <QtGui/QScreen>

View file

@ -35,8 +35,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwidget.h" // session->content()->windowShown().
#include "facades.h"
#include "app.h"
#include "styles/style_widgets.h"
#include "styles/style_window.h"
#include "styles/style_calls.h" // st::callShadow
#include <QtWidgets/QDesktopWidget>
#include <QtCore/QMimeData>

View file

@ -13,8 +13,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/shadow.h"
#include "core/core_settings.h"
#include "core/application.h"
#include "styles/style_widgets.h"
#include "styles/style_window.h"
#include "styles/style_calls.h" // st::callShadow
#include <QtCore/QCoreApplication>
#include <QtGui/QGuiApplication>