2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-01-15 16:38:30 +01:00
|
|
|
|
2018-06-26 14:39:22 +02:00
|
|
|
#include "widgets/splits/SplitContainer.hpp"
|
2018-06-26 14:09:39 +02:00
|
|
|
#include "widgets/Window.hpp"
|
2017-01-15 16:38:30 +01:00
|
|
|
|
2017-01-18 21:30:23 +01:00
|
|
|
namespace chatterino {
|
2018-06-04 16:10:54 +02:00
|
|
|
// namespace widgets {
|
|
|
|
// struct SplitContainer::Node;
|
2018-05-24 22:58:07 +02:00
|
|
|
//}
|
2017-12-31 22:58:35 +01:00
|
|
|
namespace singletons {
|
2017-01-18 21:30:23 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
class WindowManager
|
2017-01-15 16:38:30 +01:00
|
|
|
{
|
2018-04-28 15:20:18 +02:00
|
|
|
public:
|
2018-04-27 22:11:19 +02:00
|
|
|
WindowManager();
|
2017-11-12 17:21:50 +01:00
|
|
|
|
2018-04-27 22:11:19 +02:00
|
|
|
~WindowManager() = delete;
|
2017-01-15 16:38:30 +01:00
|
|
|
|
2018-01-24 15:08:22 +01:00
|
|
|
void showSettingsDialog();
|
|
|
|
void showAccountSelectPopup(QPoint point);
|
|
|
|
|
2018-06-04 16:10:54 +02:00
|
|
|
void layoutChannelViews(Channel *channel = nullptr);
|
|
|
|
void forceLayoutChannelViews();
|
2017-04-13 19:25:33 +02:00
|
|
|
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
|
|
|
void repaintGifEmotes();
|
2017-09-16 00:05:06 +02:00
|
|
|
// void updateAll();
|
2017-04-13 19:25:33 +02:00
|
|
|
|
2017-11-12 17:21:50 +01:00
|
|
|
widgets::Window &getMainWindow();
|
2017-12-14 00:25:06 +01:00
|
|
|
widgets::Window &getSelectedWindow();
|
2018-04-06 23:31:34 +02:00
|
|
|
widgets::Window &createWindow(widgets::Window::WindowType type);
|
2017-04-13 19:25:33 +02:00
|
|
|
|
2017-12-14 00:25:06 +01:00
|
|
|
int windowCount();
|
|
|
|
widgets::Window *windowAt(int index);
|
|
|
|
|
2017-04-13 19:25:33 +02:00
|
|
|
void save();
|
2018-04-06 23:31:34 +02:00
|
|
|
void initialize();
|
|
|
|
void closeAll();
|
2017-01-26 21:04:01 +01:00
|
|
|
|
2018-06-04 16:10:54 +02:00
|
|
|
int getGeneration() const;
|
|
|
|
void incGeneration();
|
|
|
|
|
2018-04-03 02:55:32 +02:00
|
|
|
pajlada::Signals::NoArgSignal repaintGifs;
|
|
|
|
pajlada::Signals::Signal<Channel *> layout;
|
2017-09-17 02:13:57 +02:00
|
|
|
|
2018-06-11 19:11:33 +02:00
|
|
|
static const int uiScaleMin;
|
|
|
|
static const int uiScaleMax;
|
2018-06-11 15:04:54 +02:00
|
|
|
static int clampUiScale(int scale);
|
|
|
|
static float getUiScaleValue();
|
|
|
|
static float getUiScaleValue(int scale);
|
|
|
|
|
2017-01-15 16:38:30 +01:00
|
|
|
private:
|
2018-04-06 23:31:34 +02:00
|
|
|
bool initialized = false;
|
|
|
|
|
2018-06-04 16:10:54 +02:00
|
|
|
std::atomic<int> generation{0};
|
|
|
|
|
2017-11-12 17:21:50 +01:00
|
|
|
std::vector<widgets::Window *> windows;
|
2017-01-15 16:38:30 +01:00
|
|
|
|
2017-11-12 17:21:50 +01:00
|
|
|
widgets::Window *mainWindow = nullptr;
|
2017-12-14 00:25:06 +01:00
|
|
|
widgets::Window *selectedWindow = nullptr;
|
2018-04-20 22:33:28 +02:00
|
|
|
|
2018-05-16 14:55:45 +02:00
|
|
|
void encodeNodeRecusively(widgets::SplitContainer::Node *node, QJsonObject &obj);
|
|
|
|
|
|
|
|
public:
|
|
|
|
static void encodeChannel(IndirectChannel channel, QJsonObject &obj);
|
|
|
|
static IndirectChannel decodeChannel(const QJsonObject &obj);
|
2017-01-15 16:38:30 +01:00
|
|
|
};
|
2017-01-28 22:35:23 +01:00
|
|
|
|
2018-01-05 02:56:18 +01:00
|
|
|
} // namespace singletons
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace chatterino
|