Rename Ui::Window to Ui::RpWindow.
This commit is contained in:
parent
7a71876124
commit
d452ae8ba6
7 changed files with 47 additions and 47 deletions
|
|
@ -180,6 +180,8 @@ PRIVATE
|
||||||
ui/widgets/menu/menu_toggle.h
|
ui/widgets/menu/menu_toggle.h
|
||||||
ui/widgets/popup_menu.cpp
|
ui/widgets/popup_menu.cpp
|
||||||
ui/widgets/popup_menu.h
|
ui/widgets/popup_menu.h
|
||||||
|
ui/widgets/rp_window.cpp
|
||||||
|
ui/widgets/rp_window.h
|
||||||
ui/widgets/scroll_area.cpp
|
ui/widgets/scroll_area.cpp
|
||||||
ui/widgets/scroll_area.h
|
ui/widgets/scroll_area.h
|
||||||
ui/widgets/side_bar_button.cpp
|
ui/widgets/side_bar_button.cpp
|
||||||
|
|
@ -188,8 +190,6 @@ PRIVATE
|
||||||
ui/widgets/shadow.h
|
ui/widgets/shadow.h
|
||||||
ui/widgets/tooltip.cpp
|
ui/widgets/tooltip.cpp
|
||||||
ui/widgets/tooltip.h
|
ui/widgets/tooltip.h
|
||||||
ui/widgets/window.cpp
|
|
||||||
ui/widgets/window.h
|
|
||||||
ui/wrap/fade_wrap.cpp
|
ui/wrap/fade_wrap.cpp
|
||||||
ui/wrap/fade_wrap.h
|
ui/wrap/fade_wrap.h
|
||||||
ui/wrap/padding_wrap.cpp
|
ui/wrap/padding_wrap.cpp
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include "ui/gl/gl_window.h"
|
#include "ui/gl/gl_window.h"
|
||||||
|
|
||||||
#include "ui/gl/gl_detection.h"
|
#include "ui/gl/gl_detection.h"
|
||||||
#include "ui/widgets/window.h"
|
#include "ui/widgets/rp_window.h"
|
||||||
#include "base/event_filter.h"
|
#include "base/event_filter.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/debug_log.h"
|
#include "base/debug_log.h"
|
||||||
|
|
@ -38,40 +38,40 @@ Backend Window::backend() const {
|
||||||
return _backend;
|
return _backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
not_null<Ui::Window*> Window::window() const {
|
not_null<RpWindow*> Window::window() const {
|
||||||
return _window.get();
|
return _window.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
not_null<Ui::RpWidget*> Window::widget() const {
|
not_null<RpWidget*> Window::widget() const {
|
||||||
return _body.get();
|
return _body.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Ui::Window> Window::createWindow() {
|
std::unique_ptr<RpWindow> Window::createWindow() {
|
||||||
auto result = std::make_unique<Ui::Window>();
|
auto result = std::make_unique<RpWindow>();
|
||||||
if constexpr (!kUseNativeChild) {
|
if constexpr (!kUseNativeChild) {
|
||||||
const auto capabilities = Ui::GL::CheckCapabilities(result.get());
|
const auto capabilities = CheckCapabilities(result.get());
|
||||||
const auto use = ::Platform::IsMac()
|
const auto use = ::Platform::IsMac()
|
||||||
? true
|
? true
|
||||||
: ::Platform::IsWindows()
|
: ::Platform::IsWindows()
|
||||||
? capabilities.supported
|
? capabilities.supported
|
||||||
: capabilities.transparency;
|
: capabilities.transparency;
|
||||||
LOG(("OpenGL: %1 (Ui::GL::Window)").arg(use ? "[TRUE]" : "[FALSE]"));
|
LOG(("OpenGL: %1 (Window)").arg(use ? "[TRUE]" : "[FALSE]"));
|
||||||
_backend = use ? Ui::GL::Backend::OpenGL : Ui::GL::Backend::Raster;
|
_backend = use ? Backend::OpenGL : Backend::Raster;
|
||||||
|
|
||||||
if (!use) {
|
if (!use) {
|
||||||
// We have to create a new window, if OpenGL initialization failed.
|
// We have to create a new window, if OpenGL initialization failed.
|
||||||
result = std::make_unique<Ui::Window>();
|
result = std::make_unique<RpWindow>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Ui::RpWidget> Window::createNativeBodyWrap() {
|
std::unique_ptr<RpWidget> Window::createNativeBodyWrap() {
|
||||||
if constexpr (!kUseNativeChild) {
|
if constexpr (!kUseNativeChild) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
const auto create = [] {
|
const auto create = [] {
|
||||||
auto result = std::make_unique<Ui::RpWidget>();
|
auto result = std::make_unique<RpWidget>();
|
||||||
result->setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
|
result->setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
|
||||||
result->setAttribute(Qt::WA_NativeWindow);
|
result->setAttribute(Qt::WA_NativeWindow);
|
||||||
result->setAttribute(Qt::WA_DontCreateNativeAncestors);
|
result->setAttribute(Qt::WA_DontCreateNativeAncestors);
|
||||||
|
|
@ -81,14 +81,14 @@ std::unique_ptr<Ui::RpWidget> Window::createNativeBodyWrap() {
|
||||||
};
|
};
|
||||||
|
|
||||||
auto result = create();
|
auto result = create();
|
||||||
const auto capabilities = Ui::GL::CheckCapabilities(result.get());
|
const auto capabilities = CheckCapabilities(result.get());
|
||||||
const auto use = ::Platform::IsMac()
|
const auto use = ::Platform::IsMac()
|
||||||
? true
|
? true
|
||||||
: ::Platform::IsWindows()
|
: ::Platform::IsWindows()
|
||||||
? capabilities.supported
|
? capabilities.supported
|
||||||
: capabilities.transparency;
|
: capabilities.transparency;
|
||||||
LOG(("OpenGL: %1 (Ui::GL::WindowBody)").arg(use ? "[TRUE]" : "[FALSE]"));
|
LOG(("OpenGL: %1 (WindowBody)").arg(use ? "[TRUE]" : "[FALSE]"));
|
||||||
_backend = use ? Ui::GL::Backend::OpenGL : Ui::GL::Backend::Raster;
|
_backend = use ? Backend::OpenGL : Backend::Raster;
|
||||||
|
|
||||||
if (!use) {
|
if (!use) {
|
||||||
// We have to create a new window, if OpenGL initialization failed.
|
// We have to create a new window, if OpenGL initialization failed.
|
||||||
|
|
@ -117,7 +117,7 @@ std::unique_ptr<Ui::RpWidget> Window::createNativeBodyWrap() {
|
||||||
const auto childWindow = raw->windowHandle();
|
const auto childWindow = raw->windowHandle();
|
||||||
base::install_event_filter(childWindow, [=](not_null<QEvent*> event) {
|
base::install_event_filter(childWindow, [=](not_null<QEvent*> event) {
|
||||||
if (event->type() == QEvent::Expose && childWindow->isExposed()) {
|
if (event->type() == QEvent::Expose && childWindow->isExposed()) {
|
||||||
Ui::Platform::SendWMPaintForce(_window.get());
|
Platform::SendWMPaintForce(_window.get());
|
||||||
}
|
}
|
||||||
return base::EventFilterResult::Continue;
|
return base::EventFilterResult::Continue;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Window;
|
class RpWindow;
|
||||||
class RpWidget;
|
class RpWidget;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
|
|
@ -22,17 +22,17 @@ public:
|
||||||
~Window();
|
~Window();
|
||||||
|
|
||||||
[[nodiscard]] Backend backend() const;
|
[[nodiscard]] Backend backend() const;
|
||||||
[[nodiscard]] not_null<Ui::Window*> window() const;
|
[[nodiscard]] not_null<RpWindow*> window() const;
|
||||||
[[nodiscard]] not_null<Ui::RpWidget*> widget() const;
|
[[nodiscard]] not_null<RpWidget*> widget() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
[[nodiscard]] std::unique_ptr<Ui::Window> createWindow();
|
[[nodiscard]] std::unique_ptr<RpWindow> createWindow();
|
||||||
[[nodiscard]] std::unique_ptr<Ui::RpWidget> createNativeBodyWrap();
|
[[nodiscard]] std::unique_ptr<RpWidget> createNativeBodyWrap();
|
||||||
|
|
||||||
Ui::GL::Backend _backend = Ui::GL::Backend();
|
Backend _backend = Backend();
|
||||||
const std::unique_ptr<Ui::Window> _window;
|
const std::unique_ptr<RpWindow> _window;
|
||||||
const std::unique_ptr<Ui::RpWidget> _bodyNativeWrap;
|
const std::unique_ptr<RpWidget> _bodyNativeWrap;
|
||||||
const not_null<Ui::RpWidget*> _body;
|
const not_null<RpWidget*> _body;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include "ui/platform/mac/ui_window_mac.h"
|
#include "ui/platform/mac/ui_window_mac.h"
|
||||||
|
|
||||||
#include "ui/platform/mac/ui_window_title_mac.h"
|
#include "ui/platform/mac/ui_window_title_mac.h"
|
||||||
#include "ui/widgets/window.h"
|
#include "ui/widgets/rp_window.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "styles/palette.h"
|
#include "styles/palette.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include "ui/platform/ui_platform_window_title.h"
|
#include "ui/platform/ui_platform_window_title.h"
|
||||||
#include "ui/platform/ui_platform_utility.h"
|
#include "ui/platform/ui_platform_utility.h"
|
||||||
#include "ui/widgets/window.h"
|
#include "ui/widgets/rp_window.h"
|
||||||
#include "ui/widgets/shadow.h"
|
#include "ui/widgets/shadow.h"
|
||||||
#include "ui/painter.h"
|
#include "ui/painter.h"
|
||||||
#include "styles/style_widgets.h"
|
#include "styles/style_widgets.h"
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@
|
||||||
// For license and copyright information please follow this link:
|
// For license and copyright information please follow this link:
|
||||||
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
//
|
//
|
||||||
#include "ui/widgets/window.h"
|
#include "ui/widgets/rp_window.h"
|
||||||
|
|
||||||
#include "ui/platform/ui_platform_window.h"
|
#include "ui/platform/ui_platform_window.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
||||||
Window::Window(QWidget *parent)
|
RpWindow::RpWindow(QWidget *parent)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
, _helper(Platform::CreateWindowHelper(this)) {
|
, _helper(Platform::CreateWindowHelper(this)) {
|
||||||
Expects(_helper != nullptr);
|
Expects(_helper != nullptr);
|
||||||
|
|
@ -18,57 +18,57 @@ Window::Window(QWidget *parent)
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::~Window() = default;
|
RpWindow::~RpWindow() = default;
|
||||||
|
|
||||||
not_null<RpWidget*> Window::body() {
|
not_null<RpWidget*> RpWindow::body() {
|
||||||
return _helper->body();
|
return _helper->body();
|
||||||
}
|
}
|
||||||
|
|
||||||
not_null<const RpWidget*> Window::body() const {
|
not_null<const RpWidget*> RpWindow::body() const {
|
||||||
return _helper->body().get();
|
return _helper->body().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setTitle(const QString &title) {
|
void RpWindow::setTitle(const QString &title) {
|
||||||
_helper->setTitle(title);
|
_helper->setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setTitleStyle(const style::WindowTitle &st) {
|
void RpWindow::setTitleStyle(const style::WindowTitle &st) {
|
||||||
_helper->setTitleStyle(st);
|
_helper->setTitleStyle(st);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setNativeFrame(bool enabled) {
|
void RpWindow::setNativeFrame(bool enabled) {
|
||||||
_helper->setNativeFrame(enabled);
|
_helper->setNativeFrame(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setMinimumSize(QSize size) {
|
void RpWindow::setMinimumSize(QSize size) {
|
||||||
_helper->setMinimumSize(size);
|
_helper->setMinimumSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setFixedSize(QSize size) {
|
void RpWindow::setFixedSize(QSize size) {
|
||||||
_helper->setFixedSize(size);
|
_helper->setFixedSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setStaysOnTop(bool enabled) {
|
void RpWindow::setStaysOnTop(bool enabled) {
|
||||||
_helper->setStaysOnTop(enabled);
|
_helper->setStaysOnTop(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setGeometry(QRect rect) {
|
void RpWindow::setGeometry(QRect rect) {
|
||||||
_helper->setGeometry(rect);
|
_helper->setGeometry(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::showFullScreen() {
|
void RpWindow::showFullScreen() {
|
||||||
_helper->showFullScreen();
|
_helper->showFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::showNormal() {
|
void RpWindow::showNormal() {
|
||||||
_helper->showNormal();
|
_helper->showNormal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::close() {
|
void RpWindow::close() {
|
||||||
_helper->close();
|
_helper->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setBodyTitleArea(
|
void RpWindow::setBodyTitleArea(
|
||||||
Fn<WindowTitleHitTestFlags(QPoint)> testMethod) {
|
Fn<WindowTitleHitTestFlags(QPoint)> testMethod) {
|
||||||
_helper->setBodyTitleArea(std::move(testMethod));
|
_helper->setBodyTitleArea(std::move(testMethod));
|
||||||
}
|
}
|
||||||
|
|
@ -29,10 +29,10 @@ inline constexpr bool is_flag_type(WindowTitleHitTestFlag) {
|
||||||
}
|
}
|
||||||
using WindowTitleHitTestFlags = base::flags<WindowTitleHitTestFlag>;
|
using WindowTitleHitTestFlags = base::flags<WindowTitleHitTestFlag>;
|
||||||
|
|
||||||
class Window : public RpWidget {
|
class RpWindow : public RpWidget {
|
||||||
public:
|
public:
|
||||||
explicit Window(QWidget *parent = nullptr);
|
explicit RpWindow(QWidget *parent = nullptr);
|
||||||
~Window();
|
~RpWindow();
|
||||||
|
|
||||||
[[nodiscard]] not_null<RpWidget*> body();
|
[[nodiscard]] not_null<RpWidget*> body();
|
||||||
[[nodiscard]] not_null<const RpWidget*> body() const;
|
[[nodiscard]] not_null<const RpWidget*> body() const;
|
||||||
Loading…
Add table
Reference in a new issue