mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:57:34 +00:00
Calendar/AddEventDialog: Remove meridiem selection
This removes the meridiem selection in the AddEventDialog of the calendar because it thus far didn't do anything.
This commit is contained in:
parent
18b1f856e5
commit
60174cc9aa
3 changed files with 0 additions and 75 deletions
|
@ -66,10 +66,6 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, EventManager& event_man
|
||||||
auto& starting_minute_input = *widget->find_descendant_of_type_named<GUI::SpinBox>("start_minute");
|
auto& starting_minute_input = *widget->find_descendant_of_type_named<GUI::SpinBox>("start_minute");
|
||||||
starting_minute_input.set_value(m_start_date_time.minute());
|
starting_minute_input.set_value(m_start_date_time.minute());
|
||||||
|
|
||||||
auto& starting_meridiem_input = *widget->find_descendant_of_type_named<GUI::ComboBox>("start_meridiem");
|
|
||||||
starting_meridiem_input.set_model(MeridiemListModel::create());
|
|
||||||
starting_meridiem_input.set_selected_index(0);
|
|
||||||
|
|
||||||
auto& end_date_box = *widget->find_descendant_of_type_named<GUI::TextBox>("end_date");
|
auto& end_date_box = *widget->find_descendant_of_type_named<GUI::TextBox>("end_date");
|
||||||
end_date_box.set_text(MUST(m_start_date_time.to_string("%Y-%m-%d"sv)));
|
end_date_box.set_text(MUST(m_start_date_time.to_string("%Y-%m-%d"sv)));
|
||||||
|
|
||||||
|
@ -88,27 +84,20 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, EventManager& event_man
|
||||||
auto& ending_minute_input = *widget->find_descendant_of_type_named<GUI::SpinBox>("end_minute");
|
auto& ending_minute_input = *widget->find_descendant_of_type_named<GUI::SpinBox>("end_minute");
|
||||||
ending_minute_input.set_value(m_end_date_time.minute());
|
ending_minute_input.set_value(m_end_date_time.minute());
|
||||||
|
|
||||||
auto& ending_meridiem_input = *widget->find_descendant_of_type_named<GUI::ComboBox>("end_meridiem");
|
|
||||||
ending_meridiem_input.set_model(MeridiemListModel::create());
|
|
||||||
ending_meridiem_input.set_selected_index(0);
|
|
||||||
|
|
||||||
auto& ok_button = *widget->find_descendant_of_type_named<GUI::Button>("ok_button");
|
auto& ok_button = *widget->find_descendant_of_type_named<GUI::Button>("ok_button");
|
||||||
ok_button.on_click = [&](auto) {
|
ok_button.on_click = [&](auto) {
|
||||||
add_event_to_calendar().release_value_but_fixme_should_propagate_errors();
|
add_event_to_calendar().release_value_but_fixme_should_propagate_errors();
|
||||||
|
|
||||||
done(ExecResult::OK);
|
done(ExecResult::OK);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto update_starting_input_values = [&, this]() {
|
auto update_starting_input_values = [&, this]() {
|
||||||
auto hour = starting_hour_input.value();
|
auto hour = starting_hour_input.value();
|
||||||
auto minute = starting_minute_input.value();
|
auto minute = starting_minute_input.value();
|
||||||
|
|
||||||
m_start_date_time.set_time_only(hour, minute);
|
m_start_date_time.set_time_only(hour, minute);
|
||||||
};
|
};
|
||||||
auto update_ending_input_values = [&, this]() {
|
auto update_ending_input_values = [&, this]() {
|
||||||
auto hour = ending_hour_input.value();
|
auto hour = ending_hour_input.value();
|
||||||
auto minute = ending_minute_input.value();
|
auto minute = ending_minute_input.value();
|
||||||
|
|
||||||
m_end_date_time.set_time_only(hour, minute);
|
m_end_date_time.set_time_only(hour, minute);
|
||||||
};
|
};
|
||||||
starting_hour_input.on_change = [update_starting_input_values](auto) { update_starting_input_values(); };
|
starting_hour_input.on_change = [update_starting_input_values](auto) { update_starting_input_values(); };
|
||||||
|
@ -144,37 +133,4 @@ ErrorOr<void> AddEventDialog::add_event_to_calendar()
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
int AddEventDialog::MeridiemListModel::row_count(const GUI::ModelIndex&) const
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorOr<String> AddEventDialog::MeridiemListModel::column_name(int column) const
|
|
||||||
{
|
|
||||||
switch (column) {
|
|
||||||
case Column::Meridiem:
|
|
||||||
return "Meridiem"_string;
|
|
||||||
default:
|
|
||||||
VERIFY_NOT_REACHED();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GUI::Variant AddEventDialog::MeridiemListModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
|
||||||
{
|
|
||||||
constexpr Array meridiem_names = {
|
|
||||||
"AM", "PM"
|
|
||||||
};
|
|
||||||
|
|
||||||
auto& meridiem = meridiem_names[index.row()];
|
|
||||||
if (role == GUI::ModelRole::Display) {
|
|
||||||
switch (index.column()) {
|
|
||||||
case Column::Meridiem:
|
|
||||||
return meridiem;
|
|
||||||
default:
|
|
||||||
VERIFY_NOT_REACHED();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,12 +60,6 @@
|
||||||
min: 1
|
min: 1
|
||||||
max: 59
|
max: 59
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::ComboBox {
|
|
||||||
name: "start_meridiem"
|
|
||||||
model_only: true
|
|
||||||
fixed_size: [55, 20]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::Widget {
|
@GUI::Widget {
|
||||||
|
@ -106,12 +100,6 @@
|
||||||
min: 1
|
min: 1
|
||||||
max: 59
|
max: 59
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::ComboBox {
|
|
||||||
name: "end_meridiem"
|
|
||||||
model_only: true
|
|
||||||
fixed_size: [55, 20]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::Layout::Spacer {}
|
@GUI::Layout::Spacer {}
|
||||||
|
|
|
@ -31,25 +31,6 @@ private:
|
||||||
|
|
||||||
ErrorOr<void> add_event_to_calendar();
|
ErrorOr<void> add_event_to_calendar();
|
||||||
|
|
||||||
class MeridiemListModel final : public GUI::Model {
|
|
||||||
public:
|
|
||||||
enum Column {
|
|
||||||
Meridiem,
|
|
||||||
__Count,
|
|
||||||
};
|
|
||||||
|
|
||||||
static NonnullRefPtr<MeridiemListModel> create() { return adopt_ref(*new MeridiemListModel); }
|
|
||||||
virtual ~MeridiemListModel() override = default;
|
|
||||||
|
|
||||||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
|
|
||||||
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
|
|
||||||
virtual ErrorOr<String> column_name(int) const override;
|
|
||||||
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
MeridiemListModel() = default;
|
|
||||||
};
|
|
||||||
|
|
||||||
Core::DateTime m_start_date_time;
|
Core::DateTime m_start_date_time;
|
||||||
Core::DateTime m_end_date_time;
|
Core::DateTime m_end_date_time;
|
||||||
EventManager& m_event_manager;
|
EventManager& m_event_manager;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue