refactor: function scope statics

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2023-05-28 05:06:28 -07:00
parent 0357921284
commit 7af116fb00

View File

@ -50,6 +50,9 @@ class NoBigComboBoxStyle : public QProxyStyle {
public: public:
static NoBigComboBoxStyle* getInstance(QStyle* style) static NoBigComboBoxStyle* getInstance(QStyle* style)
{ {
static QHash<QStyle*, NoBigComboBoxStyle*> s_singleton_instances_ = {};
static std::mutex s_singleton_instances_mutex_;
std::lock_guard<std::mutex> lock(s_singleton_instances_mutex_); std::lock_guard<std::mutex> lock(s_singleton_instances_mutex_);
auto inst_iter = s_singleton_instances_.constFind(style); auto inst_iter = s_singleton_instances_.constFind(style);
NoBigComboBoxStyle* inst = nullptr; NoBigComboBoxStyle* inst = nullptr;
@ -67,14 +70,8 @@ class NoBigComboBoxStyle : public QProxyStyle {
private: private:
NoBigComboBoxStyle(QStyle* style) : QProxyStyle(style) {} NoBigComboBoxStyle(QStyle* style) : QProxyStyle(style) {}
static QHash<QStyle*, NoBigComboBoxStyle*> s_singleton_instances_;
static std::mutex s_singleton_instances_mutex_;
}; };
QHash<QStyle*, NoBigComboBoxStyle*> NoBigComboBoxStyle::s_singleton_instances_ = {};
std::mutex NoBigComboBoxStyle::s_singleton_instances_mutex_;
ManagedPackPage* ManagedPackPage::createPage(BaseInstance* inst, QString type, QWidget* parent) ManagedPackPage* ManagedPackPage::createPage(BaseInstance* inst, QString type, QWidget* parent)
{ {
if (type == "modrinth") if (type == "modrinth")