diff --git a/include/ftpServer.h b/include/ftpServer.h index cfae3ac..78154ab 100644 --- a/include/ftpServer.h +++ b/include/ftpServer.h @@ -3,7 +3,7 @@ // - RFC 3659 (https://tools.ietf.org/html/rfc3659) // - suggested implementation details from https://cr.yp.to/ftp/filesystem.html // -// Copyright (C) 2023 Michael Theall +// Copyright (C) 2024 Michael Theall // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -48,6 +48,9 @@ public: /// \brief Draw server and all of its sessions void draw (); + /// \brief Whether server wants to quit + bool quit (); + /// \brief Create server static UniqueFtpServer create (); diff --git a/source/ftpServer.cpp b/source/ftpServer.cpp index 50d8091..6660deb 100644 --- a/source/ftpServer.cpp +++ b/source/ftpServer.cpp @@ -3,7 +3,7 @@ // - RFC 3659 (https://tools.ietf.org/html/rfc3659) // - suggested implementation details from https://cr.yp.to/ftp/filesystem.html // -// Copyright (C) 2023 Michael Theall +// Copyright (C) 2024 Michael Theall // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -322,6 +322,11 @@ void FtpServer::draw () #endif } +bool FtpServer::quit () +{ + return m_quit; +} + UniqueFtpServer FtpServer::create () { updateFreeSpace (); @@ -490,9 +495,16 @@ void FtpServer::showMenu () } } + ImGui::Separator (); + if (ImGui::MenuItem ("About")) m_showAbout = true; + ImGui::Separator (); + + if (ImGui::MenuItem ("Quit")) + m_quit = true; + ImGui::EndMenu (); } ImGui::EndMenuBar (); @@ -713,7 +725,7 @@ void FtpServer::showAbout () ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize)) { ImGui::TextUnformatted (STATUS_STRING); - ImGui::TextWrapped ("Copyright © 2023 Michael Theall, Dave Murphy, TuxSH"); + ImGui::TextWrapped ("Copyright © 2024 Michael Theall, Dave Murphy, TuxSH"); ImGui::Separator (); ImGui::Text ("Platform: %s", io.BackendPlatformName); ImGui::Text ("Renderer: %s", io.BackendRendererName); diff --git a/source/main.cpp b/source/main.cpp index 3703a16..990e4c0 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -3,7 +3,7 @@ // - RFC 3659 (https://tools.ietf.org/html/rfc3659) // - suggested implementation details from https://cr.yp.to/ftp/filesystem.html // -// Copyright (C) 2023 Michael Theall +// Copyright (C) 2024 Michael Theall // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -56,7 +56,7 @@ int main () auto server = FtpServer::create (); - while (platform::loop ()) + while (!server->quit () && platform::loop ()) { server->draw ();