Parcourir la source

SystemMenu: Rename PowerDialog => ShutdownDialog

Andreas Kling il y a 5 ans
Parent
commit
efb3a34e43

+ 1 - 1
Services/SystemMenu/CMakeLists.txt

@@ -1,6 +1,6 @@
 set(SOURCES
     main.cpp
-    PowerDialog.cpp
+    ShutdownDialog.cpp
 )
 
 serenity_bin(SystemMenu)

+ 9 - 10
Services/SystemMenu/PowerDialog.cpp → Services/SystemMenu/ShutdownDialog.cpp

@@ -24,6 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "ShutdownDialog.h"
 #include <AK/String.h>
 #include <AK/Vector.h>
 #include <LibGUI/BoxLayout.h>
@@ -34,33 +35,31 @@
 #include <LibGUI/Widget.h>
 #include <LibGfx/Font.h>
 
-#include "PowerDialog.h"
-
-struct PowerOption {
+struct Option {
     String title;
     Vector<char const*> cmd;
     bool enabled;
     bool default_action;
 };
 
-static const Vector<PowerOption> options = {
+static const Vector<Option> options = {
     { "Shut down", { "/bin/shutdown", "--now", nullptr }, true, true },
     { "Restart", { "/bin/reboot", nullptr }, true, false },
     { "Log out", {}, false, false },
     { "Sleep", {}, false, false },
 };
 
-Vector<char const*> PowerDialog::show()
+Vector<char const*> ShutdownDialog::show()
 {
-    auto rc = PowerDialog::construct()->exec();
-    if(rc == ExecResult::ExecOK)
+    auto rc = ShutdownDialog::construct()->exec();
+    if (rc == ExecResult::ExecOK)
         return options[rc].cmd;
 
     return {};
 }
 
-PowerDialog::PowerDialog()
-	: GUI::Dialog(nullptr)
+ShutdownDialog::ShutdownDialog()
+    : Dialog(nullptr)
 {
     Gfx::Rect rect({ 0, 0, 180, 180 + ((static_cast<int>(options.size()) - 3) * 16) });
     rect.center_within(GUI::Desktop::the().rect());
@@ -114,6 +113,6 @@ PowerDialog::PowerDialog()
     cancel_button.set_text("Cancel");
 }
 
-PowerDialog::~PowerDialog()
+ShutdownDialog::~ShutdownDialog()
 {
 }

+ 5 - 5
Services/SystemMenu/PowerDialog.h → Services/SystemMenu/ShutdownDialog.h

@@ -25,17 +25,17 @@
  */
 
 #include <AK/Vector.h>
-#include <LibCore/Object.h>
 #include <LibGUI/Dialog.h>
 
-class PowerDialog : public GUI::Dialog {
-    C_OBJECT(PowerDialog)
+class ShutdownDialog : public GUI::Dialog {
+    C_OBJECT(ShutdownDialog);
+
 public:
     static Vector<char const*> show();
 
 private:
-    PowerDialog();
-    ~PowerDialog();
+    ShutdownDialog();
+    virtual ~ShutdownDialog() override;
 
     int m_selected_option { -1 };
 };

+ 2 - 2
Services/SystemMenu/main.cpp

@@ -24,7 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "PowerDialog.h"
+#include "ShutdownDialog.h"
 #include <AK/FileSystemPath.h>
 #include <AK/QuickSort.h>
 #include <LibCore/ConfigFile.h>
@@ -203,7 +203,7 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
     }));
     system_menu->add_separator();
     system_menu->add_action(GUI::Action::create("Exit...", [](auto&) {
-        Vector<char const*> command = PowerDialog::show();
+        auto command = ShutdownDialog::show();
 
         if (command.size() == 0)
             return;