mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 15:47:11 +02:00
Add window controls to call panel on Windows.
This commit is contained in:
parent
925f6df06a
commit
7de5cabd79
3 changed files with 47 additions and 4 deletions
|
@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "main/main_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "platform/platform_specific.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "window/main_window.h"
|
||||
#include "layout.h"
|
||||
#include "app.h"
|
||||
|
@ -41,6 +42,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/style_calls.h"
|
||||
#include "styles/style_history.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>
|
||||
|
@ -261,6 +266,11 @@ Panel::Panel(not_null<Call*> call)
|
|||
: _call(call)
|
||||
, _user(call->user())
|
||||
, _window(std::make_unique<Ui::Window>(Core::App().getModalParent()))
|
||||
#ifdef Q_OS_WIN
|
||||
, _controls(std::make_unique<Ui::Platform::TitleControls>(
|
||||
_window.get(),
|
||||
[=](bool maximized) { toggleFullScreen(maximized); }))
|
||||
#endif // Q_OS_WIN
|
||||
, _bodySt(&st::callBodyLayout)
|
||||
, _answerHangupRedial(widget(), st::callAnswer, &st::callHangup)
|
||||
, _decline(widget(), object_ptr<Button>(widget(), st::callHangup))
|
||||
|
@ -299,6 +309,10 @@ void Panel::initWindow() {
|
|||
_window->setTitle(u" "_q);
|
||||
_window->setTitleStyle(st::callTitle);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
_controls->setStyle(st::callTitle);
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
_window->events(
|
||||
) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||
if (e->type() == QEvent::Close) {
|
||||
|
@ -316,6 +330,11 @@ void Panel::initWindow() {
|
|||
if (!widget()->rect().contains(widgetPoint)) {
|
||||
return Flag::None | Flag(0);
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
if (_controls->geometry().contains(widgetPoint)) {
|
||||
return Flag::None | Flag(0);
|
||||
}
|
||||
#endif // Q_OS_WIN
|
||||
const auto buttonWidth = st::callCancel.button.width;
|
||||
const auto buttonsWidth = buttonWidth * 4;
|
||||
const auto inControls = _fingerprintArea.contains(widgetPoint)
|
||||
|
@ -520,6 +539,10 @@ void Panel::initLayout() {
|
|||
_name->setText(_call->user()->name);
|
||||
updateControlsGeometry();
|
||||
}, widget()->lifetime());
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
_controls->raise();
|
||||
#endif // Q_OS_WIN
|
||||
}
|
||||
|
||||
void Panel::showControls() {
|
||||
|
@ -559,6 +582,14 @@ void Panel::refreshOutgoingPreviewInBody(State state) {
|
|||
updateControlsGeometry();
|
||||
}
|
||||
|
||||
void Panel::toggleFullScreen(bool fullscreen) {
|
||||
if (fullscreen) {
|
||||
_window->showFullScreen();
|
||||
} else {
|
||||
_window->showNormal();
|
||||
}
|
||||
}
|
||||
|
||||
void Panel::updateFingerprintGeometry() {
|
||||
auto realSize = Ui::Emoji::GetSizeLarge();
|
||||
auto size = realSize / cIntRetinaFactor();
|
||||
|
@ -692,8 +723,12 @@ void Panel::paint(QRect clip) {
|
|||
paintSignalBarsBg(p);
|
||||
}
|
||||
|
||||
if (!_fingerprint.empty()) {
|
||||
App::roundRect(p, _fingerprintArea, st::callFingerprintBg, ImageRoundRadius::Large);
|
||||
if (!_fingerprint.empty() && clip.intersects(_fingerprintArea)) {
|
||||
const auto radius = _fingerprintArea.height() / 2;
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
p.setBrush(st::callBgButton);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.drawRoundedRect(_fingerprintArea, radius, radius);
|
||||
|
||||
const auto realSize = Ui::Emoji::GetSizeLarge();
|
||||
const auto size = realSize / cIntRetinaFactor();
|
||||
|
@ -719,7 +754,7 @@ void Panel::paintSignalBarsBg(Painter &p) {
|
|||
App::roundRect(
|
||||
p,
|
||||
signalBarsRect(),
|
||||
st::callFingerprintBg,
|
||||
st::callBgButton,
|
||||
ImageRoundRadius::Small);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@ class FlatLabel;
|
|||
template <typename Widget>
|
||||
class FadeWrap;
|
||||
class Window;
|
||||
namespace Platform {
|
||||
class TitleControls;
|
||||
} // namespace Platform
|
||||
} // namespace Ui
|
||||
|
||||
namespace style {
|
||||
|
@ -90,12 +93,17 @@ private:
|
|||
void setIncomingShown(bool shown);
|
||||
|
||||
void refreshOutgoingPreviewInBody(State state);
|
||||
void toggleFullScreen(bool fullscreen);
|
||||
|
||||
Call *_call = nullptr;
|
||||
not_null<UserData*> _user;
|
||||
|
||||
const std::unique_ptr<Ui::Window> _window;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
std::unique_ptr<Ui::Platform::TitleControls> _controls;
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
bool _incomingShown = false;
|
||||
|
||||
rpl::lifetime _callLifetime;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6735ee93dc6202d816fe1e3c06187007e2633565
|
||||
Subproject commit b534567e11cd9c39035374364448d2aa76bd0aab
|
Loading…
Add table
Reference in a new issue