Add docs for UI views

This commit is contained in:
Andrew nuark G 2021-01-10 21:55:35 +07:00
parent 9306786beb
commit bc591244c4
9 changed files with 342 additions and 3 deletions

View file

@ -17,42 +17,108 @@
#include "entities/dpoint_entity.h" #include "entities/dpoint_entity.h"
/**
* @brief Namespace for UI layout MOC to be generated
*
*/
namespace Ui { class AdminPanel; } namespace Ui { class AdminPanel; }
/**
* @brief Administration window
*
*/
class AdminPanel : public QMainWindow { class AdminPanel : public QMainWindow {
private: private:
Q_OBJECT Q_OBJECT
//! Layout object
Ui::AdminPanel *ui; Ui::AdminPanel *ui;
//! Current user object
user_entity user; user_entity user;
//! Users ViewModel
UsersViewModel *uvm; UsersViewModel *uvm;
//! Vessels ViewModel
VesselsViewModel *vvm; VesselsViewModel *vvm;
//! Delivery points ViewModel
DeliveryPointsViewModel *dpvm; DeliveryPointsViewModel *dpvm;
public: public:
/**
* @brief Construct a new Admin Panel
*
* @param parent [ignored]
*/
explicit AdminPanel(QWidget *parent = nullptr); explicit AdminPanel(QWidget *parent = nullptr);
/**
* @brief Destroy the Admin Panel
*
*/
~AdminPanel(); ~AdminPanel();
/**
* @brief Builder-like function, to set current user
*
* @param user new current user reference
* @return AdminPanel&
*/
AdminPanel& set_user(const user_entity &user); AdminPanel& set_user(const user_entity &user);
signals: signals:
/**
* @brief Then user set signal
*
*/
void user_set(); void user_set();
private slots: private slots:
/**
* @brief On user set slot
*
*/
void on_user_set(); void on_user_set();
private: private:
/**
* @brief Action to be called, then user pressed logout button
*
*/
void on_logout_requested(); 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); void on_vessel_add_edit(bool edit);
/**
* @brief Action to be called, whenever user wants to remove vessel
*
*/
void on_vessel_remove(); 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); void on_user_add_edit(bool edit);
/**
* @brief Action to be called, whenever user wants to remove user
*
*/
void on_user_remove(); 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); 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(); void on_delivery_point_remove();
}; };

View file

@ -10,19 +10,40 @@
#include <QMessageBox> #include <QMessageBox>
/**
* @brief Namespace for UI layout MOC to be generated
*
*/
namespace Ui { class AuthWindow; } namespace Ui { class AuthWindow; }
/**
* @brief Auth window
*
*/
class AuthWindow : public QMainWindow { class AuthWindow : public QMainWindow {
private: private:
Q_OBJECT Q_OBJECT
//! Layout object
Ui::AuthWindow *ui; Ui::AuthWindow *ui;
public: public:
/**
* @brief Construct a new Auth window
*
* @param parent [ignored]
*/
explicit AuthWindow(QWidget *parent = nullptr); explicit AuthWindow(QWidget *parent = nullptr);
/**
* @brief Destroy the Auth window
*
*/
~AuthWindow(); ~AuthWindow();
private: private:
/**
* @brief Action to be called, then user pressed login button
*
*/
void on_auth_requested(); void on_auth_requested();
}; };

View file

@ -7,22 +7,50 @@
#include "entities/cargo_entity.h" #include "entities/cargo_entity.h"
/**
* @brief Namespace for UI layout MOC to be generated
*
*/
namespace Ui { class CargoEditDialog; } namespace Ui { class CargoEditDialog; }
/**
* @brief Cargo edit Dialog
*
*/
class CargoEditDialog : public QDialog { class CargoEditDialog : public QDialog {
private: private:
Q_OBJECT Q_OBJECT
//! Layout object
Ui::CargoEditDialog *ui; Ui::CargoEditDialog *ui;
//! Cargo entity object
cargo_entity *_cargo; cargo_entity *_cargo;
public: public:
/**
* @brief Construct a new Cargo Edit Dialog
*
* @param parent [ignored]
*/
explicit CargoEditDialog(QWidget *parent = nullptr); explicit CargoEditDialog(QWidget *parent = nullptr);
/**
* @brief Destroy the Cargo Edit Dialog
*
*/
~CargoEditDialog(); ~CargoEditDialog();
/**
* @brief Returns cargo object pointer
*
* @return cargo_entity*
*/
cargo_entity* cargo(); cargo_entity* cargo();
public slots: public slots:
/**
* @brief Dialog accept slot
*
*/
void accept() Q_DECL_OVERRIDE; void accept() Q_DECL_OVERRIDE;
}; };

View file

