2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Switch MainWindow to Ui::RpWindow

This commit is contained in:
Ilya Fedin
2021-07-26 01:30:56 +04:00
committed by John Preston
parent 4ef2d3b957
commit 1ebf27bfa1
29 changed files with 116 additions and 1933 deletions

View File

@@ -7,8 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "window/window_title.h"
#include "ui/rp_widget.h"
#include "ui/widgets/rp_window.h"
#include "base/timer.h"
#include "base/object_ptr.h"
#include "core/core_settings.h"
@@ -37,7 +36,7 @@ QImage LoadLogoNoMargin();
QIcon CreateIcon(Main::Session *session = nullptr);
void ConvertIconToBlack(QImage &image);
class MainWindow : public Ui::RpWidget {
class MainWindow : public Ui::RpWindow {
public:
explicit MainWindow(not_null<Controller*> controller);
virtual ~MainWindow();
@@ -60,7 +59,6 @@ public:
[[nodiscard]] QRect desktopRect() const;
void init();
[[nodiscard]] HitTestResult hitTest(const QPoint &p) const;
void updateIsActive();
@@ -77,12 +75,6 @@ public:
}
void positionUpdated();
bool titleVisible() const;
void setTitleVisible(bool visible);
QString titleText() const {
return _titleText;
}
void reActivateWindow();
void showRightColumn(object_ptr<TWidget> widget);
@@ -112,22 +104,18 @@ public:
void clearWidgets();
QRect inner() const;
int computeMinWidth() const;
int computeMinHeight() const;
void recountGeometryConstraints();
virtual void updateControlsGeometry();
bool hasShadow() const;
bool minimizeToTray();
void updateGlobalMenu() {
updateGlobalMenuHook();
}
protected:
void paintEvent(QPaintEvent *e) override;
void resizeEvent(QResizeEvent *e) override;
void leaveEventHook(QEvent *e) override;
@@ -154,9 +142,6 @@ protected:
virtual void stateChangedHook(Qt::WindowState state) {
}
virtual void titleVisibilityChangedHook() {
}
virtual void unreadCounterChangedHook() {
}
@@ -180,10 +165,6 @@ protected:
virtual void createGlobalMenu() {
}
virtual void initShadows() {
}
virtual void firstShadowsUpdate() {
}
virtual bool initSizeFromSystem() {
return false;
@@ -203,7 +184,6 @@ protected:
private:
void refreshTitleWidget();
void updateMinimumSize();
void updateShadowSize();
void updatePalette();
void initSize();
@@ -214,7 +194,6 @@ private:
base::Timer _positionUpdatedTimer;
bool _positionInited = false;
object_ptr<TitleWidget> _title = { nullptr };
object_ptr<Ui::PlainShadow> _titleShadow = { nullptr };
object_ptr<Ui::RpWidget> _outdated;
object_ptr<Ui::RpWidget> _body;
@@ -222,8 +201,6 @@ private:
QIcon _icon;
bool _usingSupportIcon = false;
QString _titleText;
style::margins _padding;
bool _isActive = false;