removed namespaces

This commit is contained in:
fourtf
2018-06-26 17:06:17 +02:00
parent 2df0566492
commit 54eb07e116
132 changed files with 805 additions and 823 deletions
@@ -20,10 +20,10 @@ public:
void load();
providers::twitch::TwitchAccountManager twitch;
TwitchAccountManager twitch;
private:
util::SortedSignalVector<std::shared_ptr<Account>, util::SharedPtrElementLess<Account>>
SortedSignalVector<std::shared_ptr<Account>, SharedPtrElementLess<Account>>
accounts;
};
+3 -3
View File
@@ -5,7 +5,7 @@
namespace chatterino {
AccountModel::AccountModel(QObject *parent)
: util::SignalVectorModel<std::shared_ptr<Account>>(1, parent)
: SignalVectorModel<std::shared_ptr<Account>>(1, parent)
{
}
@@ -20,7 +20,7 @@ std::shared_ptr<Account> AccountModel::getItemFromRow(std::vector<QStandardItem
void AccountModel::getRowFromItem(const std::shared_ptr<Account> &item,
std::vector<QStandardItem *> &row)
{
util::setStringItem(row[0], item->toString(), false);
setStringItem(row[0], item->toString(), false);
row[0]->setData(QFont("Segoe UI", 10), Qt::FontRole);
}
@@ -30,7 +30,7 @@ int AccountModel::beforeInsert(const std::shared_ptr<Account> &item,
if (this->categoryCount[item->getCategory()]++ == 0) {
auto row = this->createRow();
util::setStringItem(row[0], item->getCategory(), false, false);
setStringItem(row[0], item->getCategory(), false, false);
row[0]->setData(QFont("Segoe UI Light", 16), Qt::FontRole);
this->insertCustomRow(std::move(row), proposedIndex);
+1 -1
View File
@@ -10,7 +10,7 @@ namespace chatterino {
class AccountController;
class AccountModel : public util::SignalVectorModel<std::shared_ptr<Account>>
class AccountModel : public SignalVectorModel<std::shared_ptr<Account>>
{
public:
AccountModel(QObject *parent);
+17 -22
View File
@@ -23,8 +23,6 @@
"/followersoff" \
}
using namespace chatterino::providers::twitch;
namespace chatterino {
CommandController::CommandController()
@@ -72,8 +70,7 @@ void CommandController::save()
{
QFile textFile(this->filePath);
if (!textFile.open(QIODevice::WriteOnly)) {
debug::Log("[CommandController::saveCommands] Unable to open {} for writing",
this->filePath);
Log("[CommandController::saveCommands] Unable to open {} for writing", this->filePath);
return;
}
@@ -115,17 +112,15 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel,
auto app = getApp();
messages::MessageBuilder b;
MessageBuilder b;
b.emplace<messages::TimestampElement>();
b.emplace<messages::TextElement>(app->accounts->twitch.getCurrent()->getUserName(),
messages::MessageElement::Text,
messages::MessageColor::Text,
FontStyle::ChatMediumBold);
b.emplace<messages::TextElement>("->", messages::MessageElement::Text);
b.emplace<messages::TextElement>(words[1] + ":", messages::MessageElement::Text,
messages::MessageColor::Text,
FontStyle::ChatMediumBold);
b.emplace<TimestampElement>();
b.emplace<TextElement>(app->accounts->twitch.getCurrent()->getUserName(),
MessageElement::Text, MessageColor::Text,
FontStyle::ChatMediumBold);
b.emplace<TextElement>("->", MessageElement::Text);
b.emplace<TextElement>(words[1] + ":", MessageElement::Text, MessageColor::Text,
FontStyle::ChatMediumBold);
QString rest = "";
@@ -133,8 +128,8 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel,
rest += words[i] + " ";
}
b.emplace<messages::TextElement>(rest, messages::MessageElement::Text);
b.getMessage()->flags |= messages::Message::DoNotTriggerNotification;
b.emplace<TextElement>(rest, MessageElement::Text);
b.getMessage()->flags |= Message::DoNotTriggerNotification;
app->twitch.server->whispersChannel->addMessage(b.getMessage());
@@ -157,7 +152,7 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel,
if (commandName == "/debug-args") {
QString msg = QApplication::instance()->arguments().join(' ');
channel->addMessage(messages::Message::createSystemMessage(msg));
channel->addMessage(chatterino::Message::createSystemMessage(msg));
return "";
} else if (commandName == "/uptime") {
@@ -166,7 +161,7 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel,
QString messageText =
streamStatus.live ? streamStatus.uptime : "Channel is not live.";
channel->addMessage(messages::Message::createSystemMessage(messageText));
channel->addMessage(chatterino::Message::createSystemMessage(messageText));
return "";
} else if (commandName == "/ignore" && words.size() >= 2) {
@@ -176,13 +171,13 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel,
auto target = words.at(1);
if (user->isAnon()) {
channel->addMessage(messages::Message::createSystemMessage(
channel->addMessage(chatterino::Message::createSystemMessage(
"You must be logged in to ignore someone"));
return "";
}
user->ignore(target, [channel](auto resultCode, const QString &message) {
channel->addMessage(messages::Message::createSystemMessage(message));
channel->addMessage(chatterino::Message::createSystemMessage(message));
});
return "";
@@ -193,13 +188,13 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel,
auto target = words.at(1);
if (user->isAnon()) {
channel->addMessage(messages::Message::createSystemMessage(
channel->addMessage(chatterino::Message::createSystemMessage(
"You must be logged in to ignore someone"));
return "";
}
user->unignore(target, [channel](auto resultCode, const QString &message) {
channel->addMessage(messages::Message::createSystemMessage(message));
channel->addMessage(chatterino::Message::createSystemMessage(message));
});
return "";
@@ -26,7 +26,7 @@ public:
CommandModel *createModel(QObject *parent);
util::UnsortedSignalVector<Command> items;
UnsortedSignalVector<Command> items;
private:
QMap<QString, Command> commandsMap;
+1 -1
View File
@@ -4,7 +4,7 @@ namespace chatterino {
// commandmodel
CommandModel::CommandModel(QObject *parent)
: util::SignalVectorModel<Command>(2, parent)
: SignalVectorModel<Command>(2, parent)
{
}
+1 -1
View File
@@ -9,7 +9,7 @@ namespace chatterino {
class CommandController;
class CommandModel : public util::SignalVectorModel<Command>
class CommandModel : public SignalVectorModel<Command>
{
explicit CommandModel(QObject *parent);
@@ -32,9 +32,9 @@ HighlightModel *HighlightController::createModel(QObject *parent)
return model;
}
void HighlightController::addHighlight(const messages::MessagePtr &msg)
void HighlightController::addHighlight(const chatterino::MessagePtr &msg)
{
// static widgets::NotificationPopup popup;
// static NotificationPopup popup;
// popup.updatePosition();
// popup.addMessage(msg);
@@ -1,9 +1,9 @@
#pragma once
#include "common/SignalVector2.hpp"
#include "controllers/highlights/HighlightPhrase.hpp"
#include "messages/Message.hpp"
#include "singletons/SettingsManager.hpp"
#include "common/SignalVector2.hpp"
namespace chatterino {
@@ -16,16 +16,16 @@ public:
void initialize();
util::UnsortedSignalVector<HighlightPhrase> phrases;
UnsortedSignalVector<HighlightPhrase> phrases;
HighlightModel *createModel(QObject *parent);
void addHighlight(const messages::MessagePtr &msg);
void addHighlight(const chatterino::MessagePtr &msg);
private:
bool initialized = false;
singletons::ChatterinoSetting<std::vector<highlights::HighlightPhrase>> highlightsSetting = {
chatterino::ChatterinoSetting<std::vector<HighlightPhrase>> highlightsSetting = {
"/highlighting/highlights"};
};
@@ -8,7 +8,7 @@ namespace chatterino {
// commandmodel
HighlightModel::HighlightModel(QObject *parent)
: util::SignalVectorModel<HighlightPhrase>(4, parent)
: SignalVectorModel<HighlightPhrase>(4, parent)
{
}
@@ -26,19 +26,19 @@ HighlightPhrase HighlightModel::getItemFromRow(std::vector<QStandardItem *> &row
// turns a row in the model into a vector item
void HighlightModel::getRowFromItem(const HighlightPhrase &item, std::vector<QStandardItem *> &row)
{
util::setStringItem(row[0], item.getPattern());
util::setBoolItem(row[1], item.getAlert());
util::setBoolItem(row[2], item.getSound());
util::setBoolItem(row[3], item.isRegex());
setStringItem(row[0], item.getPattern());
setBoolItem(row[1], item.getAlert());
setBoolItem(row[2], item.getSound());
setBoolItem(row[3], item.isRegex());
}
void HighlightModel::afterInit()
{
std::vector<QStandardItem *> row = this->createRow();
util::setBoolItem(row[0], getApp()->settings->enableHighlightsSelf.getValue(), true, false);
setBoolItem(row[0], getApp()->settings->enableHighlightsSelf.getValue(), true, false);
row[0]->setData("Your username (automatic)", Qt::DisplayRole);
util::setBoolItem(row[1], getApp()->settings->enableHighlightTaskbar.getValue(), true, false);
util::setBoolItem(row[2], getApp()->settings->enableHighlightSound.getValue(), true, false);
setBoolItem(row[1], getApp()->settings->enableHighlightTaskbar.getValue(), true, false);
setBoolItem(row[2], getApp()->settings->enableHighlightSound.getValue(), true, false);
row[3]->setFlags(0);
this->insertCustomRow(row, 0);
}
@@ -9,7 +9,7 @@ namespace chatterino {
class HighlightController;
class HighlightModel : public util::SignalVectorModel<HighlightPhrase>
class HighlightModel : public SignalVectorModel<HighlightPhrase>
{
explicit HighlightModel(QObject *parent);
@@ -74,8 +74,8 @@ namespace pajlada {
namespace Settings {
template <>
struct Serialize<chatterino::controllers::highlights::HighlightPhrase> {
static rapidjson::Value get(const chatterino::controllers::highlights::HighlightPhrase &value,
struct Serialize<chatterino::HighlightPhrase> {
static rapidjson::Value get(const chatterino::HighlightPhrase &value,
rapidjson::Document::AllocatorType &a)
{
rapidjson::Value ret(rapidjson::kObjectType);
@@ -90,11 +90,11 @@ struct Serialize<chatterino::controllers::highlights::HighlightPhrase> {
};
template <>
struct Deserialize<chatterino::controllers::highlights::HighlightPhrase> {
static chatterino::controllers::highlights::HighlightPhrase get(const rapidjson::Value &value)
struct Deserialize<chatterino::HighlightPhrase> {
static chatterino::HighlightPhrase get(const rapidjson::Value &value)
{
if (!value.IsObject()) {
return chatterino::controllers::highlights::HighlightPhrase(QString(), true, false,
return chatterino::HighlightPhrase(QString(), true, false,
false);
}
@@ -108,7 +108,7 @@ struct Deserialize<chatterino::controllers::highlights::HighlightPhrase> {
chatterino::rj::getSafe(value, "sound", _sound);
chatterino::rj::getSafe(value, "regex", _isRegex);
return chatterino::controllers::highlights::HighlightPhrase(_pattern, _alert, _sound,
return chatterino::HighlightPhrase(_pattern, _alert, _sound,
_isRegex);
}
};
+2 -2
View File
@@ -13,14 +13,14 @@ class IgnoreController
public:
void initialize();
util::UnsortedSignalVector<IgnorePhrase> phrases;
UnsortedSignalVector<IgnorePhrase> phrases;
IgnoreModel *createModel(QObject *parent);
private:
bool initialized = false;
singletons::ChatterinoSetting<std::vector<ignores::IgnorePhrase>> ignoresSetting = {
chatterino::ChatterinoSetting<std::vector<IgnorePhrase>> ignoresSetting = {
"/ignore/phrases"};
};
+3 -3
View File
@@ -8,7 +8,7 @@ namespace chatterino {
// commandmodel
IgnoreModel::IgnoreModel(QObject *parent)
: util::SignalVectorModel<IgnorePhrase>(2, parent)
: SignalVectorModel<IgnorePhrase>(2, parent)
{
}
@@ -25,8 +25,8 @@ IgnorePhrase IgnoreModel::getItemFromRow(std::vector<QStandardItem *> &row,
// turns a row in the model into a vector item
void IgnoreModel::getRowFromItem(const IgnorePhrase &item, std::vector<QStandardItem *> &row)
{
util::setStringItem(row[0], item.getPattern());
util::setBoolItem(row[1], item.isRegex());
setStringItem(row[0], item.getPattern());
setBoolItem(row[1], item.isRegex());
}
} // namespace chatterino
+1 -1
View File
@@ -9,7 +9,7 @@ namespace chatterino {
class IgnoreController;
class IgnoreModel : public util::SignalVectorModel<IgnorePhrase>
class IgnoreModel : public SignalVectorModel<IgnorePhrase>
{
explicit IgnoreModel(QObject *parent);
+6 -6
View File
@@ -57,8 +57,8 @@ namespace pajlada {
namespace Settings {
template <>
struct Serialize<chatterino::controllers::ignores::IgnorePhrase> {
static rapidjson::Value get(const chatterino::controllers::ignores::IgnorePhrase &value,
struct Serialize<chatterino::IgnorePhrase> {
static rapidjson::Value get(const chatterino::IgnorePhrase &value,
rapidjson::Document::AllocatorType &a)
{
rapidjson::Value ret(rapidjson::kObjectType);
@@ -71,11 +71,11 @@ struct Serialize<chatterino::controllers::ignores::IgnorePhrase> {
};
template <>
struct Deserialize<chatterino::controllers::ignores::IgnorePhrase> {
static chatterino::controllers::ignores::IgnorePhrase get(const rapidjson::Value &value)
struct Deserialize<chatterino::IgnorePhrase> {
static chatterino::IgnorePhrase get(const rapidjson::Value &value)
{
if (!value.IsObject()) {
return chatterino::controllers::ignores::IgnorePhrase(QString(), false);
return chatterino::IgnorePhrase(QString(), false);
}
QString _pattern;
@@ -84,7 +84,7 @@ struct Deserialize<chatterino::controllers::ignores::IgnorePhrase> {
chatterino::rj::getSafe(value, "pattern", _pattern);
chatterino::rj::getSafe(value, "regex", _isRegex);
return chatterino::controllers::ignores::IgnorePhrase(_pattern, _isRegex);
return chatterino::IgnorePhrase(_pattern, _isRegex);
}
};
@@ -12,7 +12,7 @@ class TaggedUsersController
public:
TaggedUsersController();
util::SortedSignalVector<TaggedUser, std::less<TaggedUser>> users;
SortedSignalVector<TaggedUser, std::less<TaggedUser>> users;
TaggedUsersModel *createModel(QObject *parent = nullptr);
};
@@ -7,7 +7,7 @@ namespace chatterino {
// commandmodel
TaggedUsersModel::TaggedUsersModel(QObject *parent)
: util::SignalVectorModel<TaggedUser>(1, parent)
: SignalVectorModel<TaggedUser>(1, parent)
{
}
@@ -21,16 +21,16 @@ TaggedUser TaggedUsersModel::getItemFromRow(std::vector<QStandardItem *> &row,
// turns a row in the model into a vector item
void TaggedUsersModel::getRowFromItem(const TaggedUser &item, std::vector<QStandardItem *> &row)
{
util::setStringItem(row[0], item.name);
setStringItem(row[0], item.name);
}
void TaggedUsersModel::afterInit()
{
// std::vector<QStandardItem *> row = this->createRow();
// util::setBoolItem(row[0], getApp()->settings->enableHighlightsSelf.getValue(), true,
// setBoolItem(row[0], getApp()->settings->enableHighlightsSelf.getValue(), true,
// false); row[0]->setData("Your username (automatic)", Qt::DisplayRole);
// util::setBoolItem(row[1], getApp()->settings->enableHighlightTaskbar.getValue(), true,
// false); util::setBoolItem(row[2], getApp()->settings->enableHighlightSound.getValue(),
// setBoolItem(row[1], getApp()->settings->enableHighlightTaskbar.getValue(), true,
// false); setBoolItem(row[2], getApp()->settings->enableHighlightSound.getValue(),
// true, false); row[3]->setFlags(0); this->insertCustomRow(row, 0);
}
@@ -7,7 +7,7 @@ namespace chatterino {
class TaggedUsersController;
class TaggedUsersModel : public util::SignalVectorModel<TaggedUser>
class TaggedUsersModel : public SignalVectorModel<TaggedUser>
{
explicit TaggedUsersModel(QObject *parent);