file select screen displays user info logs
This commit is contained in:
parent
f214ba12f0
commit
3bc138e81f
3 changed files with 83 additions and 6 deletions
|
|
@ -65,6 +65,17 @@ FileSelectScreen::FileSelectScreen(MainProgram& m): Screen(m) {
|
|||
update_file_list(trashListTemp, trashPath, true);
|
||||
}
|
||||
|
||||
void FileSelectScreen::update() {
|
||||
std::erase_if(main.logMessages, [&](auto& logM) {
|
||||
logM.time.update_time_since();
|
||||
if(logM.time > UserLogMessage::FADE_START_TIME) {
|
||||
main.g.gui.set_to_layout();
|
||||
return logM.time >= UserLogMessage::DISPLAY_TIME;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
void FileSelectScreen::gui_layout_run() {
|
||||
main_display();
|
||||
}
|
||||
|
|
@ -136,6 +147,65 @@ void FileSelectScreen::update_file_list(std::vector<FileInfo>& fL, const std::fi
|
|||
sort_file_list(fL);
|
||||
}
|
||||
|
||||
void FileSelectScreen::global_log() {
|
||||
auto& gui = main.g.gui;
|
||||
auto& io = gui.io;
|
||||
|
||||
float notificationSize = std::min(300.0f, gui.io.safeWindowRect.width() - 20.0f);
|
||||
|
||||
gui.set_z_index(gui.get_z_index() + 100, [&] {
|
||||
gui.new_id("Global log popup list file select screen", [&] {
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIXED(notificationSize), .height = CLAY_SIZING_FIT(0) },
|
||||
.childGap = io.theme->childGap1,
|
||||
.childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_BOTTOM},
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||
},
|
||||
.floating = {.offset = {10, -10}, .zIndex = gui.get_z_index(), .attachPoints = {.element = CLAY_ATTACH_POINT_LEFT_BOTTOM, .parent = CLAY_ATTACH_POINT_LEFT_BOTTOM}, .attachTo = CLAY_ATTACH_TO_PARENT}
|
||||
}) {
|
||||
for(size_t i = 0; i < main.logMessages.size(); i++) {
|
||||
auto& logM = main.logMessages[i];
|
||||
logM.time.update_time_since();
|
||||
if(logM.time < UserLogMessage::DISPLAY_TIME) {
|
||||
if(logM.whereToDisplay == UserLogMessage::DISPLAY_DESKTOP_ONLY)
|
||||
continue;
|
||||
float a = 1.0f - lerp_time<float>(logM.time, UserLogMessage::DISPLAY_TIME, UserLogMessage::FADE_START_TIME);
|
||||
gui.new_id(i, [&] {
|
||||
gui.element<LayoutElement>("Global log message", [&] (LayoutElement*, const Clay_ElementId& lId) {
|
||||
CLAY(lId, {
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIT(notificationSize), .height = CLAY_SIZING_FIT(0) },
|
||||
.padding = CLAY_PADDING_ALL(io.theme->padding1),
|
||||
.childGap = 0,
|
||||
.childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_TOP},
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||
},
|
||||
.backgroundColor = convert_vec4<Clay_Color>(color_mul_alpha(io.theme->backColor1, a)),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1)
|
||||
}) {
|
||||
SkColor4f c{0, 0, 0, 0};
|
||||
switch(logM.color) {
|
||||
case UserLogMessage::COLOR_NORMAL:
|
||||
c = io.theme->frontColor1;
|
||||
break;
|
||||
case UserLogMessage::COLOR_ERROR:
|
||||
c = io.theme->errorColor;
|
||||
break;
|
||||
}
|
||||
text_label_color(gui, logM.text, color_mul_alpha(c, a));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void FileSelectScreen::sort_file_list(std::vector<FileInfo>& fL) {
|
||||
switch(saveInfo.fileSort) {
|
||||
case SaveInfo::FileSort::ALPHABETICAL_ASCENDING:
|
||||
|
|
@ -229,6 +299,7 @@ void FileSelectScreen::main_display() {
|
|||
settings_view();
|
||||
break;
|
||||
}
|
||||
global_log();
|
||||
}
|
||||
window_gap_side_bar(gui, WindowFillSideBarConfig::Direction::RIGHT);
|
||||
}
|
||||
|
|
@ -373,7 +444,7 @@ void FileSelectScreen::delete_selected_files_in_trash() {
|
|||
void FileSelectScreen::edit_action_bar() {
|
||||
auto& gui = main.g.gui;
|
||||
if(actionBarOpenAnim->get_val()) {
|
||||
gui.set_z_index(gui.get_z_index() + 3, [&] {
|
||||
gui.set_z_index(gui.get_z_index() + 1000, [&] {
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)},
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class FileSelectScreen : public Screen {
|
|||
public:
|
||||
FileSelectScreen(MainProgram& m);
|
||||
virtual void gui_layout_run() override;
|
||||
virtual void update() override;
|
||||
virtual void draw(SkCanvas* canvas) override;
|
||||
virtual void input_paste_callback(const CustomEvents::PasteEvent& paste) override;
|
||||
virtual void input_open_infinipaint_file_callback(const CustomEvents::OpenInfiniPaintFileEvent& openFile) override;
|
||||
|
|
@ -86,6 +87,7 @@ class FileSelectScreen : public Screen {
|
|||
|
||||
GUIStuff::ScrollArea* mainViewScrollArea = nullptr;
|
||||
|
||||
void global_log();
|
||||
void main_display();
|
||||
void main_menu();
|
||||
void file_view();
|
||||
|
|
|
|||
|
|
@ -104,8 +104,10 @@ void PhoneDrawingProgramScreen::main_display() {
|
|||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||
},
|
||||
}) {
|
||||
if(main.world->netClient && main.world->clientStillConnecting)
|
||||
if(main.world->netClient && main.world->clientStillConnecting) {
|
||||
top_toolbar();
|
||||
center_message("Connecting to server message", "Connecting to server...");
|
||||
}
|
||||
else {
|
||||
if(hideGUI)
|
||||
hidden_gui();
|
||||
|
|
@ -366,7 +368,7 @@ void PhoneDrawingProgramScreen::global_log() {
|
|||
|
||||
float notificationSize = std::min(300.0f, gui.io.safeWindowRect.width() - 20.0f);
|
||||
|
||||
gui.new_id("Global log popup list", [&] {
|
||||
gui.new_id("Global log popup list phone drawing screen", [&] {
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIXED(notificationSize), .height = CLAY_SIZING_FIT(0) },
|
||||
|
|
@ -374,7 +376,7 @@ void PhoneDrawingProgramScreen::global_log() {
|
|||
.childAlignment = { .x = CLAY_ALIGN_X_RIGHT, .y = CLAY_ALIGN_Y_TOP},
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||
},
|
||||
.floating = {.offset = {0, 10}, .attachPoints = {.element = CLAY_ATTACH_POINT_RIGHT_TOP, .parent = CLAY_ATTACH_POINT_RIGHT_BOTTOM}, .attachTo = CLAY_ATTACH_TO_PARENT}
|
||||
.floating = {.offset = {-10, 10}, .attachPoints = {.element = CLAY_ATTACH_POINT_RIGHT_TOP, .parent = CLAY_ATTACH_POINT_RIGHT_BOTTOM}, .attachTo = CLAY_ATTACH_TO_PARENT}
|
||||
}) {
|
||||
for(size_t i = 0; i < main.logMessages.size(); i++) {
|
||||
auto& logM = main.logMessages[i];
|
||||
|
|
@ -445,9 +447,11 @@ void PhoneDrawingProgramScreen::top_toolbar() {
|
|||
main.set_tab_to_close(main.world.get());
|
||||
}
|
||||
});
|
||||
top_toolbar_remaining_area();
|
||||
global_log();
|
||||
top_toolbar_settings_popup();
|
||||
if(!(main.world->netClient && main.world->clientStillConnecting)) {
|
||||
top_toolbar_remaining_area();
|
||||
top_toolbar_settings_popup();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue