From 4aeb0d572200178bd622206553eefe6996d2281c Mon Sep 17 00:00:00 2001 From: Andrew nuark G Date: Sun, 27 Dec 2020 20:31:05 +0700 Subject: [PATCH] Some fixes --- sea_transport/authwindow.cpp | 7 +++++-- sea_transport/authwindow.h | 1 + sea_transport/skipperpanel.cpp | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sea_transport/authwindow.cpp b/sea_transport/authwindow.cpp index 1002bdb..ecfe549 100644 --- a/sea_transport/authwindow.cpp +++ b/sea_transport/authwindow.cpp @@ -61,8 +61,11 @@ void AuthWindow::on_auth_requested() { ((AdminPanel*) w)->set_user(*user); } else if (user->role() == UserRole::SKIPPER) { - // SkipperPanel(nullptr, user).set_user(user).show(); - return; + QMessageBox::information(this, "Info", "Please note: if you have more than one vessel assigned to you " + "only first will be shown (it is intended by design, you cannot physically control two ships). \n" + "Please, ask your local dispatcher/administrator to unassign you from other vessels."); + w = new SkipperPanel(nullptr); + ((SkipperPanel*) w)->set_user(*user); } else { QMessageBox::critical(this, "Error", "Deserialized user have wrong type. " diff --git a/sea_transport/authwindow.h b/sea_transport/authwindow.h index e0f174e..f438c65 100644 --- a/sea_transport/authwindow.h +++ b/sea_transport/authwindow.h @@ -4,6 +4,7 @@ #include "system/apparatus.h" #include "adminpanel.h" +#include "skipperpanel.h" #include #include diff --git a/sea_transport/skipperpanel.cpp b/sea_transport/skipperpanel.cpp index dccf3c9..8618d7f 100644 --- a/sea_transport/skipperpanel.cpp +++ b/sea_transport/skipperpanel.cpp @@ -10,6 +10,8 @@ SkipperPanel::SkipperPanel(QWidget *parent) : QMainWindow(parent), ui(new Ui::Sk cvm = new CargoViewModel(this); ui->tv_cargo->setModel(this->cvm); + + connect(this, &SkipperPanel::user_set, this, &SkipperPanel::on_user_set); } SkipperPanel::~SkipperPanel() { @@ -66,7 +68,7 @@ void SkipperPanel::on_user_set() { foreach (auto c, vessel.cargo()) { cap_used += c.volume(); } - ui->lab_capacity->setText(tr("%1/%2/%3").arg(cap_used, vessel.capacity(), vessel.capacity() + cap_used)); + ui->lab_capacity->setText(tr("%1/%2/%3").arg(cap_used).arg(vessel.capacity() - cap_used).arg(vessel.capacity())); this->cvm->set_data(vessel.cargo()); }