2018-04-25 14:49:30 +02:00
|
|
|
#pragma once
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2021-10-26 17:20:28 +02:00
|
|
|
#include "ForwardDecl.hpp"
|
|
|
|
|
2018-08-11 22:23:06 +02:00
|
|
|
#include <QTimer>
|
2018-04-25 14:49:30 +02:00
|
|
|
#include <QWidget>
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
|
2021-10-26 17:20:28 +02:00
|
|
|
#include <memory>
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-25 14:49:30 +02:00
|
|
|
namespace chatterino {
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-08-11 22:23:06 +02:00
|
|
|
class Split;
|
|
|
|
class Channel;
|
|
|
|
using ChannelPtr = std::shared_ptr<Channel>;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-25 14:49:30 +02:00
|
|
|
class AttachedWindow : public QWidget
|
|
|
|
{
|
2018-07-03 23:27:17 +02:00
|
|
|
AttachedWindow(void *_target, int _yOffset);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-25 14:49:30 +02:00
|
|
|
public:
|
2018-05-28 18:25:19 +02:00
|
|
|
struct GetArgs {
|
|
|
|
QString winId;
|
|
|
|
int yOffset = -1;
|
2021-07-25 15:13:21 +02:00
|
|
|
double x = -1;
|
|
|
|
double pixelRatio = -1;
|
2018-05-28 18:25:19 +02:00
|
|
|
int width = -1;
|
|
|
|
int height = -1;
|
2019-08-20 03:13:42 +02:00
|
|
|
bool fullscreen = false;
|
2018-05-28 18:25:19 +02:00
|
|
|
};
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-05-30 17:17:27 +02:00
|
|
|
virtual ~AttachedWindow() override;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-05-30 17:17:27 +02:00
|
|
|
static AttachedWindow *get(void *target_, const GetArgs &args);
|
2023-07-30 13:14:58 +02:00
|
|
|
#ifdef USEWINSDK
|
|
|
|
static AttachedWindow *getForeground(const GetArgs &args);
|
|
|
|
#endif
|
2018-04-25 14:49:30 +02:00
|
|
|
static void detach(const QString &winId);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-25 14:49:30 +02:00
|
|
|
void setChannel(ChannelPtr channel);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-25 14:49:30 +02:00
|
|
|
protected:
|
|
|
|
virtual void showEvent(QShowEvent *) override;
|
|
|
|
// virtual void nativeEvent(const QByteArray &eventType, void *message,
|
|
|
|
// long *result) override;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-25 14:49:30 +02:00
|
|
|
private:
|
|
|
|
struct {
|
|
|
|
Split *split;
|
2018-05-30 17:17:27 +02:00
|
|
|
} ui_;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-25 14:49:30 +02:00
|
|
|
struct Item {
|
|
|
|
void *hwnd;
|
|
|
|
AttachedWindow *window;
|
|
|
|
QString winId;
|
|
|
|
};
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-25 14:49:30 +02:00
|
|
|
static std::vector<Item> items;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
void attachToHwnd(void *attached);
|
|
|
|
void updateWindowRect(void *attached);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
void *target_;
|
|
|
|
int yOffset_;
|
|
|
|
int currentYOffset_;
|
2021-07-25 15:13:21 +02:00
|
|
|
double x_ = -1;
|
|
|
|
double pixelRatio_ = -1;
|
2018-07-06 19:23:47 +02:00
|
|
|
int width_ = 360;
|
|
|
|
int height_ = -1;
|
2019-08-20 03:13:42 +02:00
|
|
|
bool fullscreen_ = false;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
#ifdef USEWINSDK
|
|
|
|
bool validProcessName_ = false;
|
|
|
|
bool attached_ = false;
|
|
|
|
#endif
|
|
|
|
QTimer timer_;
|
2019-08-20 03:13:42 +02:00
|
|
|
QTimer slowTimer_;
|
2018-04-25 14:49:30 +02:00
|
|
|
};
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-04-25 14:49:30 +02:00
|
|
|
} // namespace chatterino
|