WidgetGallery+MouseSettings: Use LexicalPath::basename()

This commit is contained in:
Karol Kosek 2021-09-20 00:13:29 +02:00 committed by Andreas Kling
parent 9ddd2fdcc5
commit d1846867cd
Notes: sideshowbarker 2024-07-18 03:36:45 +09:00
2 changed files with 5 additions and 8 deletions

View file

@ -60,8 +60,7 @@ void MouseCursorModel::invalidate()
Cursor cursor; Cursor cursor;
cursor.path = move(path); cursor.path = move(path);
auto filename_split = cursor.path.split('/'); cursor.name = LexicalPath::basename(cursor.path);
cursor.name = filename_split[3];
// FIXME: Animated cursor bitmaps // FIXME: Animated cursor bitmaps
auto cursor_bitmap = Gfx::Bitmap::try_load_from_file(cursor.path); auto cursor_bitmap = Gfx::Bitmap::try_load_from_file(cursor.path);

View file

@ -6,6 +6,7 @@
#pragma once #pragma once
#include <AK/LexicalPath.h>
#include <AK/NonnullRefPtr.h> #include <AK/NonnullRefPtr.h>
#include <AK/Vector.h> #include <AK/Vector.h>
#include <LibCore/DirIterator.h> #include <LibCore/DirIterator.h>
@ -69,8 +70,7 @@ public:
Cursor cursor; Cursor cursor;
cursor.path = move(path); cursor.path = move(path);
cursor.bitmap = Gfx::Bitmap::try_load_from_file(cursor.path); cursor.bitmap = Gfx::Bitmap::try_load_from_file(cursor.path);
auto filename_split = cursor.path.split('/'); cursor.name = LexicalPath::basename(cursor.path);
cursor.name = filename_split[3];
m_cursors.append(move(cursor)); m_cursors.append(move(cursor));
} }
@ -150,8 +150,7 @@ public:
continue; continue;
IconSet icon_set; IconSet icon_set;
icon_set.big_icon = Gfx::Bitmap::try_load_from_file(path); icon_set.big_icon = Gfx::Bitmap::try_load_from_file(path);
auto filename_split = path.split('/'); icon_set.name = LexicalPath::basename(path);
icon_set.name = filename_split[3];
m_icon_sets.append(move(icon_set)); m_icon_sets.append(move(icon_set));
} }
@ -165,8 +164,7 @@ public:
continue; continue;
IconSet icon_set; IconSet icon_set;
icon_set.little_icon = Gfx::Bitmap::try_load_from_file(path); icon_set.little_icon = Gfx::Bitmap::try_load_from_file(path);
auto filename_split = path.split('/'); icon_set.name = LexicalPath::basename(path);
icon_set.name = filename_split[3];
for (size_t i = 0; i < big_icons_found; i++) { for (size_t i = 0; i < big_icons_found; i++) {
if (icon_set.name == m_icon_sets[i].name) { if (icon_set.name == m_icon_sets[i].name) {
m_icon_sets[i].little_icon = icon_set.little_icon; m_icon_sets[i].little_icon = icon_set.little_icon;