Renamed private members
This commit is contained in:
@@ -35,7 +35,7 @@ Fonts::Fonts()
|
||||
getApp()->windows->incGeneration();
|
||||
}
|
||||
|
||||
for (auto &map : this->fontsByType) {
|
||||
for (auto &map : this->fontsByType_) {
|
||||
map.clear();
|
||||
}
|
||||
this->fontChanged.invoke();
|
||||
@@ -48,13 +48,13 @@ Fonts::Fonts()
|
||||
getApp()->windows->incGeneration();
|
||||
}
|
||||
|
||||
for (auto &map : this->fontsByType) {
|
||||
for (auto &map : this->fontsByType_) {
|
||||
map.clear();
|
||||
}
|
||||
this->fontChanged.invoke();
|
||||
});
|
||||
|
||||
this->fontsByType.resize(size_t(EndType));
|
||||
this->fontsByType_.resize(size_t(EndType));
|
||||
}
|
||||
|
||||
QFont Fonts::getFont(Fonts::Type type, float scale)
|
||||
@@ -73,7 +73,7 @@ Fonts::FontData &Fonts::getOrCreateFontData(Type type, float scale)
|
||||
|
||||
assert(type >= 0 && type < EndType);
|
||||
|
||||
auto &map = this->fontsByType[size_t(type)];
|
||||
auto &map = this->fontsByType_[size_t(type)];
|
||||
|
||||
// find element
|
||||
auto it = map.find(scale);
|
||||
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
FontData &getOrCreateFontData(Type type, float scale);
|
||||
FontData createFontData(Type type, float scale);
|
||||
|
||||
std::vector<std::unordered_map<float, FontData>> fontsByType;
|
||||
std::vector<std::unordered_map<float, FontData>> fontsByType_;
|
||||
};
|
||||
|
||||
using FontStyle = Fonts::Type;
|
||||
|
||||
@@ -25,11 +25,11 @@ void Logging::addMessage(const QString &channelName, MessagePtr message)
|
||||
return;
|
||||
}
|
||||
|
||||
auto it = this->loggingChannels.find(channelName);
|
||||
if (it == this->loggingChannels.end()) {
|
||||
auto it = this->loggingChannels_.find(channelName);
|
||||
if (it == this->loggingChannels_.end()) {
|
||||
auto channel = new LoggingChannel(channelName);
|
||||
channel->addMessage(message);
|
||||
this->loggingChannels.emplace(channelName,
|
||||
this->loggingChannels_.emplace(channelName,
|
||||
std::unique_ptr<LoggingChannel>(std::move(channel)));
|
||||
} else {
|
||||
it->second->addMessage(message);
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
void addMessage(const QString &channelName, MessagePtr message);
|
||||
|
||||
private:
|
||||
std::map<QString, std::unique_ptr<LoggingChannel>> loggingChannels;
|
||||
std::map<QString, std::unique_ptr<LoggingChannel>> loggingChannels_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -42,7 +42,7 @@ bool Paths::createFolder(const QString &folderPath)
|
||||
|
||||
bool Paths::isPortable()
|
||||
{
|
||||
return this->portable.get();
|
||||
return this->portable_.get();
|
||||
}
|
||||
|
||||
void Paths::initAppFilePathHash()
|
||||
@@ -58,13 +58,13 @@ void Paths::initAppFilePathHash()
|
||||
|
||||
void Paths::initCheckPortable()
|
||||
{
|
||||
this->portable =
|
||||
this->portable_ =
|
||||
QFileInfo::exists(combinePath(QCoreApplication::applicationDirPath(), "portable"));
|
||||
}
|
||||
|
||||
void Paths::initAppDataDirectory()
|
||||
{
|
||||
assert(this->portable.is_initialized());
|
||||
assert(this->portable_.is_initialized());
|
||||
|
||||
// Root path = %APPDATA%/Chatterino or the folder that the executable resides in
|
||||
|
||||
|
||||
@@ -36,13 +36,13 @@ public:
|
||||
bool isPortable();
|
||||
|
||||
private:
|
||||
static Paths *instance;
|
||||
boost::optional<bool> portable;
|
||||
|
||||
void initAppFilePathHash();
|
||||
void initCheckPortable();
|
||||
void initAppDataDirectory();
|
||||
void initSubDirectories();
|
||||
|
||||
static Paths *instance;
|
||||
boost::optional<bool> portable_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -69,18 +69,18 @@ void Settings::saveSnapshot()
|
||||
d->AddMember(key.Move(), val.Move(), a);
|
||||
}
|
||||
|
||||
this->snapshot.reset(d);
|
||||
this->snapshot_.reset(d);
|
||||
|
||||
Log("hehe: {}", pajlada::Settings::SettingManager::stringify(*d));
|
||||
}
|
||||
|
||||
void Settings::restoreSnapshot()
|
||||
{
|
||||
if (!this->snapshot) {
|
||||
if (!this->snapshot_) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &snapshotObject = this->snapshot->GetObject();
|
||||
const auto &snapshotObject = this->snapshot_->GetObject();
|
||||
|
||||
for (const auto &weakSetting : _settings) {
|
||||
auto setting = weakSetting.lock();
|
||||
|
||||
@@ -125,9 +125,9 @@ public:
|
||||
void restoreSnapshot();
|
||||
|
||||
private:
|
||||
std::unique_ptr<rapidjson::Document> snapshot;
|
||||
|
||||
void updateModerationActions();
|
||||
|
||||
std::unique_ptr<rapidjson::Document> snapshot_;
|
||||
};
|
||||
|
||||
Settings *getSettings();
|
||||
|
||||
+11
-11
@@ -46,8 +46,8 @@ void Theme::update()
|
||||
// multiplier: 1 = white, 0.8 = light, -0.8 dark, -1 black
|
||||
void Theme::actuallyUpdate(double hue, double multiplier)
|
||||
{
|
||||
isLight = multiplier > 0;
|
||||
bool lightWin = isLight;
|
||||
isLight_ = multiplier > 0;
|
||||
bool lightWin = isLight_;
|
||||
|
||||
// QColor themeColor = QColor::fromHslF(hue, 0.43, 0.5);
|
||||
QColor themeColor = QColor::fromHslF(hue, 0.8, 0.5);
|
||||
@@ -82,7 +82,7 @@ void Theme::actuallyUpdate(double hue, double multiplier)
|
||||
|
||||
// message (referenced later)
|
||||
this->messages.textColors.caret = //
|
||||
this->messages.textColors.regular = isLight ? "#000" : "#fff";
|
||||
this->messages.textColors.regular = isLight_ ? "#000" : "#fff";
|
||||
|
||||
QColor highlighted = lightWin ? QColor("#ff0000") : QColor("#ee6166");
|
||||
|
||||
@@ -141,14 +141,14 @@ void Theme::actuallyUpdate(double hue, double multiplier)
|
||||
}
|
||||
|
||||
// Split
|
||||
bool flat = isLight;
|
||||
bool flat = isLight_;
|
||||
|
||||
this->splits.messageSeperator = isLight ? QColor(127, 127, 127) : QColor(60, 60, 60);
|
||||
this->splits.messageSeperator = isLight_ ? QColor(127, 127, 127) : QColor(60, 60, 60);
|
||||
this->splits.background = getColor(0, sat, 1);
|
||||
this->splits.dropPreview = QColor(0, 148, 255, 0x30);
|
||||
this->splits.dropPreviewBorder = QColor(0, 148, 255, 0xff);
|
||||
|
||||
if (isLight) {
|
||||
if (isLight_) {
|
||||
this->splits.dropTargetRect = QColor(255, 255, 255, 0x00);
|
||||
this->splits.dropTargetRectBorder = QColor(0, 148, 255, 0x00);
|
||||
|
||||
@@ -165,7 +165,7 @@ void Theme::actuallyUpdate(double hue, double multiplier)
|
||||
this->splits.header.background = getColor(0, sat, flat ? 1 : 0.9);
|
||||
this->splits.header.border = getColor(0, sat, flat ? 1 : 0.85);
|
||||
this->splits.header.text = this->messages.textColors.regular;
|
||||
this->splits.header.focusedText = isLight ? QColor("#198CFF") : QColor("#84C1FF");
|
||||
this->splits.header.focusedText = isLight_ ? QColor("#198CFF") : QColor("#84C1FF");
|
||||
|
||||
this->splits.input.background = getColor(0, sat, flat ? 0.95 : 0.95);
|
||||
this->splits.input.border = getColor(0, sat, flat ? 1 : 1);
|
||||
@@ -175,16 +175,16 @@ void Theme::actuallyUpdate(double hue, double multiplier)
|
||||
"border:" + this->tabs.selected.backgrounds.regular.color().name() + ";" +
|
||||
"color:" + this->messages.textColors.regular.name() + ";" + //
|
||||
"selection-background-color:" +
|
||||
(isLight ? "#68B1FF" : this->tabs.selected.backgrounds.regular.color().name());
|
||||
(isLight_ ? "#68B1FF" : this->tabs.selected.backgrounds.regular.color().name());
|
||||
|
||||
// Message
|
||||
this->messages.textColors.link = isLight ? QColor(66, 134, 244) : QColor(66, 134, 244);
|
||||
this->messages.textColors.link = isLight_ ? QColor(66, 134, 244) : QColor(66, 134, 244);
|
||||
this->messages.textColors.system = QColor(140, 127, 127);
|
||||
|
||||
this->messages.backgrounds.regular = splits.background;
|
||||
this->messages.backgrounds.alternate = getColor(0, sat, 0.93);
|
||||
|
||||
if (isLight) {
|
||||
if (isLight_) {
|
||||
this->messages.backgrounds.highlighted =
|
||||
blendColors(themeColor, this->messages.backgrounds.regular, 0.8);
|
||||
} else {
|
||||
@@ -228,7 +228,7 @@ QColor Theme::blendColors(const QColor &color1, const QColor &color2, qreal rati
|
||||
|
||||
void Theme::normalizeColor(QColor &color)
|
||||
{
|
||||
if (this->isLight) {
|
||||
if (this->isLight_) {
|
||||
if (color.lightnessF() > 0.5) {
|
||||
color.setHslF(color.hueF(), color.saturationF(), 0.5);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
|
||||
inline bool isLightTheme() const
|
||||
{
|
||||
return this->isLight;
|
||||
return this->isLight_;
|
||||
}
|
||||
|
||||
struct TabColors {
|
||||
@@ -136,16 +136,15 @@ public:
|
||||
private:
|
||||
void actuallyUpdate(double hue, double multiplier);
|
||||
QColor blendColors(const QColor &color1, const QColor &color2, qreal ratio);
|
||||
|
||||
double middleLookupTable[360] = {};
|
||||
double minLookupTable[360] = {};
|
||||
|
||||
void fillLookupTableValues(double (&array)[360], double from, double to, double fromValue,
|
||||
double toValue);
|
||||
|
||||
bool isLight = false;
|
||||
double middleLookupTable_[360] = {};
|
||||
double minLookupTable_[360] = {};
|
||||
|
||||
pajlada::Signals::NoArgSignal repaintVisibleChatWidgets;
|
||||
bool isLight_ = false;
|
||||
|
||||
pajlada::Signals::NoArgSignal repaintVisibleChatWidgets_;
|
||||
|
||||
friend class WindowManager;
|
||||
};
|
||||
|
||||
@@ -62,20 +62,20 @@ WindowManager::WindowManager()
|
||||
|
||||
auto settings = getSettings();
|
||||
|
||||
this->wordFlagsListener.addSetting(settings->showTimestamps);
|
||||
this->wordFlagsListener.addSetting(settings->showBadges);
|
||||
this->wordFlagsListener.addSetting(settings->enableBttvEmotes);
|
||||
this->wordFlagsListener.addSetting(settings->enableEmojis);
|
||||
this->wordFlagsListener.addSetting(settings->enableFfzEmotes);
|
||||
this->wordFlagsListener.addSetting(settings->enableTwitchEmotes);
|
||||
this->wordFlagsListener.cb = [this](auto) {
|
||||
this->wordFlagsListener_.addSetting(settings->showTimestamps);
|
||||
this->wordFlagsListener_.addSetting(settings->showBadges);
|
||||
this->wordFlagsListener_.addSetting(settings->enableBttvEmotes);
|
||||
this->wordFlagsListener_.addSetting(settings->enableEmojis);
|
||||
this->wordFlagsListener_.addSetting(settings->enableFfzEmotes);
|
||||
this->wordFlagsListener_.addSetting(settings->enableTwitchEmotes);
|
||||
this->wordFlagsListener_.cb = [this](auto) {
|
||||
this->updateWordTypeMask(); //
|
||||
};
|
||||
}
|
||||
|
||||
MessageElement::Flags WindowManager::getWordFlags()
|
||||
{
|
||||
return this->wordFlags;
|
||||
return this->wordFlags_;
|
||||
}
|
||||
|
||||
void WindowManager::updateWordTypeMask()
|
||||
@@ -114,8 +114,8 @@ void WindowManager::updateWordTypeMask()
|
||||
// update flags
|
||||
MessageElement::Flags newFlags = static_cast<MessageElement::Flags>(flags);
|
||||
|
||||
if (newFlags != this->wordFlags) {
|
||||
this->wordFlags = newFlags;
|
||||
if (newFlags != this->wordFlags_) {
|
||||
this->wordFlags_ = newFlags;
|
||||
|
||||
this->wordFlagsChanged.invoke();
|
||||
}
|
||||
@@ -134,8 +134,8 @@ void WindowManager::forceLayoutChannelViews()
|
||||
|
||||
void WindowManager::repaintVisibleChatWidgets(Channel *channel)
|
||||
{
|
||||
if (this->mainWindow != nullptr) {
|
||||
this->mainWindow->repaintVisibleChatWidgets(channel);
|
||||
if (this->mainWindow_ != nullptr) {
|
||||
this->mainWindow_->repaintVisibleChatWidgets(channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,14 +155,14 @@ Window &WindowManager::getMainWindow()
|
||||
{
|
||||
assertInGuiThread();
|
||||
|
||||
return *this->mainWindow;
|
||||
return *this->mainWindow_;
|
||||
}
|
||||
|
||||
Window &WindowManager::getSelectedWindow()
|
||||
{
|
||||
assertInGuiThread();
|
||||
|
||||
return *this->selectedWindow;
|
||||
return *this->selectedWindow_;
|
||||
}
|
||||
|
||||
Window &WindowManager::createWindow(Window::Type type)
|
||||
@@ -170,16 +170,16 @@ Window &WindowManager::createWindow(Window::Type type)
|
||||
assertInGuiThread();
|
||||
|
||||
auto *window = new Window(type);
|
||||
this->windows.push_back(window);
|
||||
this->windows_.push_back(window);
|
||||
window->show();
|
||||
|
||||
if (type != Window::Type::Main) {
|
||||
window->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
QObject::connect(window, &QWidget::destroyed, [this, window] {
|
||||
for (auto it = this->windows.begin(); it != this->windows.end(); it++) {
|
||||
for (auto it = this->windows_.begin(); it != this->windows_.end(); it++) {
|
||||
if (*it == window) {
|
||||
this->windows.erase(it);
|
||||
this->windows_.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -191,19 +191,19 @@ Window &WindowManager::createWindow(Window::Type type)
|
||||
|
||||
int WindowManager::windowCount()
|
||||
{
|
||||
return this->windows.size();
|
||||
return this->windows_.size();
|
||||
}
|
||||
|
||||
Window *WindowManager::windowAt(int index)
|
||||
{
|
||||
assertInGuiThread();
|
||||
|
||||
if (index < 0 || (size_t)index >= this->windows.size()) {
|
||||
if (index < 0 || (size_t)index >= this->windows_.size()) {
|
||||
return nullptr;
|
||||
}
|
||||
Log("getting window at bad index {}", index);
|
||||
|
||||
return this->windows.at(index);
|
||||
return this->windows_.at(index);
|
||||
}
|
||||
|
||||
void WindowManager::initialize()
|
||||
@@ -211,9 +211,9 @@ void WindowManager::initialize()
|
||||
assertInGuiThread();
|
||||
|
||||
auto app = getApp();
|
||||
app->themes->repaintVisibleChatWidgets.connect([this] { this->repaintVisibleChatWidgets(); });
|
||||
app->themes->repaintVisibleChatWidgets_.connect([this] { this->repaintVisibleChatWidgets(); });
|
||||
|
||||
assert(!this->initialized);
|
||||
assert(!this->initialized_);
|
||||
|
||||
// load file
|
||||
QString settingsPath = app->paths->settingsDirectory + SETTINGS_FILENAME;
|
||||
@@ -231,14 +231,14 @@ void WindowManager::initialize()
|
||||
QString type_val = window_obj.value("type").toString();
|
||||
Window::Type type = type_val == "main" ? Window::Type::Main : Window::Type::Popup;
|
||||
|
||||
if (type == Window::Type::Main && mainWindow != nullptr) {
|
||||
if (type == Window::Type::Main && mainWindow_ != nullptr) {
|
||||
type = Window::Type::Popup;
|
||||
}
|
||||
|
||||
Window &window = createWindow(type);
|
||||
|
||||
if (type == Window::Type::Main) {
|
||||
mainWindow = &window;
|
||||
mainWindow_ = &window;
|
||||
}
|
||||
|
||||
// get geometry
|
||||
@@ -296,12 +296,12 @@ void WindowManager::initialize()
|
||||
}
|
||||
}
|
||||
|
||||
if (mainWindow == nullptr) {
|
||||
mainWindow = &createWindow(Window::Type::Main);
|
||||
mainWindow->getNotebook().addPage(true);
|
||||
if (mainWindow_ == nullptr) {
|
||||
mainWindow_ = &createWindow(Window::Type::Main);
|
||||
mainWindow_->getNotebook().addPage(true);
|
||||
}
|
||||
|
||||
this->initialized = true;
|
||||
this->initialized_ = true;
|
||||
}
|
||||
|
||||
void WindowManager::save()
|
||||
@@ -313,7 +313,7 @@ void WindowManager::save()
|
||||
|
||||
// "serialize"
|
||||
QJsonArray window_arr;
|
||||
for (Window *window : this->windows) {
|
||||
for (Window *window : this->windows_) {
|
||||
QJsonObject window_obj;
|
||||
|
||||
// window type
|
||||
@@ -457,19 +457,19 @@ void WindowManager::closeAll()
|
||||
{
|
||||
assertInGuiThread();
|
||||
|
||||
for (Window *window : windows) {
|
||||
for (Window *window : windows_) {
|
||||
window->close();
|
||||
}
|
||||
}
|
||||
|
||||
int WindowManager::getGeneration() const
|
||||
{
|
||||
return this->generation;
|
||||
return this->generation_;
|
||||
}
|
||||
|
||||
void WindowManager::incGeneration()
|
||||
{
|
||||
this->generation++;
|
||||
this->generation_++;
|
||||
}
|
||||
|
||||
int WindowManager::clampUiScale(int scale)
|
||||
|
||||
@@ -9,9 +9,18 @@ class WindowManager
|
||||
{
|
||||
public:
|
||||
WindowManager();
|
||||
|
||||
~WindowManager() = delete;
|
||||
|
||||
static void encodeChannel(IndirectChannel channel, QJsonObject &obj);
|
||||
static IndirectChannel decodeChannel(const QJsonObject &obj);
|
||||
|
||||
static int clampUiScale(int scale);
|
||||
static float getUiScaleValue();
|
||||
static float getUiScaleValue(int scale);
|
||||
|
||||
static const int uiScaleMin;
|
||||
static const int uiScaleMax;
|
||||
|
||||
void showSettingsDialog();
|
||||
void showAccountSelectPopup(QPoint point);
|
||||
|
||||
@@ -19,7 +28,6 @@ public:
|
||||
void forceLayoutChannelViews();
|
||||
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
||||
void repaintGifEmotes();
|
||||
// void updateAll();
|
||||
|
||||
Window &getMainWindow();
|
||||
Window &getSelectedWindow();
|
||||
@@ -35,38 +43,28 @@ public:
|
||||
int getGeneration() const;
|
||||
void incGeneration();
|
||||
|
||||
pajlada::Signals::NoArgSignal repaintGifs;
|
||||
pajlada::Signals::Signal<Channel *> layout;
|
||||
|
||||
static const int uiScaleMin;
|
||||
static const int uiScaleMax;
|
||||
static int clampUiScale(int scale);
|
||||
static float getUiScaleValue();
|
||||
static float getUiScaleValue(int scale);
|
||||
|
||||
MessageElement::Flags getWordFlags();
|
||||
void updateWordTypeMask();
|
||||
|
||||
pajlada::Signals::NoArgSignal repaintGifs;
|
||||
pajlada::Signals::Signal<Channel *> layout;
|
||||
|
||||
pajlada::Signals::NoArgSignal wordFlagsChanged;
|
||||
|
||||
private:
|
||||
bool initialized = false;
|
||||
|
||||
std::atomic<int> generation{0};
|
||||
|
||||
std::vector<Window *> windows;
|
||||
|
||||
Window *mainWindow = nullptr;
|
||||
Window *selectedWindow = nullptr;
|
||||
|
||||
void encodeNodeRecusively(SplitContainer::Node *node, QJsonObject &obj);
|
||||
|
||||
MessageElement::Flags wordFlags = MessageElement::Default;
|
||||
pajlada::Settings::SettingListener wordFlagsListener;
|
||||
bool initialized_ = false;
|
||||
|
||||
public:
|
||||
static void encodeChannel(IndirectChannel channel, QJsonObject &obj);
|
||||
static IndirectChannel decodeChannel(const QJsonObject &obj);
|
||||
std::atomic<int> generation_{0};
|
||||
|
||||
std::vector<Window *> windows_;
|
||||
|
||||
Window *mainWindow_ = nullptr;
|
||||
Window *selectedWindow_ = nullptr;
|
||||
|
||||
MessageElement::Flags wordFlags_ = MessageElement::Default;
|
||||
pajlada::Settings::SettingListener wordFlagsListener_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user