@ -13,29 +13,73 @@
#include "storageeditdialog.h" #include "storageeditdialog.h"
/**
* @brief Namespace for UI layout MOC to be generated
*
*/
namespace Ui { class DeliveryPointEditDialog; } namespace Ui { class DeliveryPointEditDialog; }
/**
* @brief Delivery point edit Dialog
*
*/
class DeliveryPointEditDialog : public QDialog { class DeliveryPointEditDialog : public QDialog {
private: private:
Q_OBJECT Q_OBJECT
//! Layout object
Ui::DeliveryPointEditDialog *ui; Ui::DeliveryPointEditDialog *ui;
//! ViewModel for DP's storages
QStringListModel *svm; QStringListModel *svm;
//! Delivery point object
dpoint_entity *_dp; dpoint_entity *_dp;
public: public:
/**
* @brief Construct a new Delivery Point Edit Dialog
*
* @param parent [ignored]
*/
explicit DeliveryPointEditDialog(QWidget *parent = nullptr); explicit DeliveryPointEditDialog(QWidget *parent = nullptr);
/**
* @brief Destroy the Delivery Point Edit Dialog
*
*/
~DeliveryPointEditDialog(); ~DeliveryPointEditDialog();
/**
* @brief Returns delivery point object pointer
*
* @return dpoint_entity*
*/
dpoint_entity* dpoint() const; dpoint_entity* dpoint() const;
/**
* @brief Set delivery point object
*
* @param dpoint
* @param edit
*/
void set_dpoint(dpoint_entity* dpoint, bool edit); void set_dpoint(dpoint_entity* dpoint, bool edit);
public slots: public slots:
/**
* @brief On new storage add slot
*
* @param edit
*/
void on_storage_edit_add(bool edit); void on_storage_edit_add(bool edit);
/**
* @brief Dialog accept slot
*
*/
void accept() Q_DECL_OVERRIDE; void accept() Q_DECL_OVERRIDE;
private: private:
/**
* @brief Updates storages list
*
*/
void update_list(); void update_list();
}; };

View file

@ -4,6 +4,13 @@
#include <QApplication> #include <QApplication>
/**
* @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[]) { int main(int argc, char *argv[]) {
QApplication a(argc, argv); QApplication a(argc, argv);

View file

@ -11,30 +11,67 @@
#include "entities/vessel_entity.h" #include "entities/vessel_entity.h"
/**
* @brief Namespace for UI layout MOC to be generated
*
*/
namespace Ui { class SkipperPanel; } namespace Ui { class SkipperPanel; }
/**
* @brief Skipper info panel
*
*/
class SkipperPanel : public QMainWindow { class SkipperPanel : public QMainWindow {
private: private:
Q_OBJECT Q_OBJECT
//! Layout object
Ui::SkipperPanel *ui; Ui::SkipperPanel *ui;
//! User entity object
user_entity user; user_entity user;
//! Cargo ViewModel
CargoViewModel *cvm; CargoViewModel *cvm;
public: public:
/**
* @brief Construct a new Skipper Panel
*
* @param parent [ignored]
*/
explicit SkipperPanel(QWidget *parent = nullptr); explicit SkipperPanel(QWidget *parent = nullptr);
/**
* @brief Destroy the Skipper Panel
*
*/
~SkipperPanel(); ~SkipperPanel();
/**
* @brief Set user object
*
* @param user
* @return SkipperPanel&
*/
SkipperPanel& set_user(const user_entity &user); SkipperPanel& set_user(const user_entity &user);
signals: signals:
/**
* @brief Then user set signal
*
*/
void user_set(); void user_set();
private slots: private slots:
/**
* @brief On user set slot
*
*/
void on_user_set(); void on_user_set();
private: private:
/**
* @brief Action to be called, then user pressed logout button
*
*/
void on_logout_requested(); void on_logout_requested();
}; };

View file

@ -10,25 +10,64 @@
#include "cargoeditdialog.h" #include "cargoeditdialog.h"
/**
* @brief Namespace for UI layout MOC to be generated
*
*/
namespace Ui { class StorageEditDialog; } namespace Ui { class StorageEditDialog; }
/**
* @brief Storage edit Dialog
*
*/
class StorageEditDialog : public QDialog { class StorageEditDialog : public QDialog {
private: private:
Q_OBJECT Q_OBJECT
//! Layout object
Ui::StorageEditDialog *ui; Ui::StorageEditDialog *ui;
//! Cargo ViewModel
CargoViewModel *cvm; CargoViewModel *cvm;
//! Storage object
storage_entity *_storage; storage_entity *_storage;
public: public:
/**
* @brief Construct a new Storage Edit Dialog
*
* @param parent [ignored]
*/
explicit StorageEditDialog(QWidget *parent = nullptr); explicit StorageEditDialog(QWidget *parent = nullptr);
/**
* @brief Destroy the Storage Edit Dialog
*
*/
~StorageEditDialog(); ~StorageEditDialog();
/**
* @brief Returns storage object pointer
*
* @return storage_entity*
*/
storage_entity* storage(); storage_entity* storage();
/**
* @brief Set storage object
*
* @param ent
* @param edit
*/
void set_storage(storage_entity *ent, bool edit); void set_storage(storage_entity *ent, bool edit);
public slots: public slots:
/**
* @brief On new cargo add slot
*
*/
void on_cargo_add(); void on_cargo_add();
/**
* @brief Dialog accept slot
*
*/
void accept() Q_DECL_OVERRIDE; void accept() Q_DECL_OVERRIDE;
}; };

