mirror-chatterino2/src/widgets/window.hpp

83 lines
1.7 KiB
C++
Raw Normal View History

#pragma once
2016-12-29 17:31:07 +01:00
#include "util/helpers.hpp"
#include "widgets/basewidget.hpp"
2017-06-11 09:31:45 +02:00
#include "widgets/notebook.hpp"
#include "widgets/titlebar.hpp"
2016-12-29 17:31:07 +01:00
//#ifdef USEWINSDK
//#include <platform/borderless/qwinwidget.h>
//#endif
2017-04-18 02:07:14 +02:00
2017-12-14 00:25:06 +01:00
#include <boost/signals2.hpp>
#include <pajlada/settings/setting.hpp>
#include <pajlada/signals/signal.hpp>
2017-01-18 04:52:47 +01:00
2017-04-14 17:52:22 +02:00
namespace chatterino {
class ChannelManager;
class ColorScheme;
class CompletionManager;
2017-04-14 17:52:22 +02:00
namespace widgets {
2017-01-18 21:30:23 +01:00
struct WindowGeometry {
WindowGeometry(const std::string &settingPrefix)
: x(fS("{}/geometry/x", settingPrefix))
, y(fS("{}/geometry/y", settingPrefix))
, width(fS("{}/geometry/width", settingPrefix))
, height(fS("{}/geometry/height", settingPrefix))
{
}
pajlada::Settings::Setting<int> x;
pajlada::Settings::Setting<int> y;
pajlada::Settings::Setting<int> width;
pajlada::Settings::Setting<int> height;
};
2017-11-12 17:21:50 +01:00
class Window : public BaseWidget
2016-12-29 17:31:07 +01:00
{
Q_OBJECT
std::string settingRoot;
WindowGeometry windowGeometry;
2016-12-29 17:31:07 +01:00
public:
explicit Window(const QString &windowName, ChannelManager &_channelManager,
ColorScheme &_colorScheme, bool isMainWindow);
2017-04-12 17:46:44 +02:00
void repaintVisibleChatWidgets(Channel *channel = nullptr);
2017-04-12 17:46:44 +02:00
Notebook &getNotebook();
void refreshWindowTitle(const QString &username);
2017-12-14 00:25:06 +01:00
boost::signals2::signal<void()> closed;
protected:
virtual void closeEvent(QCloseEvent *event) override;
private:
2017-09-22 00:50:43 +02:00
float dpi;
virtual void refreshTheme() override;
void loadGeometry();
ChannelManager &channelManager;
ColorScheme &colorScheme;
Notebook notebook;
TitleBar titleBar;
friend class Notebook;
public:
void save();
2016-12-29 17:31:07 +01:00
};
2017-04-14 17:52:22 +02:00
} // namespace widgets
} // namespace chatterino