removed namespaces
This commit is contained in:
@@ -17,10 +17,10 @@ public:
|
||||
|
||||
void initialize();
|
||||
|
||||
providers::twitch::TwitchEmotes twitch;
|
||||
providers::bttv::BTTVEmotes bttv;
|
||||
providers::ffz::FFZEmotes ffz;
|
||||
providers::emoji::Emojis emojis;
|
||||
TwitchEmotes twitch;
|
||||
BTTVEmotes bttv;
|
||||
FFZEmotes ffz;
|
||||
Emojis emojis;
|
||||
|
||||
GIFTimer gifTimer;
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ FontManager::FontManager()
|
||||
qDebug() << "init FontManager";
|
||||
|
||||
this->chatFontFamily.connect([this](const std::string &, auto) {
|
||||
util::assertInGuiThread();
|
||||
assertInGuiThread();
|
||||
|
||||
if (getApp()->windows) {
|
||||
getApp()->windows->incGeneration();
|
||||
@@ -42,7 +42,7 @@ FontManager::FontManager()
|
||||
});
|
||||
|
||||
this->chatFontSize.connect([this](const int &, auto) {
|
||||
util::assertInGuiThread();
|
||||
assertInGuiThread();
|
||||
|
||||
if (getApp()->windows) {
|
||||
getApp()->windows->incGeneration();
|
||||
@@ -69,7 +69,7 @@ QFontMetrics FontManager::getFontMetrics(FontManager::Type type, float scale)
|
||||
|
||||
FontManager::FontData &FontManager::getOrCreateFontData(Type type, float scale)
|
||||
{
|
||||
util::assertInGuiThread();
|
||||
assertInGuiThread();
|
||||
|
||||
assert(type >= 0 && type < EndType);
|
||||
|
||||
|
||||
@@ -77,6 +77,6 @@ private:
|
||||
std::vector<std::unordered_map<float, FontData>> fontsByType;
|
||||
};
|
||||
|
||||
using FontStyle = singletons::FontManager::Type;
|
||||
using FontStyle = chatterino::FontManager::Type;
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -17,7 +17,7 @@ void LoggingManager::initialize()
|
||||
this->pathManager = getApp()->paths;
|
||||
}
|
||||
|
||||
void LoggingManager::addMessage(const QString &channelName, messages::MessagePtr message)
|
||||
void LoggingManager::addMessage(const QString &channelName, chatterino::MessagePtr message)
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
|
||||
void initialize();
|
||||
|
||||
void addMessage(const QString &channelName, messages::MessagePtr message);
|
||||
void addMessage(const QString &channelName, chatterino::MessagePtr message);
|
||||
|
||||
private:
|
||||
std::map<QString, std::unique_ptr<LoggingChannel>> loggingChannels;
|
||||
|
||||
@@ -176,7 +176,7 @@ void NativeMessagingManager::ReceiverThread::handleMessage(const QJsonObject &ro
|
||||
qDebug() << attach;
|
||||
|
||||
#ifdef USEWINSDK
|
||||
widgets::AttachedWindow::GetArgs args;
|
||||
AttachedWindow::GetArgs args;
|
||||
args.winId = root.value("winId").toString();
|
||||
args.yOffset = root.value("yOffset").toInt(-1);
|
||||
args.width = root.value("size").toObject().value("width").toInt(-1);
|
||||
@@ -190,7 +190,7 @@ void NativeMessagingManager::ReceiverThread::handleMessage(const QJsonObject &ro
|
||||
#endif
|
||||
|
||||
if (_type == "twitch") {
|
||||
util::postToThread([=] {
|
||||
postToThread([=] {
|
||||
if (!name.isEmpty()) {
|
||||
app->twitch.server->watchingChannel.update(
|
||||
app->twitch.server->getOrAddChannel(name));
|
||||
@@ -199,7 +199,7 @@ void NativeMessagingManager::ReceiverThread::handleMessage(const QJsonObject &ro
|
||||
if (attach) {
|
||||
#ifdef USEWINSDK
|
||||
// if (args.height != -1) {
|
||||
auto *window = widgets::AttachedWindow::get(::GetForegroundWindow(), args);
|
||||
auto *window = AttachedWindow::get(::GetForegroundWindow(), args);
|
||||
if (!name.isEmpty()) {
|
||||
window->setChannel(app->twitch.server->getOrAddChannel(name));
|
||||
}
|
||||
@@ -221,9 +221,9 @@ void NativeMessagingManager::ReceiverThread::handleMessage(const QJsonObject &ro
|
||||
}
|
||||
|
||||
#ifdef USEWINSDK
|
||||
util::postToThread([winId] {
|
||||
postToThread([winId] {
|
||||
qDebug() << "NW detach";
|
||||
widgets::AttachedWindow::detach(winId);
|
||||
AttachedWindow::detach(winId);
|
||||
});
|
||||
#endif
|
||||
} else {
|
||||
@@ -235,7 +235,7 @@ std::string &NativeMessagingManager::getGuiMessageQueueName()
|
||||
{
|
||||
static std::string name =
|
||||
"chatterino_gui" +
|
||||
singletons::PathManager::getInstance()->applicationFilePathHash.toStdString();
|
||||
chatterino::PathManager::getInstance()->applicationFilePathHash.toStdString();
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ void PathManager::initAppFilePathHash()
|
||||
void PathManager::initCheckPortable()
|
||||
{
|
||||
this->portable =
|
||||
QFileInfo::exists(util::combinePath(QCoreApplication::applicationDirPath(), "portable"));
|
||||
QFileInfo::exists(combinePath(QCoreApplication::applicationDirPath(), "portable"));
|
||||
}
|
||||
|
||||
void PathManager::initAppDataDirectory()
|
||||
@@ -99,7 +99,7 @@ void PathManager::initSubDirectories()
|
||||
// create settings subdirectories and validate that they are created properly
|
||||
auto makePath = [&](const std::string &name) -> QString {
|
||||
|
||||
auto path = util::combinePath(this->rootAppDataDirectory, QString::fromStdString(name));
|
||||
auto path = combinePath(this->rootAppDataDirectory, QString::fromStdString(name));
|
||||
|
||||
if (!QDir().mkpath(path)) {
|
||||
throw std::runtime_error("Error creating appdata path %appdata%/chatterino/" + name);
|
||||
|
||||
@@ -8,9 +8,9 @@ namespace chatterino {
|
||||
|
||||
namespace {
|
||||
|
||||
inline messages::Image *lli(const char *pixmapPath, qreal scale = 1)
|
||||
inline chatterino::Image *lli(const char *pixmapPath, qreal scale = 1)
|
||||
{
|
||||
return new messages::Image(new QPixmap(pixmapPath), scale);
|
||||
return new chatterino::Image(new QPixmap(pixmapPath), scale);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
@@ -221,7 +221,7 @@ inline bool ParseSingleCheermoteSet(ResourceManager::JSONCheermoteSet &set,
|
||||
|
||||
qreal chatterinoScale = 1 / scaleNumber;
|
||||
|
||||
auto image = new messages::Image(url, chatterinoScale);
|
||||
auto image = new chatterino::Image(url, chatterinoScale);
|
||||
|
||||
// TODO(pajlada): Fill in name and tooltip
|
||||
tier.images[background][state][scale] = image;
|
||||
@@ -310,9 +310,9 @@ void ResourceManager::initialize()
|
||||
}
|
||||
|
||||
ResourceManager::BadgeVersion::BadgeVersion(QJsonObject &&root)
|
||||
: badgeImage1x(new messages::Image(root.value("image_url_1x").toString()))
|
||||
, badgeImage2x(new messages::Image(root.value("image_url_2x").toString()))
|
||||
, badgeImage4x(new messages::Image(root.value("image_url_4x").toString()))
|
||||
: badgeImage1x(new chatterino::Image(root.value("image_url_1x").toString()))
|
||||
, badgeImage2x(new chatterino::Image(root.value("image_url_2x").toString()))
|
||||
, badgeImage4x(new chatterino::Image(root.value("image_url_4x").toString()))
|
||||
, description(root.value("description").toString().toStdString())
|
||||
, title(root.value("title").toString().toStdString())
|
||||
, clickAction(root.value("clickAction").toString().toStdString())
|
||||
@@ -324,7 +324,7 @@ void ResourceManager::loadChannelData(const QString &roomID, bool bypassCache)
|
||||
{
|
||||
QString url = "https://badges.twitch.tv/v1/badges/channels/" + roomID + "/display?language=en";
|
||||
|
||||
util::NetworkRequest req(url);
|
||||
NetworkRequest req(url);
|
||||
req.setCaller(QThread::currentThread());
|
||||
|
||||
req.getJSON([this, roomID](QJsonObject &root) {
|
||||
@@ -352,52 +352,52 @@ void ResourceManager::loadChannelData(const QString &roomID, bool bypassCache)
|
||||
|
||||
QString cheermoteURL = "https://api.twitch.tv/kraken/bits/actions?channel_id=" + roomID;
|
||||
|
||||
util::twitch::get2(
|
||||
cheermoteURL, QThread::currentThread(), true, [this, roomID](const rapidjson::Document &d) {
|
||||
ResourceManager::Channel &ch = this->channels[roomID];
|
||||
get2(cheermoteURL, QThread::currentThread(), true,
|
||||
[this, roomID](const rapidjson::Document &d) {
|
||||
ResourceManager::Channel &ch = this->channels[roomID];
|
||||
|
||||
ParseCheermoteSets(ch.jsonCheermoteSets, d);
|
||||
ParseCheermoteSets(ch.jsonCheermoteSets, d);
|
||||
|
||||
for (auto &set : ch.jsonCheermoteSets) {
|
||||
CheermoteSet cheermoteSet;
|
||||
cheermoteSet.regex =
|
||||
QRegularExpression("^" + set.prefix.toLower() + "([1-9][0-9]*)$");
|
||||
for (auto &set : ch.jsonCheermoteSets) {
|
||||
CheermoteSet cheermoteSet;
|
||||
cheermoteSet.regex =
|
||||
QRegularExpression("^" + set.prefix.toLower() + "([1-9][0-9]*)$");
|
||||
|
||||
for (auto &tier : set.tiers) {
|
||||
Cheermote cheermote;
|
||||
for (auto &tier : set.tiers) {
|
||||
Cheermote cheermote;
|
||||
|
||||
cheermote.color = QColor(tier.color);
|
||||
cheermote.minBits = tier.minBits;
|
||||
cheermote.color = QColor(tier.color);
|
||||
cheermote.minBits = tier.minBits;
|
||||
|
||||
// TODO(pajlada): We currently hardcode dark here :|
|
||||
// We will continue to do so for now since we haven't had to
|
||||
// solve that anywhere else
|
||||
cheermote.emoteDataAnimated.image1x = tier.images["dark"]["animated"]["1"];
|
||||
cheermote.emoteDataAnimated.image2x = tier.images["dark"]["animated"]["2"];
|
||||
cheermote.emoteDataAnimated.image3x = tier.images["dark"]["animated"]["4"];
|
||||
// TODO(pajlada): We currently hardcode dark here :|
|
||||
// We will continue to do so for now since we haven't had to
|
||||
// solve that anywhere else
|
||||
cheermote.emoteDataAnimated.image1x = tier.images["dark"]["animated"]["1"];
|
||||
cheermote.emoteDataAnimated.image2x = tier.images["dark"]["animated"]["2"];
|
||||
cheermote.emoteDataAnimated.image3x = tier.images["dark"]["animated"]["4"];
|
||||
|
||||
cheermote.emoteDataStatic.image1x = tier.images["dark"]["static"]["1"];
|
||||
cheermote.emoteDataStatic.image2x = tier.images["dark"]["static"]["2"];
|
||||
cheermote.emoteDataStatic.image3x = tier.images["dark"]["static"]["4"];
|
||||
cheermote.emoteDataStatic.image1x = tier.images["dark"]["static"]["1"];
|
||||
cheermote.emoteDataStatic.image2x = tier.images["dark"]["static"]["2"];
|
||||
cheermote.emoteDataStatic.image3x = tier.images["dark"]["static"]["4"];
|
||||
|
||||
cheermoteSet.cheermotes.emplace_back(cheermote);
|
||||
}
|
||||
cheermoteSet.cheermotes.emplace_back(cheermote);
|
||||
}
|
||||
|
||||
std::sort(cheermoteSet.cheermotes.begin(), cheermoteSet.cheermotes.end(),
|
||||
[](const auto &lhs, const auto &rhs) {
|
||||
return lhs.minBits < rhs.minBits; //
|
||||
});
|
||||
std::sort(cheermoteSet.cheermotes.begin(), cheermoteSet.cheermotes.end(),
|
||||
[](const auto &lhs, const auto &rhs) {
|
||||
return lhs.minBits < rhs.minBits; //
|
||||
});
|
||||
|
||||
ch.cheermoteSets.emplace_back(cheermoteSet);
|
||||
}
|
||||
});
|
||||
ch.cheermoteSets.emplace_back(cheermoteSet);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void ResourceManager::loadDynamicTwitchBadges()
|
||||
{
|
||||
static QString url("https://badges.twitch.tv/v1/badges/global/display?language=en");
|
||||
|
||||
util::NetworkRequest req(url);
|
||||
NetworkRequest req(url);
|
||||
req.setCaller(QThread::currentThread());
|
||||
req.getJSON([this](QJsonObject &root) {
|
||||
QJsonObject sets = root.value("badge_sets").toObject();
|
||||
@@ -426,7 +426,7 @@ void ResourceManager::loadChatterinoBadges()
|
||||
|
||||
static QString url("https://fourtf.com/chatterino/badges.json");
|
||||
|
||||
util::NetworkRequest req(url);
|
||||
NetworkRequest req(url);
|
||||
req.setCaller(QThread::currentThread());
|
||||
|
||||
req.getJSON([this](QJsonObject &root) {
|
||||
@@ -438,7 +438,7 @@ void ResourceManager::loadChatterinoBadges()
|
||||
const QString &badgeVariantImageURL = badgeVariant.value("image").toString();
|
||||
|
||||
auto badgeVariantPtr = std::make_shared<ChatterinoBadge>(
|
||||
badgeVariantTooltip, new messages::Image(badgeVariantImageURL));
|
||||
badgeVariantTooltip, new chatterino::Image(badgeVariantImageURL));
|
||||
|
||||
QJsonArray badgeVariantUsers = badgeVariant.value("users").toArray();
|
||||
|
||||
|
||||
@@ -35,39 +35,39 @@ public:
|
||||
QPixmap unmod;
|
||||
} buttons;
|
||||
|
||||
messages::Image *badgeStaff;
|
||||
messages::Image *badgeAdmin;
|
||||
messages::Image *badgeGlobalModerator;
|
||||
messages::Image *badgeModerator;
|
||||
messages::Image *badgeTurbo;
|
||||
messages::Image *badgeBroadcaster;
|
||||
messages::Image *badgePremium;
|
||||
messages::Image *badgeVerified;
|
||||
messages::Image *badgeSubscriber;
|
||||
messages::Image *badgeCollapsed;
|
||||
chatterino::Image *badgeStaff;
|
||||
chatterino::Image *badgeAdmin;
|
||||
chatterino::Image *badgeGlobalModerator;
|
||||
chatterino::Image *badgeModerator;
|
||||
chatterino::Image *badgeTurbo;
|
||||
chatterino::Image *badgeBroadcaster;
|
||||
chatterino::Image *badgePremium;
|
||||
chatterino::Image *badgeVerified;
|
||||
chatterino::Image *badgeSubscriber;
|
||||
chatterino::Image *badgeCollapsed;
|
||||
|
||||
messages::Image *cheerBadge100000;
|
||||
messages::Image *cheerBadge10000;
|
||||
messages::Image *cheerBadge5000;
|
||||
messages::Image *cheerBadge1000;
|
||||
messages::Image *cheerBadge100;
|
||||
messages::Image *cheerBadge1;
|
||||
chatterino::Image *cheerBadge100000;
|
||||
chatterino::Image *cheerBadge10000;
|
||||
chatterino::Image *cheerBadge5000;
|
||||
chatterino::Image *cheerBadge1000;
|
||||
chatterino::Image *cheerBadge100;
|
||||
chatterino::Image *cheerBadge1;
|
||||
|
||||
messages::Image *moderationmode_enabled;
|
||||
messages::Image *moderationmode_disabled;
|
||||
chatterino::Image *moderationmode_enabled;
|
||||
chatterino::Image *moderationmode_disabled;
|
||||
|
||||
messages::Image *splitHeaderContext;
|
||||
chatterino::Image *splitHeaderContext;
|
||||
|
||||
std::map<std::string, messages::Image *> cheerBadges;
|
||||
std::map<std::string, chatterino::Image *> cheerBadges;
|
||||
|
||||
struct BadgeVersion {
|
||||
BadgeVersion() = delete;
|
||||
|
||||
explicit BadgeVersion(QJsonObject &&root);
|
||||
|
||||
messages::Image *badgeImage1x;
|
||||
messages::Image *badgeImage2x;
|
||||
messages::Image *badgeImage4x;
|
||||
chatterino::Image *badgeImage1x;
|
||||
chatterino::Image *badgeImage2x;
|
||||
chatterino::Image *badgeImage4x;
|
||||
std::string description;
|
||||
std::string title;
|
||||
std::string clickAction;
|
||||
@@ -82,8 +82,8 @@ public:
|
||||
|
||||
bool dynamicBadgesLoaded = false;
|
||||
|
||||
messages::Image *buttonBan;
|
||||
messages::Image *buttonTimeout;
|
||||
chatterino::Image *buttonBan;
|
||||
chatterino::Image *buttonTimeout;
|
||||
|
||||
struct JSONCheermoteSet {
|
||||
QString prefix;
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
QString color;
|
||||
|
||||
// Background State Scale
|
||||
std::map<QString, std::map<QString, std::map<QString, messages::Image *>>> images;
|
||||
std::map<QString, std::map<QString, std::map<QString, chatterino::Image *>>> images;
|
||||
};
|
||||
|
||||
std::vector<CheermoteTier> tiers;
|
||||
@@ -113,8 +113,8 @@ public:
|
||||
QColor color;
|
||||
int minBits;
|
||||
|
||||
util::EmoteData emoteDataAnimated;
|
||||
util::EmoteData emoteDataStatic;
|
||||
EmoteData emoteDataAnimated;
|
||||
EmoteData emoteDataStatic;
|
||||
};
|
||||
|
||||
struct CheermoteSet {
|
||||
@@ -135,14 +135,14 @@ public:
|
||||
|
||||
// Chatterino badges
|
||||
struct ChatterinoBadge {
|
||||
ChatterinoBadge(const std::string &_tooltip, messages::Image *_image)
|
||||
ChatterinoBadge(const std::string &_tooltip, chatterino::Image *_image)
|
||||
: tooltip(_tooltip)
|
||||
, image(_image)
|
||||
{
|
||||
}
|
||||
|
||||
std::string tooltip;
|
||||
messages::Image *image;
|
||||
chatterino::Image *image;
|
||||
};
|
||||
|
||||
// username
|
||||
|
||||
@@ -122,7 +122,7 @@ void SettingManager::saveSnapshot()
|
||||
|
||||
this->snapshot.reset(d);
|
||||
|
||||
debug::Log("hehe: {}", pajlada::Settings::SettingManager::stringify(*d));
|
||||
Log("hehe: {}", pajlada::Settings::SettingManager::stringify(*d));
|
||||
}
|
||||
|
||||
void SettingManager::recallSnapshot()
|
||||
@@ -136,14 +136,14 @@ void SettingManager::recallSnapshot()
|
||||
for (const auto &weakSetting : _settings) {
|
||||
auto setting = weakSetting.lock();
|
||||
if (!setting) {
|
||||
debug::Log("Error stage 1 of loading");
|
||||
Log("Error stage 1 of loading");
|
||||
continue;
|
||||
}
|
||||
|
||||
const char *path = setting->getPath().c_str();
|
||||
|
||||
if (!snapshotObject.HasMember(path)) {
|
||||
debug::Log("Error stage 2 of loading");
|
||||
Log("Error stage 2 of loading");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
|
||||
~SettingManager() = delete;
|
||||
|
||||
messages::MessageElement::Flags getWordFlags();
|
||||
chatterino::MessageElement::Flags getWordFlags();
|
||||
bool isIgnoredEmote(const QString &emote);
|
||||
|
||||
void initialize();
|
||||
@@ -142,7 +142,7 @@ private:
|
||||
|
||||
void updateModerationActions();
|
||||
|
||||
messages::MessageElement::Flags wordFlags = messages::MessageElement::Default;
|
||||
chatterino::MessageElement::Flags wordFlags = chatterino::MessageElement::Default;
|
||||
|
||||
pajlada::Settings::SettingListener wordFlagsListener;
|
||||
};
|
||||
|
||||
@@ -49,12 +49,12 @@ void UpdateManager::installUpdates()
|
||||
box->setAttribute(Qt::WA_DeleteOnClose);
|
||||
box->show();
|
||||
|
||||
util::NetworkRequest req(this->updateUrl_);
|
||||
NetworkRequest req(this->updateUrl_);
|
||||
req.setTimeout(600000);
|
||||
req.onError([this](int) -> bool {
|
||||
this->setStatus_(DownloadFailed);
|
||||
|
||||
util::postToThread([] {
|
||||
postToThread([] {
|
||||
QMessageBox *box = new QMessageBox(QMessageBox::Information, "Chatterino Update",
|
||||
"Failed while trying to download the update.");
|
||||
box->setAttribute(Qt::WA_DeleteOnClose);
|
||||
@@ -65,7 +65,7 @@ void UpdateManager::installUpdates()
|
||||
return true;
|
||||
});
|
||||
req.get([this](QByteArray &object) {
|
||||
auto filename = util::combinePath(getApp()->paths->miscDirectory, "update.zip");
|
||||
auto filename = combinePath(getApp()->paths->miscDirectory, "update.zip");
|
||||
|
||||
QFile file(filename);
|
||||
file.open(QIODevice::Truncate | QIODevice::WriteOnly);
|
||||
@@ -75,7 +75,7 @@ void UpdateManager::installUpdates()
|
||||
return false;
|
||||
}
|
||||
|
||||
QProcess::startDetached(util::combinePath(QCoreApplication::applicationDirPath(),
|
||||
QProcess::startDetached(combinePath(QCoreApplication::applicationDirPath(),
|
||||
"updater.1/ChatterinoUpdater.exe"),
|
||||
{filename, "restart"});
|
||||
|
||||
@@ -92,7 +92,7 @@ void UpdateManager::checkForUpdates()
|
||||
#ifdef Q_OS_WIN
|
||||
QString url = "https://notitia.chatterino.com/version/chatterino/" CHATTERINO_OS "/stable";
|
||||
|
||||
util::NetworkRequest req(url);
|
||||
NetworkRequest req(url);
|
||||
req.setTimeout(30000);
|
||||
req.getJSON([this](QJsonObject &object) {
|
||||
QJsonValue version_val = object.value("version");
|
||||
@@ -102,7 +102,7 @@ void UpdateManager::checkForUpdates()
|
||||
this->setStatus_(SearchFailed);
|
||||
qDebug() << "error updating";
|
||||
|
||||
util::postToThread([] {
|
||||
postToThread([] {
|
||||
QMessageBox *box = new QMessageBox(
|
||||
QMessageBox::Information, "Chatterino Update",
|
||||
"Error while searching for updates.\n\nEither the service is down "
|
||||
@@ -119,7 +119,7 @@ void UpdateManager::checkForUpdates()
|
||||
|
||||
if (this->currentVersion_ != this->onlineVersion_) {
|
||||
this->setStatus_(UpdateAvailable);
|
||||
util::postToThread([this] {
|
||||
postToThread([this] {
|
||||
QMessageBox *box =
|
||||
new QMessageBox(QMessageBox::Information, "Chatterino Update",
|
||||
"An update for chatterino is available.\n\nDo you "
|
||||
@@ -150,7 +150,7 @@ void UpdateManager::setStatus_(UpdateStatus status)
|
||||
{
|
||||
if (this->status_ != status) {
|
||||
this->status_ = status;
|
||||
util::postToThread([this, status] { this->statusUpdated.invoke(status); });
|
||||
postToThread([this, status] { this->statusUpdated.invoke(status); });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,21 +21,21 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
using SplitNode = widgets::SplitContainer::Node;
|
||||
using SplitDirection = widgets::SplitContainer::Direction;
|
||||
using SplitNode = SplitContainer::Node;
|
||||
using SplitDirection = SplitContainer::Direction;
|
||||
|
||||
const int WindowManager::uiScaleMin = -5;
|
||||
const int WindowManager::uiScaleMax = 10;
|
||||
|
||||
void WindowManager::showSettingsDialog()
|
||||
{
|
||||
QTimer::singleShot(80, [] { widgets::SettingsDialog::showDialog(); });
|
||||
QTimer::singleShot(80, [] { SettingsDialog::showDialog(); });
|
||||
}
|
||||
|
||||
void WindowManager::showAccountSelectPopup(QPoint point)
|
||||
{
|
||||
// static QWidget *lastFocusedWidget = nullptr;
|
||||
static widgets::AccountSwitchPopupWidget *w = new widgets::AccountSwitchPopupWidget();
|
||||
static AccountSwitchPopupWidget *w = new AccountSwitchPopupWidget();
|
||||
|
||||
if (w->hasFocus()) {
|
||||
w->hide();
|
||||
@@ -91,29 +91,29 @@ void WindowManager::repaintGifEmotes()
|
||||
// }
|
||||
//}
|
||||
|
||||
widgets::Window &WindowManager::getMainWindow()
|
||||
Window &WindowManager::getMainWindow()
|
||||
{
|
||||
util::assertInGuiThread();
|
||||
assertInGuiThread();
|
||||
|
||||
return *this->mainWindow;
|
||||
}
|
||||
|
||||
widgets::Window &WindowManager::getSelectedWindow()
|
||||
Window &WindowManager::getSelectedWindow()
|
||||
{
|
||||
util::assertInGuiThread();
|
||||
assertInGuiThread();
|
||||
|
||||
return *this->selectedWindow;
|
||||
}
|
||||
|
||||
widgets::Window &WindowManager::createWindow(widgets::Window::WindowType type)
|
||||
Window &WindowManager::createWindow(Window::WindowType type)
|
||||
{
|
||||
util::assertInGuiThread();
|
||||
assertInGuiThread();
|
||||
|
||||
auto *window = new widgets::Window(type);
|
||||
auto *window = new Window(type);
|
||||
this->windows.push_back(window);
|
||||
window->show();
|
||||
|
||||
if (type != widgets::Window::Main) {
|
||||
if (type != Window::Main) {
|
||||
window->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
QObject::connect(window, &QWidget::destroyed, [this, window] {
|
||||
@@ -134,21 +134,21 @@ int WindowManager::windowCount()
|
||||
return this->windows.size();
|
||||
}
|
||||
|
||||
widgets::Window *WindowManager::windowAt(int index)
|
||||
Window *WindowManager::windowAt(int index)
|
||||
{
|
||||
util::assertInGuiThread();
|
||||
assertInGuiThread();
|
||||
|
||||
if (index < 0 || (size_t)index >= this->windows.size()) {
|
||||
return nullptr;
|
||||
}
|
||||
debug::Log("getting window at bad index {}", index);
|
||||
Log("getting window at bad index {}", index);
|
||||
|
||||
return this->windows.at(index);
|
||||
}
|
||||
|
||||
void WindowManager::initialize()
|
||||
{
|
||||
util::assertInGuiThread();
|
||||
assertInGuiThread();
|
||||
|
||||
auto app = getApp();
|
||||
app->themes->repaintVisibleChatWidgets.connect([this] { this->repaintVisibleChatWidgets(); });
|
||||
@@ -169,16 +169,16 @@ void WindowManager::initialize()
|
||||
|
||||
// get type
|
||||
QString type_val = window_obj.value("type").toString();
|
||||
widgets::Window::WindowType type =
|
||||
type_val == "main" ? widgets::Window::Main : widgets::Window::Popup;
|
||||
Window::WindowType type =
|
||||
type_val == "main" ? Window::Main : Window::Popup;
|
||||
|
||||
if (type == widgets::Window::Main && mainWindow != nullptr) {
|
||||
type = widgets::Window::Popup;
|
||||
if (type == Window::Main && mainWindow != nullptr) {
|
||||
type = Window::Popup;
|
||||
}
|
||||
|
||||
widgets::Window &window = createWindow(type);
|
||||
Window &window = createWindow(type);
|
||||
|
||||
if (type == widgets::Window::Main) {
|
||||
if (type == Window::Main) {
|
||||
mainWindow = &window;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ void WindowManager::initialize()
|
||||
// load tabs
|
||||
QJsonArray tabs = window_obj.value("tabs").toArray();
|
||||
for (QJsonValue tab_val : tabs) {
|
||||
widgets::SplitContainer *page = window.getNotebook().addPage(false);
|
||||
SplitContainer *page = window.getNotebook().addPage(false);
|
||||
|
||||
QJsonObject tab_obj = tab_val.toObject();
|
||||
|
||||
@@ -225,7 +225,7 @@ void WindowManager::initialize()
|
||||
int colNr = 0;
|
||||
for (QJsonValue column_val : tab_obj.value("splits").toArray()) {
|
||||
for (QJsonValue split_val : column_val.toArray()) {
|
||||
widgets::Split *split = new widgets::Split(page);
|
||||
Split *split = new Split(page);
|
||||
|
||||
QJsonObject split_obj = split_val.toObject();
|
||||
split->setChannel(decodeChannel(split_obj));
|
||||
@@ -238,7 +238,7 @@ void WindowManager::initialize()
|
||||
}
|
||||
|
||||
if (mainWindow == nullptr) {
|
||||
mainWindow = &createWindow(widgets::Window::Main);
|
||||
mainWindow = &createWindow(Window::Main);
|
||||
mainWindow->getNotebook().addPage(true);
|
||||
}
|
||||
|
||||
@@ -247,22 +247,22 @@ void WindowManager::initialize()
|
||||
|
||||
void WindowManager::save()
|
||||
{
|
||||
util::assertInGuiThread();
|
||||
assertInGuiThread();
|
||||
auto app = getApp();
|
||||
|
||||
QJsonDocument document;
|
||||
|
||||
// "serialize"
|
||||
QJsonArray window_arr;
|
||||
for (widgets::Window *window : this->windows) {
|
||||
for (Window *window : this->windows) {
|
||||
QJsonObject window_obj;
|
||||
|
||||
// window type
|
||||
switch (window->getType()) {
|
||||
case widgets::Window::Main:
|
||||
case Window::Main:
|
||||
window_obj.insert("type", "main");
|
||||
break;
|
||||
case widgets::Window::Popup:
|
||||
case Window::Popup:
|
||||
window_obj.insert("type", "popup");
|
||||
break;
|
||||
}
|
||||
@@ -278,8 +278,8 @@ void WindowManager::save()
|
||||
|
||||
for (int tab_i = 0; tab_i < window->getNotebook().getPageCount(); tab_i++) {
|
||||
QJsonObject tab_obj;
|
||||
widgets::SplitContainer *tab =
|
||||
dynamic_cast<widgets::SplitContainer *>(window->getNotebook().getPageAt(tab_i));
|
||||
SplitContainer *tab =
|
||||
dynamic_cast<SplitContainer *>(window->getNotebook().getPageAt(tab_i));
|
||||
assert(tab != nullptr);
|
||||
|
||||
// custom tab title
|
||||
@@ -355,7 +355,7 @@ void WindowManager::encodeNodeRecusively(SplitNode *node, QJsonObject &obj)
|
||||
|
||||
void WindowManager::encodeChannel(IndirectChannel channel, QJsonObject &obj)
|
||||
{
|
||||
util::assertInGuiThread();
|
||||
assertInGuiThread();
|
||||
|
||||
switch (channel.getType()) {
|
||||
case Channel::Twitch: {
|
||||
@@ -376,7 +376,7 @@ void WindowManager::encodeChannel(IndirectChannel channel, QJsonObject &obj)
|
||||
|
||||
IndirectChannel WindowManager::decodeChannel(const QJsonObject &obj)
|
||||
{
|
||||
util::assertInGuiThread();
|
||||
assertInGuiThread();
|
||||
|
||||
auto app = getApp();
|
||||
|
||||
@@ -396,9 +396,9 @@ IndirectChannel WindowManager::decodeChannel(const QJsonObject &obj)
|
||||
|
||||
void WindowManager::closeAll()
|
||||
{
|
||||
util::assertInGuiThread();
|
||||
assertInGuiThread();
|
||||
|
||||
for (widgets::Window *window : windows) {
|
||||
for (Window *window : windows) {
|
||||
window->close();
|
||||
}
|
||||
}
|
||||
@@ -415,7 +415,7 @@ void WindowManager::incGeneration()
|
||||
|
||||
int WindowManager::clampUiScale(int scale)
|
||||
{
|
||||
return util::clamp(scale, uiScaleMin, uiScaleMax);
|
||||
return clamp(scale, uiScaleMin, uiScaleMax);
|
||||
}
|
||||
|
||||
float WindowManager::getUiScaleValue()
|
||||
|
||||
@@ -21,12 +21,12 @@ public:
|
||||
void repaintGifEmotes();
|
||||
// void updateAll();
|
||||
|
||||
widgets::Window &getMainWindow();
|
||||
widgets::Window &getSelectedWindow();
|
||||
widgets::Window &createWindow(widgets::Window::WindowType type);
|
||||
Window &getMainWindow();
|
||||
Window &getSelectedWindow();
|
||||
Window &createWindow(Window::WindowType type);
|
||||
|
||||
int windowCount();
|
||||
widgets::Window *windowAt(int index);
|
||||
Window *windowAt(int index);
|
||||
|
||||
void save();
|
||||
void initialize();
|
||||
@@ -49,12 +49,12 @@ private:
|
||||
|
||||
std::atomic<int> generation{0};
|
||||
|
||||
std::vector<widgets::Window *> windows;
|
||||
std::vector<Window *> windows;
|
||||
|
||||
widgets::Window *mainWindow = nullptr;
|
||||
widgets::Window *selectedWindow = nullptr;
|
||||
Window *mainWindow = nullptr;
|
||||
Window *selectedWindow = nullptr;
|
||||
|
||||
void encodeNodeRecusively(widgets::SplitContainer::Node *node, QJsonObject &obj);
|
||||
void encodeNodeRecusively(SplitContainer::Node *node, QJsonObject &obj);
|
||||
|
||||
public:
|
||||
static void encodeChannel(IndirectChannel channel, QJsonObject &obj);
|
||||
|
||||
@@ -63,13 +63,13 @@ void LoggingChannel::openLogFile()
|
||||
QString directory = this->baseDirectory + QDir::separator() + this->subDirectory;
|
||||
|
||||
if (!QDir().mkpath(directory)) {
|
||||
debug::Log("Unable to create logging path");
|
||||
Log("Unable to create logging path");
|
||||
return;
|
||||
}
|
||||
|
||||
// Open file handle to log file of current date
|
||||
QString fileName = directory + QDir::separator() + baseFileName;
|
||||
debug::Log("Logging to {}", fileName);
|
||||
Log("Logging to {}", fileName);
|
||||
this->fileHandle.setFileName(fileName);
|
||||
|
||||
this->fileHandle.open(QIODevice::Append);
|
||||
@@ -77,7 +77,7 @@ void LoggingChannel::openLogFile()
|
||||
this->appendLine(this->generateOpeningString(now));
|
||||
}
|
||||
|
||||
void LoggingChannel::addMessage(std::shared_ptr<messages::Message> message)
|
||||
void LoggingChannel::addMessage(std::shared_ptr<chatterino::Message> message)
|
||||
{
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class LoggingChannel : boost::noncopyable
|
||||
|
||||
public:
|
||||
~LoggingChannel();
|
||||
void addMessage(std::shared_ptr<messages::Message> message);
|
||||
void addMessage(std::shared_ptr<chatterino::Message> message);
|
||||
|
||||
private:
|
||||
void openLogFile();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
ModerationAction::ModerationAction(messages::Image *_image, const QString &_action)
|
||||
ModerationAction::ModerationAction(chatterino::Image *_image, const QString &_action)
|
||||
: _isImage(true)
|
||||
, image(_image)
|
||||
, action(_action)
|
||||
@@ -26,7 +26,7 @@ bool ModerationAction::isImage() const
|
||||
return this->_isImage;
|
||||
}
|
||||
|
||||
messages::Image *ModerationAction::getImage() const
|
||||
chatterino::Image *ModerationAction::getImage() const
|
||||
{
|
||||
return this->image;
|
||||
}
|
||||
|
||||
@@ -9,18 +9,18 @@ class Image;
|
||||
class ModerationAction
|
||||
{
|
||||
public:
|
||||
ModerationAction(messages::Image *image, const QString &action);
|
||||
ModerationAction(chatterino::Image *image, const QString &action);
|
||||
ModerationAction(const QString &line1, const QString &line2, const QString &action);
|
||||
|
||||
bool isImage() const;
|
||||
messages::Image *getImage() const;
|
||||
chatterino::Image *getImage() const;
|
||||
const QString &getLine1() const;
|
||||
const QString &getLine2() const;
|
||||
const QString &getAction() const;
|
||||
|
||||
private:
|
||||
bool _isImage;
|
||||
messages::Image *image;
|
||||
chatterino::Image *image;
|
||||
QString line1;
|
||||
QString line2;
|
||||
QString action;
|
||||
|
||||
Reference in New Issue
Block a user