2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-12-17 17:09:50 +01:00
|
|
|
#include "util/helpers.hpp"
|
2018-01-14 21:55:36 +01:00
|
|
|
#include "widgets/basewindow.hpp"
|
2017-06-11 09:31:45 +02:00
|
|
|
#include "widgets/notebook.hpp"
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-09-21 17:34:41 +02: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>
|
2017-12-17 17:09:50 +01:00
|
|
|
#include <pajlada/settings/setting.hpp>
|
2017-12-23 22:17:38 +01:00
|
|
|
#include <pajlada/signals/signal.hpp>
|
2017-01-18 04:52:47 +01:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
2017-12-31 22:58:35 +01:00
|
|
|
namespace singletons {
|
2017-12-31 00:50:07 +01:00
|
|
|
class ThemeManager;
|
2017-12-31 22:58:35 +01:00
|
|
|
}
|
2017-06-13 21:13:58 +02:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace widgets {
|
2017-01-18 21:30:23 +01:00
|
|
|
|
2017-12-17 17:09:50 +01:00
|
|
|
struct WindowGeometry {
|
2017-12-22 14:44:31 +01:00
|
|
|
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))
|
2017-12-17 17:09:50 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
pajlada::Settings::Setting<int> x;
|
|
|
|
pajlada::Settings::Setting<int> y;
|
|
|
|
pajlada::Settings::Setting<int> width;
|
|
|
|
pajlada::Settings::Setting<int> height;
|
|
|
|
};
|
|
|
|
|
2018-01-14 21:55:36 +01:00
|
|
|
class Window : public BaseWindow
|
2016-12-29 17:31:07 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2017-12-22 14:44:31 +01:00
|
|
|
std::string settingRoot;
|
2017-12-17 17:09:50 +01:00
|
|
|
|
|
|
|
WindowGeometry windowGeometry;
|
|
|
|
|
2016-12-29 17:31:07 +01:00
|
|
|
public:
|
2018-01-06 20:27:26 +01:00
|
|
|
explicit Window(const QString &windowName, singletons::ThemeManager &_themeManager,
|
|
|
|
bool isMainWindow);
|
2017-01-16 03:15:07 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
2017-01-28 22:35:23 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
Notebook &getNotebook();
|
2017-01-28 22:35:23 +01:00
|
|
|
|
2017-12-18 21:02:17 +01:00
|
|
|
void refreshWindowTitle(const QString &username);
|
|
|
|
|
2017-12-14 00:25:06 +01:00
|
|
|
boost::signals2::signal<void()> closed;
|
|
|
|
|
2017-06-26 16:41:20 +02:00
|
|
|
protected:
|
|
|
|
virtual void closeEvent(QCloseEvent *event) override;
|
2018-01-23 22:48:33 +01:00
|
|
|
virtual bool event(QEvent *event) override;
|
2017-06-26 16:41:20 +02:00
|
|
|
|
2017-01-28 22:35:23 +01:00
|
|
|
private:
|
2017-09-22 00:50:43 +02:00
|
|
|
float dpi;
|
|
|
|
|
2017-12-17 17:09:50 +01:00
|
|
|
void loadGeometry();
|
|
|
|
|
2017-06-13 21:13:58 +02:00
|
|
|
Notebook notebook;
|
2018-02-05 21:20:38 +01:00
|
|
|
// TitleBar titleBar;
|
2017-06-26 16:41:20 +02:00
|
|
|
|
2017-07-23 14:16:13 +02:00
|
|
|
friend class Notebook;
|
2017-12-22 14:44:31 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
void save();
|
2016-12-29 17:31:07 +01:00
|
|
|
};
|
2017-01-28 22:35:23 +01:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|