From bc591244c4831cc1645f34f3ad74d35321c48b71 Mon Sep 17 00:00:00 2001 From: Andrew nuark G Date: Sun, 10 Jan 2021 21:55:35 +0700 Subject: [PATCH] Add docs for UI views --- sea_transport/adminpanel.h | 68 ++++++++++++++++++++++++- sea_transport/authwindow.h | 23 ++++++++- sea_transport/cargoeditdialog.h | 28 ++++++++++ sea_transport/deliverypointeditdialog.h | 44 ++++++++++++++++ sea_transport/main.cpp | 7 +++ sea_transport/skipperpanel.h | 39 +++++++++++++- sea_transport/storageeditdialog.h | 39 ++++++++++++++ sea_transport/usereditdialog.h | 42 +++++++++++++++ sea_transport/vesseleditdialog.h | 55 ++++++++++++++++++++ 9 files changed, 342 insertions(+), 3 deletions(-) diff --git a/sea_transport/adminpanel.h b/sea_transport/adminpanel.h index 8a729ce..ee3dca1 100644 --- a/sea_transport/adminpanel.h +++ b/sea_transport/adminpanel.h @@ -17,42 +17,108 @@ #include "entities/dpoint_entity.h" +/** + * @brief Namespace for UI layout MOC to be generated + * + */ namespace Ui { class AdminPanel; } +/** + * @brief Administration window + * + */ class AdminPanel : public QMainWindow { private: Q_OBJECT - + //! Layout object Ui::AdminPanel *ui; + //! Current user object user_entity user; + //! Users ViewModel UsersViewModel *uvm; + //! Vessels ViewModel VesselsViewModel *vvm; + //! Delivery points ViewModel DeliveryPointsViewModel *dpvm; public: + /** + * @brief Construct a new Admin Panel + * + * @param parent [ignored] + */ explicit AdminPanel(QWidget *parent = nullptr); + /** + * @brief Destroy the Admin Panel + * + */ ~AdminPanel(); + /** + * @brief Builder-like function, to set current user + * + * @param user new current user reference + * @return AdminPanel& + */ AdminPanel& set_user(const user_entity &user); signals: + /** + * @brief Then user set signal + * + */ void user_set(); private slots: + /** + * @brief On user set slot + * + */ void on_user_set(); private: + /** + * @brief Action to be called, then user pressed logout button + * + */ void on_logout_requested(); + /** + * @brief Action to be called, whenever user wants to edit or add new vessel + * + * @param edit is it creation or edit intent + */ void on_vessel_add_edit(bool edit); + /** + * @brief Action to be called, whenever user wants to remove vessel + * + */ void on_vessel_remove(); + /** + * @brief Action to be called, whenever user wants to edit or add new user + * + * @param edit is it creation or edit intent + */ void on_user_add_edit(bool edit); + /** + * @brief Action to be called, whenever user wants to remove user + * + */ void on_user_remove(); + /** + * @brief Action to be called, whenever user wants to edit or add new delivery point + * + * @param edit is it creation or edit intent + */ void on_delivery_point_add_edit(bool edit); + /** + * @brief Action to be called, whenever user wants to remove delivery point + * + */ void on_delivery_point_remove(); }; diff --git a/sea_transport/authwindow.h b/sea_transport/authwindow.h index bf7efb8..a07e41e 100644 --- a/sea_transport/authwindow.h +++ b/sea_transport/authwindow.h @@ -10,19 +10,40 @@ #include +/** + * @brief Namespace for UI layout MOC to be generated + * + */ namespace Ui { class AuthWindow; } +/** + * @brief Auth window + * + */ class AuthWindow : public QMainWindow { private: Q_OBJECT - + //! Layout object Ui::AuthWindow *ui; public: + /** + * @brief Construct a new Auth window + * + * @param parent [ignored] + */ explicit AuthWindow(QWidget *parent = nullptr); + /** + * @brief Destroy the Auth window + * + */ ~AuthWindow(); private: + /** + * @brief Action to be called, then user pressed login button + * + */ void on_auth_requested(); }; diff --git a/sea_transport/cargoeditdialog.h b/sea_transport/cargoeditdialog.h index 29822b1..79179c5 100644 --- a/sea_transport/cargoeditdialog.h +++ b/sea_transport/cargoeditdialog.h @@ -7,22 +7,50 @@ #include "entities/cargo_entity.h" +/** + * @brief Namespace for UI layout MOC to be generated + * + */ namespace Ui { class CargoEditDialog; } +/** + * @brief Cargo edit Dialog + * + */ class CargoEditDialog : public QDialog { private: Q_OBJECT + //! Layout object Ui::CargoEditDialog *ui; + //! Cargo entity object cargo_entity *_cargo; public: + /** + * @brief Construct a new Cargo Edit Dialog + * + * @param parent [ignored] + */ explicit CargoEditDialog(QWidget *parent = nullptr); + /** + * @brief Destroy the Cargo Edit Dialog + * + */ ~CargoEditDialog(); + /** + * @brief Returns cargo object pointer + * + * @return cargo_entity* + */ cargo_entity* cargo(); public slots: + /** + * @brief Dialog accept slot + * + */ void accept() Q_DECL_OVERRIDE; }; diff --git a/sea_transport/deliverypointeditdialog.h b/sea_transport/deliverypointeditdialog.h index 8d1b9a7..d58c9c7 100644 --- a/sea_transport/deliverypointeditdialog.h +++ b/sea_transport/deliverypointeditdialog.h @@ -13,29 +13,73 @@ #include "storageeditdialog.h" +/** + * @brief Namespace for UI layout MOC to be generated + * + */ namespace Ui { class DeliveryPointEditDialog; } +/** + * @brief Delivery point edit Dialog + * + */ class DeliveryPointEditDialog : public QDialog { private: Q_OBJECT + //! Layout object Ui::DeliveryPointEditDialog *ui; + //! ViewModel for DP's storages QStringListModel *svm; + //! Delivery point object dpoint_entity *_dp; public: + /** + * @brief Construct a new Delivery Point Edit Dialog + * + * @param parent [ignored] + */ explicit DeliveryPointEditDialog(QWidget *parent = nullptr); + /** + * @brief Destroy the Delivery Point Edit Dialog + * + */ ~DeliveryPointEditDialog(); + /** + * @brief Returns delivery point object pointer + * + * @return dpoint_entity* + */ dpoint_entity* dpoint() const; + /** + * @brief Set delivery point object + * + * @param dpoint + * @param edit + */ void set_dpoint(dpoint_entity* dpoint, bool edit); public slots: + /** + * @brief On new storage add slot + * + * @param edit + */ void on_storage_edit_add(bool edit); + /** + * @brief Dialog accept slot + * + */ void accept() Q_DECL_OVERRIDE; private: + /** + * @brief Updates storages list + * + */ void update_list(); }; diff --git a/sea_transport/main.cpp b/sea_transport/main.cpp index 89c4247..4752ad6 100644 --- a/sea_transport/main.cpp +++ b/sea_transport/main.cpp @@ -4,6 +4,13 @@ #include +/** + * @brief Main entry point for application + * + * @param argc command line args count + * @param argv command line args + * @return int exit code + */ int main(int argc, char *argv[]) { QApplication a(argc, argv); diff --git a/sea_transport/skipperpanel.h b/sea_transport/skipperpanel.h index edce0fd..8fa2f8d 100644 --- a/sea_transport/skipperpanel.h +++ b/sea_transport/skipperpanel.h @@ -11,30 +11,67 @@ #include "entities/vessel_entity.h" +/** + * @brief Namespace for UI layout MOC to be generated + * + */ namespace Ui { class SkipperPanel; } +/** + * @brief Skipper info panel + * + */ class SkipperPanel : public QMainWindow { private: Q_OBJECT - + //! Layout object Ui::SkipperPanel *ui; + //! User entity object user_entity user; + //! Cargo ViewModel CargoViewModel *cvm; public: + /** + * @brief Construct a new Skipper Panel + * + * @param parent [ignored] + */ explicit SkipperPanel(QWidget *parent = nullptr); + /** + * @brief Destroy the Skipper Panel + * + */ ~SkipperPanel(); + /** + * @brief Set user object + * + * @param user + * @return SkipperPanel& + */ SkipperPanel& set_user(const user_entity &user); signals: + /** + * @brief Then user set signal + * + */ void user_set(); private slots: + /** + * @brief On user set slot + * + */ void on_user_set(); private: + /** + * @brief Action to be called, then user pressed logout button + * + */ void on_logout_requested(); }; diff --git a/sea_transport/storageeditdialog.h b/sea_transport/storageeditdialog.h index 95ae41d..5bca21b 100644 --- a/sea_transport/storageeditdialog.h +++ b/sea_transport/storageeditdialog.h @@ -10,25 +10,64 @@ #include "cargoeditdialog.h" +/** + * @brief Namespace for UI layout MOC to be generated + * + */ namespace Ui { class StorageEditDialog; } +/** + * @brief Storage edit Dialog + * + */ class StorageEditDialog : public QDialog { private: Q_OBJECT + //! Layout object Ui::StorageEditDialog *ui; + //! Cargo ViewModel CargoViewModel *cvm; + //! Storage object storage_entity *_storage; public: + /** + * @brief Construct a new Storage Edit Dialog + * + * @param parent [ignored] + */ explicit StorageEditDialog(QWidget *parent = nullptr); + /** + * @brief Destroy the Storage Edit Dialog + * + */ ~StorageEditDialog(); + /** + * @brief Returns storage object pointer + * + * @return storage_entity* + */ storage_entity* storage(); + /** + * @brief Set storage object + * + * @param ent + * @param edit + */ void set_storage(storage_entity *ent, bool edit); public slots: + /** + * @brief On new cargo add slot + * + */ void on_cargo_add(); + /** + * @brief Dialog accept slot + * + */ void accept() Q_DECL_OVERRIDE; }; diff --git a/sea_transport/usereditdialog.h b/sea_transport/usereditdialog.h index c352b50..74c8230 100644 --- a/sea_transport/usereditdialog.h +++ b/sea_transport/usereditdialog.h @@ -7,30 +7,72 @@ #include "entities/user_entity.h" +/** + * @brief Namespace for UI layout MOC to be generated + * + */ namespace Ui { class UserEditDialog; } +/** + * @brief User data struct for new user's data to be moved + * + */ struct user_data_struct { + //! User's login QString login; + //! User's password QString password; + //! User's account role UserRole role; + //! Are we editing user? bool edit; }; +/** + * @brief User edit Dialog + * + */ class UserEditDialog : public QDialog { private: Q_OBJECT + //! Layout object Ui::UserEditDialog *ui; + //! User data structure pointer user_data_struct *_user_data; public: + /** + * @brief Construct a new User Edit Dialog + * + * @param parent [ignored] + */ explicit UserEditDialog(QWidget *parent = nullptr); + /** + * @brief Destroy the User Edit Dialog + * + */ ~UserEditDialog(); + /** + * @brief Returns user data pointer + * + * @return user_data_struct* + */ user_data_struct* user_data() const; + /** + * @brief Set user object + * + * @param user + * @param edit + */ void set_user(user_entity* user, bool edit); public slots: + /** + * @brief Dialog accept slot + * + */ void accept() Q_DECL_OVERRIDE; }; diff --git a/sea_transport/vesseleditdialog.h b/sea_transport/vesseleditdialog.h index 75f87dc..437a5bc 100644 --- a/sea_transport/vesseleditdialog.h +++ b/sea_transport/vesseleditdialog.h @@ -11,31 +11,86 @@ #include "cargoeditdialog.h" +/** + * @brief Namespace for UI layout MOC to be generated + * + */ namespace Ui { class VesselEditDialog; } +/** + * @brief Vessel edit Dialog + * + */ class VesselEditDialog : public QDialog { private: Q_OBJECT + //! Layout object Ui::VesselEditDialog *ui; + //! Cargo ViewModel CargoViewModel *cvm; + //! Vessel entity pointer vessel_entity *_vessel; public: + /** + * @brief Construct a new Vessel Edit Dialog + * + * @param parent [ignored] + */ explicit VesselEditDialog(QWidget *parent = nullptr); + /** + * @brief Destroy the Vessel Edit Dialog + * + */ ~VesselEditDialog(); + /** + * @brief Get dialog's vessel + * + * @return vessel_entity* + */ vessel_entity* vessel(); + /** + * @brief Set dialog vessel object + * + * @param ves vessel object + * @param edit is it edit intent + */ void set_vessel(vessel_entity *ves, bool edit); public slots: + /** + * @brief Cargo add slot + * + */ void on_cargo_add(); + /** + * @brief Move cargo from harbor to vessel slot + * + */ void on_withdraw_from_harbor(); + /** + * @brief Move cargo from vessel to harbor slot + * + */ void on_withdraw_from_vessel(); + /** + * @brief Dialog accept slot + * + */ void accept() Q_DECL_OVERRIDE; private: + /** + * @brief Correctly selects vessel's skipper + * + */ void select_proper_skipper(); + /** + * @brief Correctly selects vessel's harbor + * + */ void select_proper_port(); };