A lot of changes

Remove unused constructor of messages::Message
Fixed LimitedQueueSnapshot _-prefixes
Changed LimitedQueueSnapshot's usage of int to std::size_t
ColorScheme is no longer a singleton
Created a "BaseWidget" class which is pretty much a QWidget except it
has a reference of ColorScheme since most widgets will need a reference
to the style they should use.
BaseWidget can be implemented either with a BaseWidget parent (which
will copy the ColorScheme reference from the parent) or with a
normal QWidget parent and an explicit ColorScheme reference.
Save main window geometry on close
Fix font changing in the Settings Dialog
Update settings library version
This commit is contained in:
Rasmus Karlsson
2017-06-26 16:41:20 +02:00
parent c2e67e4b90
commit 7df7da70cb
56 changed files with 933 additions and 650 deletions
+26 -2
View File
@@ -1,18 +1,25 @@
#include "application.hpp"
#include "colorscheme.hpp"
#include "logging/loggingmanager.hpp"
#include "settingsmanager.hpp"
namespace chatterino {
// this class is responsible for handling the workflow of Chatterino
// It will create the instances of the major classes, and connect their signals to each other
Application::Application()
: windowManager(this->channelManager)
: windowManager(this->channelManager, this->colorScheme)
, colorScheme(this->windowManager)
, emoteManager(this->windowManager, this->resources)
, resources(this->emoteManager, this->windowManager)
, channelManager(this->windowManager, this->emoteManager, this->ircManager)
, ircManager(this->channelManager, this->resources, this->emoteManager, this->windowManager)
, messageFactory(this->resources, this->emoteManager, this->windowManager)
{
// TODO(pajlada): Get rid of all singletons
ColorScheme::getInstance().init(this->windowManager);
logging::init();
SettingsManager::getInstance().load();
// Initialize everything we need
this->emoteManager.loadGlobalEmotes();
@@ -21,11 +28,28 @@ Application::Application()
SettingsManager::getInstance().updateWordTypeMask();
this->windowManager.load();
this->ircManager.onPrivateMessage.connect([=](Communi::IrcPrivateMessage *message) {
QString channelName = message->target().mid(1);
auto channel = this->channelManager.getChannel(channelName);
if (channel == nullptr) {
// The message doesn't have a channel we listen to
return;
}
messages::MessageParseArgs args;
this->messageFactory.buildMessage(message, *channel.get(), args);
});
}
Application::~Application()
{
this->windowManager.save();
chatterino::SettingsManager::getInstance().save();
}
int Application::run(QApplication &qtApp)