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