View file

@ -7,30 +7,72 @@
#include "entities/user_entity.h" #include "entities/user_entity.h"
/**
* @brief Namespace for UI layout MOC to be generated
*
*/
namespace Ui { class UserEditDialog; } namespace Ui { class UserEditDialog; }
/**
* @brief User data struct for new user's data to be moved
*
*/
struct user_data_struct { struct user_data_struct {
//! User's login
QString login; QString login;
//! User's password
QString password; QString password;
//! User's account role
UserRole role; UserRole role;
//! Are we editing user?
bool edit; bool edit;
}; };
/**
* @brief User edit Dialog
*
*/
class UserEditDialog : public QDialog { class UserEditDialog : public QDialog {
private: private:
Q_OBJECT Q_OBJECT
//! Layout object
Ui::UserEditDialog *ui; Ui::UserEditDialog *ui;
//! User data structure pointer
user_data_struct *_user_data; user_data_struct *_user_data;
public: public:
/**
* @brief Construct a new User Edit Dialog
*
* @param parent [ignored]
*/
explicit UserEditDialog(QWidget *parent = nullptr); explicit UserEditDialog(QWidget *parent = nullptr);
/**
* @brief Destroy the User Edit Dialog
*
*/
~UserEditDialog(); ~UserEditDialog();
/**
* @brief Returns user data pointer
*
* @return user_data_struct*
*/
user_data_struct* user_data() const; user_data_struct* user_data() const;
/**
* @brief Set user object
*
* @param user
* @param edit
*/
void set_user(user_entity* user, bool edit); void set_user(user_entity* user, bool edit);
public slots: public slots:
/**
* @brief Dialog accept slot
*
*/
void accept() Q_DECL_OVERRIDE; void accept() Q_DECL_OVERRIDE;
}; };

View file

@ -11,31 +11,86 @@
#include "cargoeditdialog.h" #include "cargoeditdialog.h"
/**
* @brief Namespace for UI layout MOC to be generated
*
*/
namespace Ui { class VesselEditDialog; } namespace Ui { class VesselEditDialog; }
/**
* @brief Vessel edit Dialog
*
*/
class VesselEditDialog : public QDialog { class VesselEditDialog : public QDialog {
private: private:
Q_OBJECT Q_OBJECT
//! Layout object
Ui::VesselEditDialog *ui; Ui::VesselEditDialog *ui;
//! Cargo ViewModel
CargoViewModel *cvm; CargoViewModel *cvm;
//! Vessel entity pointer
vessel_entity *_vessel; vessel_entity *_vessel;
public: public:
/**
* @brief Construct a new Vessel Edit Dialog
*
* @param parent [ignored]
*/
explicit VesselEditDialog(QWidget *parent = nullptr); explicit VesselEditDialog(QWidget *parent = nullptr);
/**
* @brief Destroy the Vessel Edit Dialog
*
*/
~VesselEditDialog(); ~VesselEditDialog();
/**
* @brief Get dialog's vessel
*
* @return vessel_entity*
*/
vessel_entity* vessel(); 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); void set_vessel(vessel_entity *ves, bool edit);
public slots: public slots:
/**
* @brief Cargo add slot
*
*/
void on_cargo_add(); void on_cargo_add();
/**
* @brief Move cargo from harbor to vessel slot
*
*/
void on_withdraw_from_harbor(); void on_withdraw_from_harbor();
/**
* @brief Move cargo from vessel to harbor slot
*
*/
void on_withdraw_from_vessel(); void on_withdraw_from_vessel();
/**
* @brief Dialog accept slot
*
*/
void accept() Q_DECL_OVERRIDE; void accept() Q_DECL_OVERRIDE;
private: private:
/**
* @brief Correctly selects vessel's skipper
*
*/
void select_proper_skipper(); void select_proper_skipper();
/**
* @brief Correctly selects vessel's harbor
*
*/
void select_proper_port(); void select_proper_port();
}; };