mirror-chatterino2/src/singletons/WindowManager.hpp

72 lines
1.8 KiB
C++
Raw Normal View History

#pragma once
2017-01-15 16:38:30 +01:00
2018-07-07 11:41:01 +02:00
#include <common/Singleton.hpp>
2018-06-26 14:09:39 +02:00
#include "widgets/Window.hpp"
2018-06-26 17:20:03 +02:00
#include "widgets/splits/SplitContainer.hpp"
2017-01-15 16:38:30 +01:00
2017-01-18 21:30:23 +01:00
namespace chatterino {
2018-07-07 11:41:01 +02:00
class WindowManager : public Singleton
2017-01-15 16:38:30 +01:00
{
public:
WindowManager();
2017-01-15 16:38:30 +01:00
2018-07-06 19:23:47 +02:00
static void encodeChannel(IndirectChannel channel, QJsonObject &obj);
static IndirectChannel decodeChannel(const QJsonObject &obj);
static int clampUiScale(int scale);
static float getUiScaleValue();
static float getUiScaleValue(int scale);
static const int uiScaleMin;
static const int uiScaleMax;
2018-01-24 15:08:22 +01:00
void showSettingsDialog();
void showAccountSelectPopup(QPoint point);
void layoutChannelViews(Channel *channel = nullptr);
void forceLayoutChannelViews();
2017-04-13 19:25:33 +02:00
void repaintVisibleChatWidgets(Channel *channel = nullptr);
void repaintGifEmotes();
2018-06-26 17:06:17 +02:00
Window &getMainWindow();
Window &getSelectedWindow();
2018-07-06 17:02:26 +02:00
Window &createWindow(Window::Type type);
2017-04-13 19:25:33 +02:00
2017-12-14 00:25:06 +01:00
int windowCount();
2018-06-26 17:06:17 +02:00
Window *windowAt(int index);
2017-12-14 00:25:06 +01:00
2018-07-07 11:41:01 +02:00
virtual void initialize(Application &app) override;
virtual void save() override;
void closeAll();
2017-01-26 21:04:01 +01:00
int getGeneration() const;
void incGeneration();
MessageElement::Flags getWordFlags();
void updateWordTypeMask();
2018-07-06 19:23:47 +02:00
pajlada::Signals::NoArgSignal repaintGifs;
pajlada::Signals::Signal<Channel *> layout;
pajlada::Signals::NoArgSignal wordFlagsChanged;
2017-01-15 16:38:30 +01:00
private:
2018-07-06 19:23:47 +02:00
void encodeNodeRecusively(SplitContainer::Node *node, QJsonObject &obj);
2018-07-06 19:23:47 +02:00
bool initialized_ = false;
2017-01-15 16:38:30 +01:00
2018-07-06 19:23:47 +02:00
std::atomic<int> generation_{0};
2018-07-06 19:23:47 +02:00
std::vector<Window *> windows_;
2018-05-16 14:55:45 +02:00
2018-07-06 19:23:47 +02:00
Window *mainWindow_ = nullptr;
Window *selectedWindow_ = nullptr;
2018-07-06 19:23:47 +02:00
MessageElement::Flags wordFlags_ = MessageElement::Default;
pajlada::Settings::SettingListener wordFlagsListener_;
2017-01-15 16:38:30 +01:00
};
2017-04-14 17:52:22 +02:00
} // namespace chatterino