mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-09 18:44:46 +00:00
Replace std::snprintf() with fmt::format in ui::Alert
This commit is contained in:
parent
1e5e06580d
commit
69dd28ca9c
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
// Copyright (C) 2019-2022 Igara Studio S.A.
|
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -36,6 +36,7 @@
|
|||||||
#include "ui/alert.h"
|
#include "ui/alert.h"
|
||||||
|
|
||||||
#include "base/string.h"
|
#include "base/string.h"
|
||||||
|
#include "fmt/format.h"
|
||||||
#include "ui/box.h"
|
#include "ui/box.h"
|
||||||
#include "ui/button.h"
|
#include "ui/button.h"
|
||||||
#include "ui/grid.h"
|
#include "ui/grid.h"
|
||||||
@ -46,7 +47,7 @@
|
|||||||
#include "ui/theme.h"
|
#include "ui/theme.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdio>
|
#include <string>
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
@ -120,9 +121,7 @@ void Alert::addButton(const std::string& text)
|
|||||||
button->setMinSize(gfx::Size(60*guiscale(), 0));
|
button->setMinSize(gfx::Size(60*guiscale(), 0));
|
||||||
m_buttons.push_back(button);
|
m_buttons.push_back(button);
|
||||||
|
|
||||||
char id[256];
|
button->setId(fmt::format("button-{}", m_buttons.size()).c_str());
|
||||||
std::snprintf(id, sizeof(id), "button-%lu", m_buttons.size());
|
|
||||||
button->setId(id);
|
|
||||||
button->Click.connect([this, button]{ closeWindow(button); });
|
button->Click.connect([this, button]{ closeWindow(button); });
|
||||||
|
|
||||||
m_buttonsPlaceholder->addChild(button);
|
m_buttonsPlaceholder->addChild(button);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user