GUI: Make TextViewerDialog use a Path instead of a String

This commit is contained in:
Le Philousophe 2023-09-02 19:23:26 +02:00 committed by Eugene Sandulenko
parent 74a6158347
commit fd0267cfd1
2 changed files with 7 additions and 7 deletions

View File

@ -39,7 +39,7 @@ namespace GUI {
#define kPadX 0.05
#define kPadY 0.05
TextViewerDialog::TextViewerDialog(Common::String fname)
TextViewerDialog::TextViewerDialog(const Common::Path &fname)
: Dialog(0, 0, 1, 1), _fname(fname) {
_font = &g_gui.getFont(ThemeEngine::kFontStyleConsole);
_charWidth = _font->getMaxCharWidth();
@ -64,11 +64,11 @@ TextViewerDialog::~TextViewerDialog() {
destroy();
}
bool TextViewerDialog::loadFile(Common::String &fname) {
bool TextViewerDialog::loadFile(const Common::Path &fname) {
Common::FSNode file(fname);
if (!file.exists()) {
warning("TextViewerDialog::loadFile(): Cannot open file %s", fname.c_str());
warning("TextViewerDialog::loadFile(): Cannot open file %s", fname.toString(Common::Path::kNativeSeparator).c_str());
return false;
}
@ -76,7 +76,7 @@ bool TextViewerDialog::loadFile(Common::String &fname) {
Common::SeekableReadStream *stream = file.createReadStream();
if (!stream) {
warning("TextViewerDialog::loadFile(): Cannot load file %s", fname.c_str());
warning("TextViewerDialog::loadFile(): Cannot load file %s", fname.toString(Common::Path::kNativeSeparator).c_str());
return false;
}

View File

@ -51,14 +51,14 @@ private:
ScrollBarWidget *_scrollBar;
ButtonWidget *_closeButton;
Common::String _fname;
Common::Path _fname;
const Graphics::Font *_font = nullptr;
bool loadFile(Common::String &fname);
bool loadFile(const Common::Path &fname);
void reflowLayout();
public:
TextViewerDialog(Common::String fname);
TextViewerDialog(const Common::Path &fname);
~TextViewerDialog();
void destroy();