Sfoglia il codice sorgente

GTabWidget: Rename get_active_tab() => active_tab_index()

Andreas Kling 5 anni fa
parent
commit
a635619cc0

+ 2 - 2
Applications/DisplayProperties/DisplayProperties.cpp

@@ -113,7 +113,7 @@ void DisplayPropertiesWidget::create_frame()
     apply_button->set_size_policy(Orientation::Horizontal, SizePolicy::Fixed);
     apply_button->set_preferred_size(60, 22);
     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);
@@ -122,7 +122,7 @@ void DisplayPropertiesWidget::create_frame()
     ok_button->set_size_policy(Orientation::Horizontal, SizePolicy::Fixed);
     ok_button->set_preferred_size(60, 22);
     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();
     };
 

+ 3 - 5
Libraries/LibGUI/GTabWidget.cpp

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

+ 2 - 1
Libraries/LibGUI/GTabWidget.h

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