mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 07:37:35 +00:00
LibCore: Rename File
to DeprecatedFile
As usual, this removes many unused includes and moves used includes further down the chain.
This commit is contained in:
parent
14951b92ca
commit
d43a7eae54
193 changed files with 536 additions and 556 deletions
|
@ -8,7 +8,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Forward.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Mesh.h"
|
||||
|
@ -18,5 +18,5 @@ public:
|
|||
MeshLoader() = default;
|
||||
virtual ~MeshLoader() = default;
|
||||
|
||||
virtual ErrorOr<NonnullRefPtr<Mesh>> load(Core::File& file) = 0;
|
||||
virtual ErrorOr<NonnullRefPtr<Mesh>> load(Core::DeprecatedFile& file) = 0;
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "WavefrontOBJLoader.h"
|
||||
#include <AK/FixedArray.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static inline GLuint get_index_value(StringView& representation)
|
||||
|
@ -16,7 +16,7 @@ static inline GLuint get_index_value(StringView& representation)
|
|||
return representation.to_uint().value_or(1) - 1;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Mesh>> WavefrontOBJLoader::load(Core::File& file)
|
||||
ErrorOr<NonnullRefPtr<Mesh>> WavefrontOBJLoader::load(Core::DeprecatedFile& file)
|
||||
{
|
||||
Vector<Vertex> vertices;
|
||||
Vector<Vertex> normals;
|
||||
|
|
|
@ -18,5 +18,5 @@ public:
|
|||
WavefrontOBJLoader() = default;
|
||||
~WavefrontOBJLoader() override = default;
|
||||
|
||||
ErrorOr<NonnullRefPtr<Mesh>> load(Core::File& file) override;
|
||||
ErrorOr<NonnullRefPtr<Mesh>> load(Core::DeprecatedFile& file) override;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibFileSystemAccessClient/Client.h>
|
||||
#include <LibGL/GL/gl.h>
|
||||
|
@ -34,7 +33,7 @@ class GLContextWidget final : public GUI::Frame {
|
|||
|
||||
public:
|
||||
bool load_path(DeprecatedString const& fname);
|
||||
bool load_file(Core::File& file);
|
||||
bool load_file(Core::DeprecatedFile& file);
|
||||
void toggle_rotate_x() { m_rotate_x = !m_rotate_x; }
|
||||
void toggle_rotate_y() { m_rotate_y = !m_rotate_y; }
|
||||
void toggle_rotate_z() { m_rotate_z = !m_rotate_z; }
|
||||
|
@ -291,7 +290,7 @@ void GLContextWidget::timer_event(Core::TimerEvent&)
|
|||
|
||||
bool GLContextWidget::load_path(DeprecatedString const& filename)
|
||||
{
|
||||
auto file = Core::File::construct(filename);
|
||||
auto file = Core::DeprecatedFile::construct(filename);
|
||||
|
||||
if (!file->open(Core::OpenMode::ReadOnly) && file->error() != ENOENT) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
|
@ -301,7 +300,7 @@ bool GLContextWidget::load_path(DeprecatedString const& filename)
|
|||
return load_file(file);
|
||||
}
|
||||
|
||||
bool GLContextWidget::load_file(Core::File& file)
|
||||
bool GLContextWidget::load_file(Core::DeprecatedFile& file)
|
||||
{
|
||||
auto const& filename = file.filename();
|
||||
if (!filename.ends_with(".obj"sv)) {
|
||||
|
@ -330,11 +329,11 @@ bool GLContextWidget::load_file(Core::File& file)
|
|||
builder.append(filename.split('.').at(0));
|
||||
builder.append(".bmp"sv);
|
||||
|
||||
DeprecatedString texture_path = Core::File::absolute_path(builder.string_view());
|
||||
DeprecatedString texture_path = Core::DeprecatedFile::absolute_path(builder.string_view());
|
||||
|
||||
// Attempt to open the texture file from disk
|
||||
RefPtr<Gfx::Bitmap> texture_image;
|
||||
if (Core::File::exists(texture_path)) {
|
||||
if (Core::DeprecatedFile::exists(texture_path)) {
|
||||
auto bitmap_or_error = Gfx::Bitmap::load_from_file(texture_path);
|
||||
if (!bitmap_or_error.is_error())
|
||||
texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
||||
|
@ -403,7 +402,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto file = response.value();
|
||||
if (widget->load_file(*file)) {
|
||||
auto canonical_path = Core::File::absolute_path(file->filename());
|
||||
auto canonical_path = Core::DeprecatedFile::absolute_path(file->filename());
|
||||
window->set_title(DeprecatedString::formatted("{} - 3D File Viewer", canonical_path));
|
||||
}
|
||||
}));
|
||||
|
@ -592,7 +591,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto filename = arguments.argc > 1 ? arguments.argv[1] : "/home/anon/Documents/3D Models/teapot.obj";
|
||||
if (widget->load_path(filename)) {
|
||||
auto canonical_path = Core::File::absolute_path(filename);
|
||||
auto canonical_path = Core::DeprecatedFile::absolute_path(filename);
|
||||
window->set_title(DeprecatedString::formatted("{} - 3D File Viewer", canonical_path));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue