diff --git a/README.md b/README.md index 1768639..3e1cd93 100644 --- a/README.md +++ b/README.md @@ -25,14 +25,13 @@ In the future it should have apps that work using SQL, SDL and even web requests ``` C++ MultiApp/ // Core application files -├── src/ // C++ Source Files -│ └── include/ // C++ Header Files -│ -├── res/ // Misc Resources -│ └── gtk/ // Gtk UI Resources +├── include/ // C++ Project and Test Header Files +├── src/ // Main C++ Project Source Files +├── resources/ // Misc Resources +│ │── gtk/ // Gtk UI Resources +│ └── screenshots/ // README Screenshots │ └── tests/ // Test Source Files - └── include/ // Tests Header Files ``` ## 🗺️ Roadmap @@ -99,13 +98,13 @@ and run with ```sudo docker run -it --rm -e DISPLAY=$DISPLAY --network host -v / Here are some screenshots of the funtioning app on Linux. Fresh window when opening browser app: -![Browser App](https://github.com/dxchel/MultiApp/blob/main/res/screenshots/fresh_window.png) +![Browser App](https://github.com/dxchel/MultiApp/blob/main/resources/screenshots/fresh_window.png) Window after adding directions and returning to project repo in URL history, notice both back and forward buttons enabled: -![Added some directions and returned to project Repo](https://github.com/dxchel/MultiApp/blob/main/res/screenshots/multiapp_repo.png) +![Added some directions and returned to project Repo](https://github.com/dxchel/MultiApp/blob/main/resources/screenshots/multiapp_repo.png) Fractal app window: -![Fractal App](https://github.com/dxchel/MultiApp/blob/main/res/screenshots/fractal.png) +![Fractal App](https://github.com/dxchel/MultiApp/blob/main/resources/screenshots/fractal.png) Chat app window: -![Chat App](https://github.com/dxchel/MultiApp/blob/main/res/screenshots/chat.png) +![Chat App](https://github.com/dxchel/MultiApp/blob/main/resources/screenshots/chat.png) diff --git a/src/include/browser_app.hpp b/include/browser_app.hpp similarity index 97% rename from src/include/browser_app.hpp rename to include/browser_app.hpp index 6f9dfbd..e268550 100644 --- a/src/include/browser_app.hpp +++ b/include/browser_app.hpp @@ -20,7 +20,7 @@ class Browser : public Gtk::Box { /** * @brief Creates Browser object with all needed Widgets and signals. * - * Creates Browser object using res/gtk/browser_app.ui file, + * Creates Browser object using resources/gtk/browser_app.ui file, * Checks for file issues, gets Widgets and connects needed signals. */ Browser(); diff --git a/src/include/chat_app.hpp b/include/chat_app.hpp similarity index 96% rename from src/include/chat_app.hpp rename to include/chat_app.hpp index 80598be..e529e65 100644 --- a/src/include/chat_app.hpp +++ b/include/chat_app.hpp @@ -20,7 +20,7 @@ class Chat : public Gtk::Box { /** * @brief Creates Chat object with all needed Widgets and signals. * - * Creates Chat object using res/gtk/chat_app.ui file, + * Creates Chat object using resources/gtk/chat_app.ui file, * Checks for file issues, gets Widgets and connects needed signals. */ Chat(); diff --git a/src/include/fractal_app.hpp b/include/fractal_app.hpp similarity index 98% rename from src/include/fractal_app.hpp rename to include/fractal_app.hpp index 5dab490..7e10e02 100644 --- a/src/include/fractal_app.hpp +++ b/include/fractal_app.hpp @@ -173,7 +173,7 @@ class Fractal : public Gtk::Box { /** * @brief Creates FractalBox object with all needed Widgets and signals. * - * Creates FractalBox object using res/gtk/fractal_app.ui file, + * Creates FractalBox object using resources/gtk/fractal_app.ui file, * Checks for file issues, gets Widgets and connects needed signals. */ Fractal(); diff --git a/include/main_application.hpp b/include/main_application.hpp new file mode 100644 index 0000000..6fa468a --- /dev/null +++ b/include/main_application.hpp @@ -0,0 +1,51 @@ +#pragma once + +#include + + +/** + * @brief MainApplication class containing other apps in project. + * + * Gtk::Application that initializes a window containing needed + * Widgets for containing core apps in the project and running functions. + */ +class MainApplication : public Gtk::Application { + friend class MainApplicationTest; + friend class MainApplicationTest_MainApplicationStructureTest_Test; + +public: + Gtk::Label *status_label{}; + + /** + * @brief Creates RefPtr using class constructor. + * + * @return New MainApplication object RefPtr. + */ + static Glib::RefPtr create(); + +private: + Gtk::ApplicationWindow *main_window{}; + Gtk::Box *selected_app{}; + + std::vector>> apps{}; + + /** + * @brief Creates ApplicationWindow to show. + * + * Creates and populates the main ApplicationWindow using + * resources/gtk/main_app.ui file as base and adding Apps into it. + * + * @return New ApplicationWindow to use in the program. + */ + Gtk::ApplicationWindow* create_window(); + + /** + * @brief Creates MainApplication object with application id and handles. + */ + MainApplication(); + + /** + * @brief Presents main window. + */ + void on_activate() override; +}; diff --git a/src/include/session.hpp b/include/session.hpp similarity index 100% rename from src/include/session.hpp rename to include/session.hpp diff --git a/tests/include/tests.hpp b/include/tests.hpp similarity index 94% rename from tests/include/tests.hpp rename to include/tests.hpp index 40ffba6..32f2f1a 100644 --- a/tests/include/tests.hpp +++ b/include/tests.hpp @@ -1,9 +1,9 @@ #pragma once -#include "../../src/include/main_application.hpp" -#include "../../src/include/browser_app.hpp" -#include "../../src/include/fractal_app.hpp" -#include "../../src/include/chat_app.hpp" +#include "main_application.hpp" +#include "browser_app.hpp" +#include "fractal_app.hpp" +#include "chat_app.hpp" #include #include diff --git a/res/gtk/browser_app.ui b/resources/gtk/browser_app.ui similarity index 100% rename from res/gtk/browser_app.ui rename to resources/gtk/browser_app.ui diff --git a/res/gtk/chat_app.css b/resources/gtk/chat_app.css similarity index 100% rename from res/gtk/chat_app.css rename to resources/gtk/chat_app.css diff --git a/res/gtk/chat_app.ui b/resources/gtk/chat_app.ui similarity index 100% rename from res/gtk/chat_app.ui rename to resources/gtk/chat_app.ui diff --git a/res/gtk/fractal_app.ui b/resources/gtk/fractal_app.ui similarity index 100% rename from res/gtk/fractal_app.ui rename to resources/gtk/fractal_app.ui diff --git a/res/gtk/main_app.ui b/resources/gtk/main_app.ui similarity index 100% rename from res/gtk/main_app.ui rename to resources/gtk/main_app.ui diff --git a/res/screenshots/chat.png b/resources/screenshots/chat.png similarity index 100% rename from res/screenshots/chat.png rename to resources/screenshots/chat.png diff --git a/res/screenshots/fractal.png b/resources/screenshots/fractal.png similarity index 100% rename from res/screenshots/fractal.png rename to resources/screenshots/fractal.png diff --git a/res/screenshots/fresh_window.png b/resources/screenshots/fresh_window.png similarity index 100% rename from res/screenshots/fresh_window.png rename to resources/screenshots/fresh_window.png diff --git a/res/screenshots/multiapp_repo.png b/resources/screenshots/multiapp_repo.png similarity index 100% rename from res/screenshots/multiapp_repo.png rename to resources/screenshots/multiapp_repo.png diff --git a/src/browser_app.cc b/src/browser_app.cc index c13a255..c90a8aa 100644 --- a/src/browser_app.cc +++ b/src/browser_app.cc @@ -1,4 +1,4 @@ -#include "include/browser_app.hpp" +#include "../include/browser_app.hpp" #include #include @@ -11,7 +11,7 @@ Browser::Browser() : Gtk::Box(Gtk::Orientation::VERTICAL) { // Load the GtkBuilder file and instantiate its widgets, check for errors auto ref_builder {Gtk::Builder::create()}; try { - ref_builder->add_from_file("res/gtk/browser_app.ui"); + ref_builder->add_from_file("resources/gtk/browser_app.ui"); } catch(const Glib::FileError& ex) { std::cerr << "FileError: " << ex.what() << std::endl; throw ex; diff --git a/src/chat_app.cc b/src/chat_app.cc index 7fb45ce..547ffc8 100644 --- a/src/chat_app.cc +++ b/src/chat_app.cc @@ -1,5 +1,5 @@ -#include "include/chat_app.hpp" -#include "include/session.hpp" +#include "../include/chat_app.hpp" +#include "../include/session.hpp" #include #include @@ -11,7 +11,7 @@ Chat::Chat() : Gtk::Box(Gtk::Orientation::VERTICAL) { // Load the GtkBuilder file and instantiate its widgets, check for errors auto ref_builder {Gtk::Builder::create()}; try { - ref_builder->add_from_file("res/gtk/chat_app.ui"); + ref_builder->add_from_file("resources/gtk/chat_app.ui"); } catch(const Glib::FileError& ex) { std::cerr << "FileError: " << ex.what() << "\n"; throw ex; @@ -61,7 +61,7 @@ Chat::Chat() : Gtk::Box(Gtk::Orientation::VERTICAL) { // Add css to the default display auto css_provider = Gtk::CssProvider::create(); - css_provider->load_from_path("./res/gtk/chat_app.css"); + css_provider->load_from_path("./resources/gtk/chat_app.css"); Gtk::StyleContext::add_provider_for_display( Gdk::Display::get_default(), diff --git a/src/fractal_app.cc b/src/fractal_app.cc index c82e96b..f5564df 100644 --- a/src/fractal_app.cc +++ b/src/fractal_app.cc @@ -1,4 +1,4 @@ -#include "include/fractal_app.hpp" +#include "../include/fractal_app.hpp" #include #include @@ -164,7 +164,7 @@ Fractal::Fractal() : Gtk::Box(Gtk::Orientation::HORIZONTAL) { // Load the GtkBuilder file and instantiate its widgets, check for errors auto ref_builder {Gtk::Builder::create()}; try { - ref_builder->add_from_file("res/gtk/fractal_app.ui"); + ref_builder->add_from_file("resources/gtk/fractal_app.ui"); } catch(const Glib::FileError& ex) { std::cerr << "FileError: " << ex.what() << std::endl; throw ex; diff --git a/src/include/main_application.hpp b/src/include/main_application.hpp index 252c273..6fa468a 100644 --- a/src/include/main_application.hpp +++ b/src/include/main_application.hpp @@ -33,7 +33,7 @@ class MainApplication : public Gtk::Application { * @brief Creates ApplicationWindow to show. * * Creates and populates the main ApplicationWindow using - * res/gtk/main_app.ui file as base and adding Apps into it. + * resources/gtk/main_app.ui file as base and adding Apps into it. * * @return New ApplicationWindow to use in the program. */ diff --git a/src/main.cc b/src/main.cc index b261b60..252da1f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,4 +1,4 @@ -#include "include/main_application.hpp" +#include "../include/main_application.hpp" int main(int argc, char** argv) { diff --git a/src/main_application.cc b/src/main_application.cc index 711b05f..7525cb8 100644 --- a/src/main_application.cc +++ b/src/main_application.cc @@ -1,8 +1,8 @@ -#include "include/main_application.hpp" +#include "../include/main_application.hpp" #include "gtkmm/object.h" -#include "include/browser_app.hpp" -#include "include/fractal_app.hpp" -#include "include/chat_app.hpp" +#include "../include/browser_app.hpp" +#include "../include/fractal_app.hpp" +#include "../include/chat_app.hpp" #include @@ -28,7 +28,7 @@ Gtk::ApplicationWindow* MainApplication::create_window() { // Load the GtkBuilder file and instantiate its widgets, check for errors auto ref_builder {Gtk::Builder::create()}; try { - ref_builder->add_from_file("res/gtk/main_app.ui"); + ref_builder->add_from_file("resources/gtk/main_app.ui"); } catch(const Glib::FileError& ex) { std::cerr << "FileError: " << ex.what() << std::endl; throw ex; diff --git a/src/session.cc b/src/session.cc index e9bec2d..f9f8581 100644 --- a/src/session.cc +++ b/src/session.cc @@ -1,4 +1,4 @@ -#include "include/session.hpp" +#include "../include/session.hpp" #include #include diff --git a/tests/browser_app_tests.cc b/tests/browser_app_tests.cc index df4b543..b31dabd 100644 --- a/tests/browser_app_tests.cc +++ b/tests/browser_app_tests.cc @@ -1,4 +1,4 @@ -#include "include/tests.hpp" +#include "../include/tests.hpp" #include #include diff --git a/tests/chat_app_tests.cc b/tests/chat_app_tests.cc index 0fe8316..5ef39c5 100644 --- a/tests/chat_app_tests.cc +++ b/tests/chat_app_tests.cc @@ -1,4 +1,4 @@ -#include "include/tests.hpp" +#include "../include/tests.hpp" #include #include diff --git a/tests/fractal_app_tests.cc b/tests/fractal_app_tests.cc index efd7668..2cc4b9c 100644 --- a/tests/fractal_app_tests.cc +++ b/tests/fractal_app_tests.cc @@ -1,4 +1,4 @@ -#include "include/tests.hpp" +#include "../include/tests.hpp" #include diff --git a/tests/main.cc b/tests/main.cc index d6bb779..a3416de 100644 --- a/tests/main.cc +++ b/tests/main.cc @@ -1,4 +1,4 @@ -#include "include/tests.hpp" +#include "../include/tests.hpp" #include diff --git a/tests/main_application_tests.cc b/tests/main_application_tests.cc index eddcc14..b50ef02 100644 --- a/tests/main_application_tests.cc +++ b/tests/main_application_tests.cc @@ -1,4 +1,4 @@ -#include "include/tests.hpp" +#include "../include/tests.hpp" #include #include