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
@@ -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() {