fixed compiling
This commit is contained in:
@@ -22,6 +22,8 @@ Application::Application()
|
|||||||
logging::init();
|
logging::init();
|
||||||
SettingsManager::getInstance().load();
|
SettingsManager::getInstance().load();
|
||||||
|
|
||||||
|
this->windowManager.initMainWindow();
|
||||||
|
|
||||||
// Initialize everything we need
|
// Initialize everything we need
|
||||||
this->emoteManager.loadGlobalEmotes();
|
this->emoteManager.loadGlobalEmotes();
|
||||||
|
|
||||||
|
|||||||
+22
-20
@@ -4,37 +4,39 @@
|
|||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
void CommandManager::execCommand(QString command)
|
void CommandManager::execCommand(QString command)
|
||||||
{
|
{
|
||||||
if (command == "selectr") {
|
// if (command == "selectr") {
|
||||||
selectSplitRelative(1, 0);
|
// selectSplitRelative(false, 1);
|
||||||
}
|
// }
|
||||||
if (command == "selectl") {
|
// if (command == "selectl") {
|
||||||
selectSplitRelative(-1, 0);
|
// selectSplitRelative(false, -1);
|
||||||
}
|
// }
|
||||||
if (command == "selectu") {
|
// if (command == "selectu") {
|
||||||
selectSplitRelative(0, -1);
|
// selectSplitRelative(true, -1);
|
||||||
}
|
// }
|
||||||
if (command == "selectd") {
|
// if (command == "selectd") {
|
||||||
selectSplitRelative(0, 1);
|
// selectSplitRelative(true, 1);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (command == "mover") {
|
if (command == "mover") {
|
||||||
moveSplitRelative(1, 0);
|
moveSplitRelative(false, 1);
|
||||||
}
|
}
|
||||||
if (command == "movel") {
|
if (command == "movel") {
|
||||||
moveSplitRelative(-1, 0);
|
moveSplitRelative(false, -1);
|
||||||
}
|
}
|
||||||
if (command == "moveu") {
|
if (command == "moveu") {
|
||||||
moveSplitRelative(0, -1);
|
moveSplitRelative(true, -1);
|
||||||
}
|
}
|
||||||
if (command == "moved") {
|
if (command == "moved") {
|
||||||
moveSplitRelative(0, 1);
|
moveSplitRelative(true, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandManager::selectSplitRelative(int dx, int dy)
|
//void CommandManager::selectSplitRelative(bool vertical, int offset)
|
||||||
{
|
//{
|
||||||
WindowManager::instance->getCurrentWindow().getNotebook().getSelectedPage();
|
// SplitContainer *container = WindowManager::instance->
|
||||||
}
|
//
|
||||||
|
// if (vertical)
|
||||||
|
//}
|
||||||
|
|
||||||
void CommandManager::moveSplitRelative(int dx, int dy)
|
void CommandManager::moveSplitRelative(int dx, int dy)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public:
|
|||||||
CommandManager() = delete;
|
CommandManager() = delete;
|
||||||
|
|
||||||
void execCommand(QString command);
|
void execCommand(QString command);
|
||||||
void selectSplitRelative(int dx, int dy);
|
// void selectSplitRelative(int dx, int dy);
|
||||||
void moveSplitRelative(int dx, int dy);
|
void moveSplitRelative(int dx, int dy);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,11 @@ void Notebook::select(SplitContainer *page)
|
|||||||
this->performLayout();
|
this->performLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Notebook::tabCount()
|
||||||
|
{
|
||||||
|
return this->pages.size();
|
||||||
|
}
|
||||||
|
|
||||||
SplitContainer *Notebook::tabAt(QPoint point, int &index)
|
SplitContainer *Notebook::tabAt(QPoint point, int &index)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public:
|
|||||||
|
|
||||||
void performLayout(bool animate = true);
|
void performLayout(bool animate = true);
|
||||||
|
|
||||||
|
int tabCount();
|
||||||
SplitContainer *tabAt(QPoint point, int &index);
|
SplitContainer *tabAt(QPoint point, int &index);
|
||||||
void rearrangePage(SplitContainer *page, int index);
|
void rearrangePage(SplitContainer *page, int index);
|
||||||
|
|
||||||
|
|||||||
@@ -66,10 +66,6 @@ Window::Window(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::~Window()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::repaintVisibleChatWidgets(Channel *channel)
|
void Window::repaintVisibleChatWidgets(Channel *channel)
|
||||||
{
|
{
|
||||||
auto *page = this->notebook.getSelectedPage();
|
auto *page = this->notebook.getSelectedPage();
|
||||||
@@ -128,6 +124,8 @@ void Window::closeEvent(QCloseEvent *)
|
|||||||
{
|
{
|
||||||
// Save closing window position
|
// Save closing window position
|
||||||
// this->windowGeometry = this->geometry();
|
// this->windowGeometry = this->geometry();
|
||||||
|
|
||||||
|
this->closed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::refreshTheme()
|
void Window::refreshTheme()
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree.hpp>
|
||||||
|
#include <boost/signals2.hpp>
|
||||||
#include <pajlada/settings/serialize.hpp>
|
#include <pajlada/settings/serialize.hpp>
|
||||||
#include <pajlada/settings/settingdata.hpp>
|
#include <pajlada/settings/settingdata.hpp>
|
||||||
|
|
||||||
@@ -27,7 +28,6 @@ class Window : public BaseWidget
|
|||||||
public:
|
public:
|
||||||
explicit Window(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
explicit Window(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
||||||
CompletionManager &_completionManager, bool isMainWindow);
|
CompletionManager &_completionManager, bool isMainWindow);
|
||||||
~Window();
|
|
||||||
|
|
||||||
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
||||||
|
|
||||||
@@ -39,6 +39,8 @@ public:
|
|||||||
|
|
||||||
Notebook &getNotebook();
|
Notebook &getNotebook();
|
||||||
|
|
||||||
|
boost::signals2::signal<void()> closed;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent *event) override;
|
virtual void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
|
|||||||
+23
-9
@@ -20,6 +20,12 @@ WindowManager::WindowManager(ChannelManager &_channelManager, ColorScheme &_colo
|
|||||||
WindowManager::instance = this;
|
WindowManager::instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::initMainWindow()
|
||||||
|
{
|
||||||
|
this->selectedWindow = this->mainWindow =
|
||||||
|
new widgets::Window(this->channelManager, this->colorScheme, this->completionManager, true);
|
||||||
|
}
|
||||||
|
|
||||||
static const std::string &getSettingsPath()
|
static const std::string &getSettingsPath()
|
||||||
{
|
{
|
||||||
static std::string path = (Path::getAppdataPath() + "uilayout.json").toStdString();
|
static std::string path = (Path::getAppdataPath() + "uilayout.json").toStdString();
|
||||||
@@ -53,18 +59,12 @@ void WindowManager::repaintGifEmotes()
|
|||||||
|
|
||||||
widgets::Window &WindowManager::getMainWindow()
|
widgets::Window &WindowManager::getMainWindow()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(this->windowMutex);
|
|
||||||
|
|
||||||
if (this->mainWindow == nullptr) {
|
|
||||||
this->mainWindow = new widgets::Window(this->channelManager, this->colorScheme,
|
|
||||||
this->completionManager, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this->mainWindow;
|
return *this->mainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
widgets::Window &WindowManager::getCurrentWindow()
|
widgets::Window &WindowManager::getSelectedWindow()
|
||||||
{
|
{
|
||||||
|
return *this->selectedWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
widgets::Window &WindowManager::createWindow()
|
widgets::Window &WindowManager::createWindow()
|
||||||
@@ -72,7 +72,6 @@ widgets::Window &WindowManager::createWindow()
|
|||||||
auto *window = new widgets::Window(this->channelManager, this->colorScheme,
|
auto *window = new widgets::Window(this->channelManager, this->colorScheme,
|
||||||
this->completionManager, false);
|
this->completionManager, false);
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(this->windowMutex);
|
|
||||||
window->loadDefaults();
|
window->loadDefaults();
|
||||||
|
|
||||||
this->windows.push_back(window);
|
this->windows.push_back(window);
|
||||||
@@ -80,6 +79,21 @@ widgets::Window &WindowManager::createWindow()
|
|||||||
return *window;
|
return *window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WindowManager::windowCount()
|
||||||
|
{
|
||||||
|
return this->windows.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
widgets::Window *WindowManager::windowAt(int index)
|
||||||
|
{
|
||||||
|
if (index < 0 || index >= this->windows.size()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
qDebug() << "getting window at bad index" << index;
|
||||||
|
|
||||||
|
return this->windows.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
void WindowManager::load()
|
void WindowManager::load()
|
||||||
{
|
{
|
||||||
const auto &settingsPath = getSettingsPath();
|
const auto &settingsPath = getSettingsPath();
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#include "widgets/window.hpp"
|
#include "widgets/window.hpp"
|
||||||
|
|
||||||
#include <mutex>
|
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
class ChannelManager;
|
class ChannelManager;
|
||||||
@@ -25,13 +23,16 @@ public:
|
|||||||
void layoutVisibleChatWidgets(Channel *channel = nullptr);
|
void layoutVisibleChatWidgets(Channel *channel = nullptr);
|
||||||
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
||||||
void repaintGifEmotes();
|
void repaintGifEmotes();
|
||||||
|
void initMainWindow();
|
||||||
// void updateAll();
|
// void updateAll();
|
||||||
|
|
||||||
widgets::Window &getMainWindow();
|
widgets::Window &getMainWindow();
|
||||||
widgets::Window &getCurrentWindow();
|
widgets::Window &getSelectedWindow();
|
||||||
|
|
||||||
widgets::Window &createWindow();
|
widgets::Window &createWindow();
|
||||||
|
|
||||||
|
int windowCount();
|
||||||
|
widgets::Window *windowAt(int index);
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
@@ -39,11 +40,10 @@ public:
|
|||||||
boost::signals2::signal<void()> layout;
|
boost::signals2::signal<void()> layout;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::mutex windowMutex;
|
|
||||||
std::vector<widgets::Window *> windows;
|
std::vector<widgets::Window *> windows;
|
||||||
|
|
||||||
// TODO(pajlada): Store as a value instead of a pointer
|
|
||||||
widgets::Window *mainWindow = nullptr;
|
widgets::Window *mainWindow = nullptr;
|
||||||
|
widgets::Window *selectedWindow = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
Reference in New Issue
Block a user