2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-06-11 09:31:45 +02:00
|
|
|
#include "widgets/notebookbutton.hpp"
|
|
|
|
#include "widgets/notebookpage.hpp"
|
|
|
|
#include "widgets/notebooktab.hpp"
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-01-18 04:52:47 +01:00
|
|
|
#include <QList>
|
|
|
|
#include <QWidget>
|
2017-01-28 22:35:23 +01:00
|
|
|
#include <boost/property_tree/ptree.hpp>
|
2017-01-18 04:52:47 +01:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
2017-06-13 21:13:58 +02:00
|
|
|
|
|
|
|
class ChannelManager;
|
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace widgets {
|
2017-01-18 21:30:23 +01:00
|
|
|
|
2016-12-29 17:31:07 +01:00
|
|
|
class Notebook : public QWidget
|
|
|
|
{
|
2017-01-11 18:52:09 +01:00
|
|
|
Q_OBJECT
|
2016-12-29 17:31:07 +01:00
|
|
|
|
|
|
|
public:
|
2017-01-22 05:58:23 +01:00
|
|
|
enum HighlightType { none, highlighted, newMessage };
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-06-13 21:13:58 +02:00
|
|
|
Notebook(ChannelManager &_channelManager, QWidget *parent);
|
2016-12-30 12:20:26 +01:00
|
|
|
|
2017-01-22 05:58:23 +01:00
|
|
|
NotebookPage *addPage(bool select = false);
|
2016-12-30 12:20:26 +01:00
|
|
|
|
2017-01-22 05:58:23 +01:00
|
|
|
void removePage(NotebookPage *page);
|
2017-01-11 18:52:09 +01:00
|
|
|
void select(NotebookPage *page);
|
2017-01-16 03:15:07 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
NotebookPage *getSelectedPage()
|
2017-01-16 03:15:07 +01:00
|
|
|
{
|
2017-04-12 17:46:44 +02:00
|
|
|
return _selectedPage;
|
2017-01-16 03:15:07 +01:00
|
|
|
}
|
|
|
|
|
2017-01-26 05:26:21 +01:00
|
|
|
void performLayout(bool animate = true);
|
2016-12-30 18:00:25 +01:00
|
|
|
|
2017-01-22 12:46:35 +01:00
|
|
|
NotebookPage *tabAt(QPoint point, int &index);
|
|
|
|
void rearrangePage(NotebookPage *page, int index);
|
|
|
|
|
2016-12-30 12:20:26 +01:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *);
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-01-01 18:43:52 +01:00
|
|
|
void settingsButtonMouseReleased(QMouseEvent *event);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void settingsButtonClicked();
|
2017-01-22 05:58:23 +01:00
|
|
|
void usersButtonClicked();
|
|
|
|
void addPageButtonClicked();
|
2017-01-01 18:43:52 +01:00
|
|
|
|
2016-12-29 17:31:07 +01:00
|
|
|
private:
|
2017-06-13 21:13:58 +02:00
|
|
|
ChannelManager &channelManager;
|
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
QList<NotebookPage *> _pages;
|
2016-12-30 12:20:26 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
NotebookButton _addButton;
|
|
|
|
NotebookButton _settingsButton;
|
|
|
|
NotebookButton _userButton;
|
2016-12-30 12:20:26 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
NotebookPage *_selectedPage;
|
2017-01-28 22:35:23 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
void load(const boost::property_tree::ptree &tree);
|
|
|
|
void save(boost::property_tree::ptree &tree);
|
|
|
|
void loadDefaults();
|
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
|