Removed buttons from start tab. Added cogwheel to settings button and menu
This commit is contained in:
1 parent
eef4a7a34e
commit
b1e5dd8432
1 file changed
+85
-49
+85
-49
@@ -5173,6 +5173,7 @@ fn profiles_panel(state: &Moorly, show_add: bool) -> Element<'_, Message> {
|
||||
state.selected,
|
||||
&state.checked,
|
||||
state.hovered_folder,
|
||||
show_add,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -5181,11 +5182,14 @@ fn profiles_panel(state: &Moorly, show_add: bool) -> Element<'_, Message> {
|
||||
.height(Length::Fill)
|
||||
.style(theme::settings_frame);
|
||||
|
||||
let base = column![filter_row, actions, list]
|
||||
let base = column![filter_row]
|
||||
.spacing(12)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill);
|
||||
|
||||
let base = if show_add { base.push(actions) } else { base };
|
||||
let base = base.push(list);
|
||||
|
||||
let dialog_open = state.folder_dialog.is_some()
|
||||
|| state.profile_dialog.is_some()
|
||||
|| state.transfer.is_some()
|
||||
@@ -5927,6 +5931,7 @@ fn profile_folder_row<'a>(
|
||||
selected: Option<Selection>,
|
||||
checked: &'a HashSet<Selection>,
|
||||
hovered: Option<usize>,
|
||||
show_checks: bool,
|
||||
) -> Element<'a, Message> {
|
||||
let is_selected = selected == Some(Selection::Folder(index));
|
||||
let expanded = folder.expanded;
|
||||
@@ -5980,7 +5985,7 @@ fn profile_folder_row<'a>(
|
||||
top: 8.0,
|
||||
right: 10.0,
|
||||
bottom: 8.0,
|
||||
left: 0.0,
|
||||
left: if show_checks { 0.0 } else { 10.0 + indent },
|
||||
})
|
||||
.style(move |theme, status| {
|
||||
let mut style = theme::selectable_row(theme, status, is_selected);
|
||||
@@ -5995,9 +6000,24 @@ fn profile_folder_row<'a>(
|
||||
.on_exit(Message::HoverFolder(None));
|
||||
|
||||
let folder_checked = checked.contains(&Selection::Folder(index));
|
||||
let folder_checkbox: Element<'_, Message> = if folder.path == DEFAULT_PROFILE_FOLDER {
|
||||
container(space::horizontal())
|
||||
.width(16)
|
||||
|
||||
let heading: Element<'_, Message> = if show_checks {
|
||||
let folder_checkbox: Element<'_, Message> = if folder.path == DEFAULT_PROFILE_FOLDER {
|
||||
container(space::horizontal())
|
||||
.width(16)
|
||||
.padding(Padding {
|
||||
top: 8.0,
|
||||
right: 6.0,
|
||||
bottom: 8.0,
|
||||
left: 10.0 + indent,
|
||||
})
|
||||
.into()
|
||||
} else {
|
||||
container(
|
||||
checkbox(folder_checked)
|
||||
.size(16)
|
||||
.on_toggle(move |_| Message::ToggleChecked(Selection::Folder(index))),
|
||||
)
|
||||
.padding(Padding {
|
||||
top: 8.0,
|
||||
right: 6.0,
|
||||
@@ -6005,24 +6025,15 @@ fn profile_folder_row<'a>(
|
||||
left: 10.0 + indent,
|
||||
})
|
||||
.into()
|
||||
} else {
|
||||
container(
|
||||
checkbox(folder_checked)
|
||||
.size(16)
|
||||
.on_toggle(move |_| Message::ToggleChecked(Selection::Folder(index))),
|
||||
)
|
||||
.padding(Padding {
|
||||
top: 8.0,
|
||||
right: 6.0,
|
||||
bottom: 8.0,
|
||||
left: 10.0 + indent,
|
||||
})
|
||||
.into()
|
||||
};
|
||||
};
|
||||
|
||||
let heading = row![folder_checkbox, heading]
|
||||
.align_y(Alignment::Center)
|
||||
.width(Length::Fill);
|
||||
row![folder_checkbox, heading]
|
||||
.align_y(Alignment::Center)
|
||||
.width(Length::Fill)
|
||||
.into()
|
||||
} else {
|
||||
heading.into()
|
||||
};
|
||||
|
||||
let mut rows = column![heading].width(Length::Fill);
|
||||
|
||||
@@ -6037,20 +6048,6 @@ fn profile_folder_row<'a>(
|
||||
folder: index,
|
||||
profile: profile_index,
|
||||
});
|
||||
let profile_checkbox =
|
||||
container(checkbox(profile_checked).size(16).on_toggle(move |_| {
|
||||
Message::ToggleChecked(Selection::Profile {
|
||||
folder: index,
|
||||
profile: profile_index,
|
||||
})
|
||||
}))
|
||||
.padding(Padding {
|
||||
top: 4.0,
|
||||
right: 6.0,
|
||||
bottom: 4.0,
|
||||
left: 26.0 + indent,
|
||||
});
|
||||
|
||||
let profile_row = button(
|
||||
row![text("👤").size(13), text(profile.name.as_str()).size(13)]
|
||||
.spacing(8)
|
||||
@@ -6065,15 +6062,33 @@ fn profile_folder_row<'a>(
|
||||
top: 4.0,
|
||||
right: 26.0,
|
||||
bottom: 4.0,
|
||||
left: 0.0,
|
||||
left: if show_checks { 0.0 } else { 26.0 + indent },
|
||||
})
|
||||
.style(move |theme, status| theme::selectable_row(theme, status, profile_selected));
|
||||
|
||||
rows = rows.push(
|
||||
row![profile_checkbox, profile_row]
|
||||
.align_y(Alignment::Center)
|
||||
.width(Length::Fill),
|
||||
);
|
||||
if show_checks {
|
||||
let profile_checkbox =
|
||||
container(checkbox(profile_checked).size(16).on_toggle(move |_| {
|
||||
Message::ToggleChecked(Selection::Profile {
|
||||
folder: index,
|
||||
profile: profile_index,
|
||||
})
|
||||
}))
|
||||
.padding(Padding {
|
||||
top: 4.0,
|
||||
right: 6.0,
|
||||
bottom: 4.0,
|
||||
left: 26.0 + indent,
|
||||
});
|
||||
|
||||
rows = rows.push(
|
||||
row![profile_checkbox, profile_row]
|
||||
.align_y(Alignment::Center)
|
||||
.width(Length::Fill),
|
||||
);
|
||||
} else {
|
||||
rows = rows.push(profile_row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6087,10 +6102,14 @@ fn start_page(state: &Moorly, window: window::Id) -> Element<'_, Message> {
|
||||
let width = (size.width * 0.5).max(400.0);
|
||||
let list_height = (size.height * 0.6).max(300.0);
|
||||
|
||||
let settings = button(text("Settings"))
|
||||
.on_press(Message::SelectTab(window, Tab::Settings))
|
||||
.padding([6, 12])
|
||||
.style(theme::outlined_option);
|
||||
let settings = button(
|
||||
row![text("⚙\u{fe0e}").size(16), text("Settings")]
|
||||
.spacing(6)
|
||||
.align_y(Alignment::Center),
|
||||
)
|
||||
.on_press(Message::SelectTab(window, Tab::Settings))
|
||||
.padding([6, 12])
|
||||
.style(theme::outlined_option);
|
||||
|
||||
container(
|
||||
container(
|
||||
@@ -6355,9 +6374,25 @@ fn menu_item(
|
||||
shortcut: Option<String>,
|
||||
message: Message,
|
||||
) -> iced::widget::Button<'static, Message> {
|
||||
let mut content = row![text(label)]
|
||||
menu_item_with_glyph(None, label, shortcut, message)
|
||||
}
|
||||
|
||||
fn menu_item_with_glyph(
|
||||
glyph: Option<&'static str>,
|
||||
label: &'static str,
|
||||
shortcut: Option<String>,
|
||||
message: Message,
|
||||
) -> iced::widget::Button<'static, Message> {
|
||||
let mut content = row![]
|
||||
.width(Length::Fill)
|
||||
.align_y(Alignment::Center);
|
||||
.align_y(Alignment::Center)
|
||||
.spacing(6);
|
||||
|
||||
if let Some(glyph) = glyph {
|
||||
content = content.push(text(glyph).size(16));
|
||||
}
|
||||
|
||||
content = content.push(text(label));
|
||||
|
||||
if let Some(shortcut) = shortcut {
|
||||
content = content
|
||||
@@ -6572,7 +6607,8 @@ fn main_view(state: &Moorly, window: window::Id) -> Element<'_, Message> {
|
||||
.get(ShortcutAction::Quit)
|
||||
.map(ToString::to_string);
|
||||
|
||||
let mut menu_items = menu_items.push(menu_item(
|
||||
let mut menu_items = menu_items.push(menu_item_with_glyph(
|
||||
Some("⚙\u{fe0e}"),
|
||||
"Settings",
|
||||
settings_shortcut,
|
||||
Message::SelectTab(window, Tab::Settings),
|
||||
|
||||
Reference in new issue
Block a user