Renamed private members
This commit is contained in:
+19
-19
@@ -18,10 +18,10 @@ public:
|
||||
|
||||
bool tryGet(const TKey &name, TValue &value) const
|
||||
{
|
||||
QMutexLocker lock(&this->mutex);
|
||||
QMutexLocker lock(&this->mutex_);
|
||||
|
||||
auto a = this->data.find(name);
|
||||
if (a == this->data.end()) {
|
||||
auto a = this->data_.find(name);
|
||||
if (a == this->data_.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ public:
|
||||
|
||||
TValue getOrAdd(const TKey &name, std::function<TValue()> addLambda)
|
||||
{
|
||||
QMutexLocker lock(&this->mutex);
|
||||
QMutexLocker lock(&this->mutex_);
|
||||
|
||||
auto a = this->data.find(name);
|
||||
if (a == this->data.end()) {
|
||||
auto a = this->data_.find(name);
|
||||
if (a == this->data_.end()) {
|
||||
TValue value = addLambda();
|
||||
this->data.insert(name, value);
|
||||
this->data_.insert(name, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -46,30 +46,30 @@ public:
|
||||
|
||||
TValue &operator[](const TKey &name)
|
||||
{
|
||||
QMutexLocker lock(&this->mutex);
|
||||
QMutexLocker lock(&this->mutex_);
|
||||
|
||||
return this->data[name];
|
||||
return this->data_[name];
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
QMutexLocker lock(&this->mutex);
|
||||
QMutexLocker lock(&this->mutex_);
|
||||
|
||||
this->data.clear();
|
||||
this->data_.clear();
|
||||
}
|
||||
|
||||
void insert(const TKey &name, const TValue &value)
|
||||
{
|
||||
QMutexLocker lock(&this->mutex);
|
||||
QMutexLocker lock(&this->mutex_);
|
||||
|
||||
this->data.insert(name, value);
|
||||
this->data_.insert(name, value);
|
||||
}
|
||||
|
||||
void each(std::function<void(const TKey &name, const TValue &value)> func) const
|
||||
{
|
||||
QMutexLocker lock(&this->mutex);
|
||||
QMutexLocker lock(&this->mutex_);
|
||||
|
||||
QMapIterator<TKey, TValue> it(this->data);
|
||||
QMapIterator<TKey, TValue> it(this->data_);
|
||||
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
@@ -79,9 +79,9 @@ public:
|
||||
|
||||
void each(std::function<void(const TKey &name, TValue &value)> func)
|
||||
{
|
||||
QMutexLocker lock(&this->mutex);
|
||||
QMutexLocker lock(&this->mutex_);
|
||||
|
||||
QMutableMapIterator<TKey, TValue> it(this->data);
|
||||
QMutableMapIterator<TKey, TValue> it(this->data_);
|
||||
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
@@ -90,8 +90,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
mutable QMutex mutex;
|
||||
QMap<TKey, TValue> data;
|
||||
mutable QMutex mutex_;
|
||||
QMap<TKey, TValue> data_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
QMap<QString, int64_t> DebugCount::counts;
|
||||
std::mutex DebugCount::mut;
|
||||
QMap<QString, int64_t> DebugCount::counts_;
|
||||
std::mutex DebugCount::mut_;
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
+14
-13
@@ -10,17 +10,14 @@ namespace chatterino {
|
||||
|
||||
class DebugCount
|
||||
{
|
||||
static QMap<QString, int64_t> counts;
|
||||
static std::mutex mut;
|
||||
|
||||
public:
|
||||
static void increase(const QString &name)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mut);
|
||||
std::lock_guard<std::mutex> lock(mut_);
|
||||
|
||||
auto it = counts.find(name);
|
||||
if (it == counts.end()) {
|
||||
counts.insert(name, 1);
|
||||
auto it = counts_.find(name);
|
||||
if (it == counts_.end()) {
|
||||
counts_.insert(name, 1);
|
||||
} else {
|
||||
reinterpret_cast<int64_t &>(it.value())++;
|
||||
}
|
||||
@@ -28,11 +25,11 @@ public:
|
||||
|
||||
static void decrease(const QString &name)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mut);
|
||||
std::lock_guard<std::mutex> lock(mut_);
|
||||
|
||||
auto it = counts.find(name);
|
||||
if (it == counts.end()) {
|
||||
counts.insert(name, -1);
|
||||
auto it = counts_.find(name);
|
||||
if (it == counts_.end()) {
|
||||
counts_.insert(name, -1);
|
||||
} else {
|
||||
reinterpret_cast<int64_t &>(it.value())--;
|
||||
}
|
||||
@@ -40,10 +37,10 @@ public:
|
||||
|
||||
static QString getDebugText()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mut);
|
||||
std::lock_guard<std::mutex> lock(mut_);
|
||||
|
||||
QString text;
|
||||
for (auto it = counts.begin(); it != counts.end(); it++) {
|
||||
for (auto it = counts_.begin(); it != counts_.end(); it++) {
|
||||
text += it.key() + ": " + QString::number(it.value()) + "\n";
|
||||
}
|
||||
return text;
|
||||
@@ -53,6 +50,10 @@ public:
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
private:
|
||||
static QMap<QString, int64_t> counts_;
|
||||
static std::mutex mut_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
+19
-19
@@ -15,29 +15,29 @@ class LayoutCreator
|
||||
{
|
||||
public:
|
||||
LayoutCreator(T *_item)
|
||||
: item(_item)
|
||||
: item_(_item)
|
||||
{
|
||||
}
|
||||
|
||||
T *operator->()
|
||||
{
|
||||
return this->item;
|
||||
return this->item_;
|
||||
}
|
||||
|
||||
T &operator*()
|
||||
{
|
||||
return *this->item;
|
||||
return *this->item_;
|
||||
}
|
||||
|
||||
T *getElement()
|
||||
{
|
||||
return this->item;
|
||||
return this->item_;
|
||||
}
|
||||
|
||||
template <typename T2>
|
||||
LayoutCreator<T2> append(T2 *_item)
|
||||
{
|
||||
this->_addItem(this->getOrCreateLayout(), _item);
|
||||
this->addItem(this->getOrCreateLayout(), _item);
|
||||
|
||||
return LayoutCreator<T2>(_item);
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
{
|
||||
T2 *t = new T2(std::forward<Args>(args)...);
|
||||
|
||||
this->_addItem(this->getOrCreateLayout(), t);
|
||||
this->addItem(this->getOrCreateLayout(), t);
|
||||
|
||||
return LayoutCreator<T2>(t);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
LayoutCreator<QWidget> emplaceScrollAreaWidget()
|
||||
{
|
||||
QWidget *widget = new QWidget;
|
||||
this->item->setWidget(widget);
|
||||
this->item_->setWidget(widget);
|
||||
return LayoutCreator<QWidget>(widget);
|
||||
}
|
||||
|
||||
@@ -68,14 +68,14 @@ public:
|
||||
{
|
||||
T2 *layout = new T2;
|
||||
|
||||
this->item->setLayout(layout);
|
||||
this->item_->setLayout(layout);
|
||||
|
||||
return LayoutCreator<T2>(layout);
|
||||
}
|
||||
|
||||
LayoutCreator<T> assign(T **ptr)
|
||||
{
|
||||
*ptr = this->item;
|
||||
*ptr = this->item_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
typename std::enable_if<std::is_base_of<QLayout, Q>::value, int>::type = 0>
|
||||
LayoutCreator<T> withoutMargin()
|
||||
{
|
||||
this->item->setContentsMargins(0, 0, 0, 0);
|
||||
this->item_->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
typename std::enable_if<std::is_base_of<QWidget, Q>::value, int>::type = 0>
|
||||
LayoutCreator<T> hidden()
|
||||
{
|
||||
this->item->setVisible(false);
|
||||
this->item_->setVisible(false);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -107,24 +107,24 @@ public:
|
||||
QWidget *widget = new QWidget;
|
||||
widget->setLayout(item);
|
||||
|
||||
this->item->addTab(widget, title);
|
||||
this->item_->addTab(widget, title);
|
||||
|
||||
return LayoutCreator<T2>(item);
|
||||
}
|
||||
|
||||
private:
|
||||
T *item;
|
||||
T *item_;
|
||||
|
||||
template <typename T2,
|
||||
typename std::enable_if<std::is_base_of<QWidget, T2>::value, int>::type = 0>
|
||||
void _addItem(QLayout *layout, T2 *item)
|
||||
void addItem(QLayout *layout, T2 *item)
|
||||
{
|
||||
layout->addWidget(item);
|
||||
}
|
||||
|
||||
template <typename T2,
|
||||
typename std::enable_if<std::is_base_of<QLayout, T2>::value, int>::type = 0>
|
||||
void _addItem(QLayout *layout, T2 *item)
|
||||
void addItem(QLayout *layout, T2 *item)
|
||||
{
|
||||
QWidget *widget = new QWidget();
|
||||
widget->setLayout(item);
|
||||
@@ -135,18 +135,18 @@ private:
|
||||
typename std::enable_if<std::is_base_of<QLayout, Q>::value, int>::type = 0>
|
||||
QLayout *getOrCreateLayout()
|
||||
{
|
||||
return this->item;
|
||||
return this->item_;
|
||||
}
|
||||
|
||||
template <typename Q = T,
|
||||
typename std::enable_if<std::is_base_of<QWidget, Q>::value, int>::type = 0>
|
||||
QLayout *getOrCreateLayout()
|
||||
{
|
||||
if (!this->item->layout()) {
|
||||
this->item->setLayout(new QHBoxLayout());
|
||||
if (!this->item_->layout()) {
|
||||
this->item_->setLayout(new QHBoxLayout());
|
||||
}
|
||||
|
||||
return this->item->layout();
|
||||
return this->item_->layout();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -16,16 +16,16 @@ class LambdaRunnable : public QRunnable
|
||||
public:
|
||||
LambdaRunnable(std::function<void()> action)
|
||||
{
|
||||
this->action = action;
|
||||
this->action_ = action;
|
||||
}
|
||||
|
||||
void run()
|
||||
{
|
||||
this->action();
|
||||
this->action_();
|
||||
}
|
||||
|
||||
private:
|
||||
std::function<void()> action;
|
||||
std::function<void()> action_;
|
||||
};
|
||||
|
||||
// Taken from
|
||||
|
||||
+10
-10
@@ -15,7 +15,7 @@ namespace chatterino {
|
||||
|
||||
namespace {
|
||||
|
||||
const char *GetBinaryName()
|
||||
const char *getBinaryName()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return "streamlink.exe";
|
||||
@@ -24,7 +24,7 @@ const char *GetBinaryName()
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *GetDefaultBinaryPath()
|
||||
const char *getDefaultBinaryPath()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return "C:\\Program Files (x86)\\Streamlink\\bin\\streamlink.exe";
|
||||
@@ -38,13 +38,13 @@ QString getStreamlinkProgram()
|
||||
auto app = getApp();
|
||||
|
||||
if (app->settings->streamlinkUseCustomPath) {
|
||||
return app->settings->streamlinkPath + "/" + GetBinaryName();
|
||||
return app->settings->streamlinkPath + "/" + getBinaryName();
|
||||
} else {
|
||||
return GetBinaryName();
|
||||
return getBinaryName();
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckStreamlinkPath(const QString &path)
|
||||
bool checkStreamlinkPath(const QString &path)
|
||||
{
|
||||
QFileInfo fileinfo(path);
|
||||
|
||||
@@ -95,7 +95,7 @@ QProcess *createStreamlinkProcess()
|
||||
|
||||
} // namespace
|
||||
|
||||
void GetStreamQualities(const QString &channelURL, std::function<void(QStringList)> cb)
|
||||
void getStreamQualities(const QString &channelURL, std::function<void(QStringList)> cb)
|
||||
{
|
||||
auto p = createStreamlinkProcess();
|
||||
|
||||
@@ -130,7 +130,7 @@ void GetStreamQualities(const QString &channelURL, std::function<void(QStringLis
|
||||
p->start();
|
||||
}
|
||||
|
||||
void OpenStreamlink(const QString &channelURL, const QString &quality, QStringList extraArguments)
|
||||
void openStreamlink(const QString &channelURL, const QString &quality, QStringList extraArguments)
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
@@ -156,7 +156,7 @@ void OpenStreamlink(const QString &channelURL, const QString &quality, QStringLi
|
||||
}
|
||||
}
|
||||
|
||||
void Start(const QString &channel)
|
||||
void openStreamlinkForChannel(const QString &channel)
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
@@ -166,7 +166,7 @@ void Start(const QString &channel)
|
||||
preferredQuality = preferredQuality.toLower();
|
||||
|
||||
if (preferredQuality == "choose") {
|
||||
GetStreamQualities(channelURL, [=](QStringList qualityOptions) {
|
||||
getStreamQualities(channelURL, [=](QStringList qualityOptions) {
|
||||
QualityPopup::showDialog(channel, qualityOptions);
|
||||
});
|
||||
|
||||
@@ -198,7 +198,7 @@ void Start(const QString &channel)
|
||||
args << "--stream-sorting-excludes" << exclude;
|
||||
}
|
||||
|
||||
OpenStreamlink(channelURL, quality, args);
|
||||
openStreamlink(channelURL, quality, args);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -16,11 +16,11 @@ public:
|
||||
|
||||
// Open streamlink for given channel, quality and extra arguments
|
||||
// the "Additional arguments" are fetched and added at the beginning of the streamlink call
|
||||
void OpenStreamlink(const QString &channelURL, const QString &quality,
|
||||
void openStreamlink(const QString &channelURL, const QString &quality,
|
||||
QStringList extraArguments = QStringList());
|
||||
|
||||
// Start opening streamlink for the given channel, reading settings like quality from settings
|
||||
// and opening a quality dialog if the quality is "Choose"
|
||||
void Start(const QString &channel);
|
||||
void openStreamlinkForChannel(const QString &channel);
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user