1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-29 09:25:07 +00:00

GTabWidget: Rename get_active_tab() => active_tab_index()

This commit is contained in:
Andreas Kling 2019-09-07 16:57:26 +02:00
parent 568936775f
commit a635619cc0
3 changed files with 7 additions and 8 deletions

View file

@ -113,7 +113,7 @@ void DisplayPropertiesWidget::create_frame()
apply_button->set_size_policy(Orientation::Horizontal, SizePolicy::Fixed); apply_button->set_size_policy(Orientation::Horizontal, SizePolicy::Fixed);
apply_button->set_preferred_size(60, 22); apply_button->set_preferred_size(60, 22);
apply_button->on_click = [this, tab_widget](GButton&) { apply_button->on_click = [this, tab_widget](GButton&) {
send_settings_to_window_server(tab_widget->get_active_tab()); send_settings_to_window_server(tab_widget->active_tab_index());
}; };
auto* ok_button = new GButton(bottom_widget); auto* ok_button = new GButton(bottom_widget);
@ -122,7 +122,7 @@ void DisplayPropertiesWidget::create_frame()
ok_button->set_size_policy(Orientation::Horizontal, SizePolicy::Fixed); ok_button->set_size_policy(Orientation::Horizontal, SizePolicy::Fixed);
ok_button->set_preferred_size(60, 22); ok_button->set_preferred_size(60, 22);
ok_button->on_click = [this, tab_widget](GButton&) { ok_button->on_click = [this, tab_widget](GButton&) {
send_settings_to_window_server(tab_widget->get_active_tab()); send_settings_to_window_server(tab_widget->active_tab_index());
GApplication::the().quit(); GApplication::the().quit();
}; };

View file

@ -209,13 +209,11 @@ void GTabWidget::set_tab_position(TabPosition tab_position)
update(); update();
} }
int GTabWidget::get_active_tab() const int GTabWidget::active_tab_index() const
{ {
for(int i = 0; i < m_tabs.size(); i++) for (int i = 0; i < m_tabs.size(); i++) {
{ if (m_tabs.at(i).widget == m_active_widget)
if(m_tabs.at(i).widget == m_active_widget)
return i; return i;
} }
return -1; return -1;
} }

View file

@ -15,7 +15,8 @@ public:
TabPosition tab_position() const { return m_tab_position; } TabPosition tab_position() const { return m_tab_position; }
void set_tab_position(TabPosition); void set_tab_position(TabPosition);
int get_active_tab() const;
int active_tab_index() const;
GWidget* active_widget() const { return m_active_widget; } GWidget* active_widget() const { return m_active_widget; }
void set_active_widget(GWidget*); void set_active_widget(GWidget*);