changement d'interface
This commit is contained in:
parent
5c6b908736
commit
611f444d86
@ -10,7 +10,14 @@ enum Command
|
|||||||
ShowStocks,
|
ShowStocks,
|
||||||
CreateItemType,
|
CreateItemType,
|
||||||
ShowItemTypes,
|
ShowItemTypes,
|
||||||
AddItemToStock
|
AddItemToStock,
|
||||||
|
MoveItemBetweenStocks,
|
||||||
|
RemoveItemFromStock,
|
||||||
|
DeleteStock,
|
||||||
|
DeleteItemType,
|
||||||
|
ShowStockContent,
|
||||||
|
ShowCapacities,
|
||||||
|
ShowStatistics
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COMMAND_HPP
|
#endif // COMMAND_HPP
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "../errors/stockFull.hpp"
|
#include "../errors/stockFull.hpp"
|
||||||
#include "../errors/stockEmpty.hpp"
|
#include "../errors/stockEmpty.hpp"
|
||||||
@ -81,11 +82,22 @@ void StockController::process()
|
|||||||
case Command::CreateItemType:
|
case Command::CreateItemType:
|
||||||
// Handle item type creation logic
|
// Handle item type creation logic
|
||||||
if (commandArgs.size() >= 1) {
|
if (commandArgs.size() >= 1) {
|
||||||
model->createItemType(
|
if (commandArgs.size() >= 4) {
|
||||||
commandArgs[0],
|
// Arguments complets: name, id, comment, size
|
||||||
commandArgs.size() > 1 ? commandArgs[1] : "",
|
model->createItemType(
|
||||||
commandArgs.size() > 2 ? std::stoi(commandArgs[2]) : 1
|
commandArgs[0],
|
||||||
);
|
std::stoi(commandArgs[1]),
|
||||||
|
commandArgs[2],
|
||||||
|
std::stoi(commandArgs[3])
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Arguments partiels: utiliser l'ID auto-généré
|
||||||
|
model->createItemType(
|
||||||
|
commandArgs[0],
|
||||||
|
commandArgs.size() > 1 ? commandArgs[1] : "",
|
||||||
|
commandArgs.size() > 2 ? std::stoi(commandArgs[2]) : 1
|
||||||
|
);
|
||||||
|
}
|
||||||
view->displayItemTypeCreate(model->getItemTypes().back());
|
view->displayItemTypeCreate(model->getItemTypes().back());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -107,6 +119,85 @@ void StockController::process()
|
|||||||
case Command::Refresh:
|
case Command::Refresh:
|
||||||
// Handle refresh logic here
|
// Handle refresh logic here
|
||||||
break;
|
break;
|
||||||
|
case Command::MoveItemBetweenStocks:
|
||||||
|
// Handle moving items between stocks: sourceStock, targetStock, itemType, quantity
|
||||||
|
if (commandArgs.size() >= 4) {
|
||||||
|
std::string sourceStock = commandArgs[0];
|
||||||
|
std::string targetStock = commandArgs[1];
|
||||||
|
std::string itemTypeName = commandArgs[2];
|
||||||
|
int quantity = std::stoi(commandArgs[3]);
|
||||||
|
|
||||||
|
bool success = model->moveItemBetweenStocks(sourceStock, targetStock, itemTypeName, quantity);
|
||||||
|
if (success) {
|
||||||
|
view->displayMessage("✅ Déplacement réussi: " + std::to_string(quantity) + " articles de type '" + itemTypeName + "' du stock '" + sourceStock + "' vers '" + targetStock + "'");
|
||||||
|
} else {
|
||||||
|
view->displayError("❌ Échec du déplacement des articles");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Command::RemoveItemFromStock:
|
||||||
|
// Handle removing items from stock: stockName, itemType, quantity
|
||||||
|
if (commandArgs.size() >= 3) {
|
||||||
|
std::string stockName = commandArgs[0];
|
||||||
|
std::string itemTypeName = commandArgs[1];
|
||||||
|
int quantity = std::stoi(commandArgs[2]);
|
||||||
|
|
||||||
|
bool success = model->removeItemFromStock(stockName, itemTypeName, quantity);
|
||||||
|
if (success) {
|
||||||
|
view->displayMessage("✅ Retrait réussi: " + std::to_string(quantity) + " articles de type '" + itemTypeName + "' du stock '" + stockName + "'");
|
||||||
|
} else {
|
||||||
|
view->displayError("❌ Échec du retrait des articles");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Command::DeleteStock:
|
||||||
|
// Handle stock deletion: stockName
|
||||||
|
if (commandArgs.size() >= 1) {
|
||||||
|
std::string stockName = commandArgs[0];
|
||||||
|
|
||||||
|
bool success = model->deleteStock(stockName);
|
||||||
|
if (success) {
|
||||||
|
view->displayMessage("✅ Stock '" + stockName + "' supprimé avec succès");
|
||||||
|
} else {
|
||||||
|
view->displayError("❌ Échec de la suppression du stock '" + stockName + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Command::DeleteItemType:
|
||||||
|
// Handle item type deletion: typeName
|
||||||
|
if (commandArgs.size() >= 1) {
|
||||||
|
std::string typeName = commandArgs[0];
|
||||||
|
|
||||||
|
bool success = model->deleteItemType(typeName);
|
||||||
|
if (success) {
|
||||||
|
view->displayMessage("✅ Type d'article '" + typeName + "' supprimé avec succès");
|
||||||
|
} else {
|
||||||
|
view->displayError("❌ Échec de la suppression du type '" + typeName + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Command::ShowStockContent:
|
||||||
|
// Handle showing specific stock content: stockName
|
||||||
|
if (commandArgs.size() >= 1) {
|
||||||
|
std::string stockName = commandArgs[0];
|
||||||
|
std::string content = model->getStockContentDetails(stockName);
|
||||||
|
view->displayMessage(content);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Command::ShowCapacities:
|
||||||
|
// Handle showing all stock capacities
|
||||||
|
{
|
||||||
|
std::string capacities = model->getCapacitiesReport();
|
||||||
|
view->displayMessage(capacities);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Command::ShowStatistics:
|
||||||
|
// Handle showing statistics
|
||||||
|
{
|
||||||
|
std::string statistics = model->getStatisticsReport();
|
||||||
|
view->displayMessage(statistics);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -123,6 +214,18 @@ void StockController::process()
|
|||||||
// Gérer les exceptions et afficher un message d'erreur
|
// Gérer les exceptions et afficher un message d'erreur
|
||||||
view->displayError("Invalid Item Type: " + std::string(e.what()));
|
view->displayError("Invalid Item Type: " + std::string(e.what()));
|
||||||
}
|
}
|
||||||
|
catch (const std::invalid_argument& e) {
|
||||||
|
// Gérer les erreurs de conversion de chaînes en nombres
|
||||||
|
view->displayError("Invalid argument: " + std::string(e.what()));
|
||||||
|
}
|
||||||
|
catch (const std::out_of_range& e) {
|
||||||
|
// Gérer les erreurs de débordement numérique
|
||||||
|
view->displayError("Number out of range: " + std::string(e.what()));
|
||||||
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
|
// Gérer les autres exceptions standard
|
||||||
|
view->displayError("Error: " + std::string(e.what()));
|
||||||
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
// Gérer les exceptions inconnues
|
// Gérer les exceptions inconnues
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "model.hpp"
|
#include "model.hpp"
|
||||||
#include "../errors/stockFull.hpp"
|
#include "../errors/stockFull.hpp"
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
Model::Model()
|
Model::Model()
|
||||||
{
|
{
|
||||||
@ -34,6 +35,31 @@ void Model::createItemType(const std::string &name, const std::string &comment,
|
|||||||
itemTypes.push_back(newItemType);
|
itemTypes.push_back(newItemType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Model::createItemType(const std::string &name, int id, const std::string &comment, int size)
|
||||||
|
{
|
||||||
|
// Vérifier si l'ID existe déjà
|
||||||
|
for (const auto& existingType : itemTypes) {
|
||||||
|
if (existingType.getId() == id) {
|
||||||
|
throw std::invalid_argument("ID " + std::to_string(id) + " already exists for item type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vérifier si le nom existe déjà
|
||||||
|
for (const auto& existingType : itemTypes) {
|
||||||
|
if (existingType.getName() == name) {
|
||||||
|
throw std::invalid_argument("Item type name '" + name + "' already exists");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemType newItemType(name, id, comment, size);
|
||||||
|
itemTypes.push_back(newItemType);
|
||||||
|
|
||||||
|
// Mettre à jour nextItemTypeId si nécessaire
|
||||||
|
if (id >= nextItemTypeId) {
|
||||||
|
nextItemTypeId = id + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<ItemType> Model::getItemTypes() const
|
std::vector<ItemType> Model::getItemTypes() const
|
||||||
{
|
{
|
||||||
return itemTypes;
|
return itemTypes;
|
||||||
@ -93,4 +119,145 @@ Stock* Model::findStockByName(const std::string &name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nouvelles méthodes pour la gestion avancée
|
||||||
|
|
||||||
|
bool Model::removeItemFromStock(const std::string &stockName, const std::string &itemTypeName, int quantity)
|
||||||
|
{
|
||||||
|
Stock* stock = findStockByName(stockName);
|
||||||
|
if (!stock)
|
||||||
|
{
|
||||||
|
return false; // Stock not found
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemType* itemType = findItemTypeByName(itemTypeName);
|
||||||
|
if (!itemType)
|
||||||
|
{
|
||||||
|
return false; // ItemType not found
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retirer la quantité spécifiée d'articles du stock
|
||||||
|
for (int i = 0; i < quantity; ++i)
|
||||||
|
{
|
||||||
|
if (!stock->removeItem(*itemType))
|
||||||
|
{
|
||||||
|
return false; // Impossible de retirer plus d'articles
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Model::moveItemBetweenStocks(const std::string &sourceStock, const std::string &targetStock, const std::string &itemTypeName, int quantity)
|
||||||
|
{
|
||||||
|
// Retirer du stock source
|
||||||
|
if (!removeItemFromStock(sourceStock, itemTypeName, quantity))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ajouter au stock cible
|
||||||
|
if (!addItemToStock(targetStock, itemTypeName, quantity))
|
||||||
|
{
|
||||||
|
// Si l'ajout échoue, remettre les articles dans le stock source
|
||||||
|
addItemToStock(sourceStock, itemTypeName, quantity);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Model::deleteStock(const std::string &stockName)
|
||||||
|
{
|
||||||
|
for (auto it = stocks.begin(); it != stocks.end(); ++it)
|
||||||
|
{
|
||||||
|
if (it->getName() == stockName)
|
||||||
|
{
|
||||||
|
stocks.erase(it);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false; // Stock not found
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Model::deleteItemType(const std::string &typeName)
|
||||||
|
{
|
||||||
|
for (auto it = itemTypes.begin(); it != itemTypes.end(); ++it)
|
||||||
|
{
|
||||||
|
if (it->getName() == typeName)
|
||||||
|
{
|
||||||
|
itemTypes.erase(it);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false; // ItemType not found
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Model::getStockContentDetails(const std::string &stockName)
|
||||||
|
{
|
||||||
|
Stock* stock = findStockByName(stockName);
|
||||||
|
if (!stock)
|
||||||
|
{
|
||||||
|
return "Stock '" + stockName + "' non trouvé.";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string result = "=== CONTENU DU STOCK: " + stockName + " ===\n";
|
||||||
|
result += "Capacité: " + std::to_string(stock->getCapacity()) + "\n";
|
||||||
|
result += "Occupation actuelle: " + std::to_string(stock->getCurrentSize()) + "\n";
|
||||||
|
result += "Espace libre: " + std::to_string(stock->getCapacity() - stock->getCurrentSize()) + "\n";
|
||||||
|
|
||||||
|
// Note: Il faudrait ajouter une méthode pour lister les articles dans Stock
|
||||||
|
result += "Articles: [Détails à implémenter dans la classe Stock]\n";
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Model::getCapacitiesReport()
|
||||||
|
{
|
||||||
|
std::string result = "=== RAPPORT DES CAPACITÉS ===\n";
|
||||||
|
|
||||||
|
if (stocks.empty())
|
||||||
|
{
|
||||||
|
result += "Aucun stock disponible.\n";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& stock : stocks)
|
||||||
|
{
|
||||||
|
result += "📦 " + stock.getName() + ":\n";
|
||||||
|
result += " Capacité: " + std::to_string(stock.getCapacity()) + "\n";
|
||||||
|
result += " Occupé: " + std::to_string(stock.getCurrentSize()) + "\n";
|
||||||
|
result += " Libre: " + std::to_string(stock.getCapacity() - stock.getCurrentSize()) + "\n";
|
||||||
|
result += " Utilisation: " + std::to_string((stock.getCurrentSize() * 100) / stock.getCapacity()) + "%\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Model::getStatisticsReport()
|
||||||
|
{
|
||||||
|
std::string result = "=== STATISTIQUES GÉNÉRALES ===\n";
|
||||||
|
|
||||||
|
result += "📊 Nombre total de stocks: " + std::to_string(stocks.size()) + "\n";
|
||||||
|
result += "🏷️ Nombre total de types d'articles: " + std::to_string(itemTypes.size()) + "\n";
|
||||||
|
|
||||||
|
if (!stocks.empty())
|
||||||
|
{
|
||||||
|
int totalCapacity = 0;
|
||||||
|
int totalOccupied = 0;
|
||||||
|
|
||||||
|
for (const auto& stock : stocks)
|
||||||
|
{
|
||||||
|
totalCapacity += stock.getCapacity();
|
||||||
|
totalOccupied += stock.getCurrentSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
result += "📦 Capacité totale: " + std::to_string(totalCapacity) + "\n";
|
||||||
|
result += "📋 Espace occupé: " + std::to_string(totalOccupied) + "\n";
|
||||||
|
result += "💾 Espace libre: " + std::to_string(totalCapacity - totalOccupied) + "\n";
|
||||||
|
result += "📈 Taux d'occupation global: " + std::to_string((totalOccupied * 100) / totalCapacity) + "%\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
@ -20,12 +20,22 @@ public:
|
|||||||
|
|
||||||
// Méthodes pour gérer les ItemType
|
// Méthodes pour gérer les ItemType
|
||||||
void createItemType(const std::string &name, const std::string &comment = "", int size = 1);
|
void createItemType(const std::string &name, const std::string &comment = "", int size = 1);
|
||||||
|
void createItemType(const std::string &name, int id, const std::string &comment = "", int size = 1);
|
||||||
std::vector<ItemType> getItemTypes() const;
|
std::vector<ItemType> getItemTypes() const;
|
||||||
ItemType* findItemTypeByName(const std::string &name);
|
ItemType* findItemTypeByName(const std::string &name);
|
||||||
|
|
||||||
// Méthodes pour ajouter des items aux stocks
|
// Méthodes pour ajouter des items aux stocks
|
||||||
bool addItemToStock(const std::string &stockName, const std::string &itemTypeName, int quantity);
|
bool addItemToStock(const std::string &stockName, const std::string &itemTypeName, int quantity);
|
||||||
Stock* findStockByName(const std::string &name);
|
Stock* findStockByName(const std::string &name);
|
||||||
|
|
||||||
|
// Nouvelles méthodes pour la gestion avancée
|
||||||
|
bool removeItemFromStock(const std::string &stockName, const std::string &itemTypeName, int quantity);
|
||||||
|
bool moveItemBetweenStocks(const std::string &sourceStock, const std::string &targetStock, const std::string &itemTypeName, int quantity);
|
||||||
|
bool deleteStock(const std::string &stockName);
|
||||||
|
bool deleteItemType(const std::string &typeName);
|
||||||
|
std::string getStockContentDetails(const std::string &stockName);
|
||||||
|
std::string getCapacitiesReport();
|
||||||
|
std::string getStatisticsReport();
|
||||||
private:
|
private:
|
||||||
std::vector<Stock> stocks; // Assuming Stock is a class defined elsewhere
|
std::vector<Stock> stocks; // Assuming Stock is a class defined elsewhere
|
||||||
std::vector<ItemType> itemTypes; // Assuming ItemType is a class defined elsewhere
|
std::vector<ItemType> itemTypes; // Assuming ItemType is a class defined elsewhere
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "errors/stockFull.hpp"
|
#include "../errors/stockFull.hpp"
|
||||||
#include "errors/stockEmpty.hpp"
|
#include "../errors/stockEmpty.hpp"
|
||||||
#include "errors/invalidItemType.hpp"
|
#include "../errors/invalidItemType.hpp"
|
||||||
|
|
||||||
Stock::Stock(const std::string &name, int capacity, const std::string &comment, int id)
|
Stock::Stock(const std::string &name, int capacity, const std::string &comment, int id)
|
||||||
: name(name), capacity(capacity), comment(comment), id(id)
|
: name(name), capacity(capacity), comment(comment), id(id)
|
||||||
@ -44,6 +44,29 @@ void Stock::removeItem(int id)
|
|||||||
[id](const ItemType &item) { return item.getId() == id; }), items.end());
|
[id](const ItemType &item) { return item.getId() == id; }), items.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Stock::removeItem(const ItemType &item)
|
||||||
|
{
|
||||||
|
if (items.empty())
|
||||||
|
{
|
||||||
|
return false; // No items to remove
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trouver le premier article du même type
|
||||||
|
auto it = std::find_if(items.begin(), items.end(),
|
||||||
|
[&item](const ItemType &stockItem) {
|
||||||
|
return stockItem.getName() == item.getName();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (it != items.end())
|
||||||
|
{
|
||||||
|
currentSize -= it->getSize();
|
||||||
|
items.erase(it);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false; // Item type not found in stock
|
||||||
|
}
|
||||||
|
|
||||||
ItemType Stock::getItem(int id) const
|
ItemType Stock::getItem(int id) const
|
||||||
{
|
{
|
||||||
for (const auto &item : items)
|
for (const auto &item : items)
|
||||||
|
@ -13,6 +13,7 @@ public:
|
|||||||
|
|
||||||
void addItem(const ItemType &item);
|
void addItem(const ItemType &item);
|
||||||
void removeItem(int id);
|
void removeItem(int id);
|
||||||
|
bool removeItem(const ItemType &item); // Nouvelle méthode
|
||||||
ItemType getItem(int id) const;
|
ItemType getItem(int id) const;
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
2186
src/view/qtView.cpp
2186
src/view/qtView.cpp
File diff suppressed because it is too large
Load Diff
@ -15,6 +15,21 @@
|
|||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
|
#include <QEvent>
|
||||||
|
#include <QFocusEvent>
|
||||||
|
#include <QInputDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QStackedWidget>
|
||||||
|
#include <functional>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QTextEdit>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QScrollArea>
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
class StockController;
|
class StockController;
|
||||||
@ -47,94 +62,123 @@ protected:
|
|||||||
bool eventFilter(QObject* obj, QEvent* event) override;
|
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// Stock management slots
|
// Menu selection slots
|
||||||
void onCreateStock();
|
void onStockMenuSelected();
|
||||||
void onShowStocks();
|
void onItemTypeMenuSelected();
|
||||||
void onDeleteStock();
|
void onItemMenuSelected();
|
||||||
|
void onDisplayMenuSelected();
|
||||||
// ItemType management slots
|
|
||||||
void onCreateItemType();
|
|
||||||
void onShowItemTypes();
|
|
||||||
void onDeleteItemType();
|
|
||||||
|
|
||||||
// Item management slots
|
|
||||||
void onAddItem();
|
|
||||||
void onMoveItem();
|
|
||||||
|
|
||||||
// Display slots
|
|
||||||
void onShowStockContent();
|
|
||||||
void onShowCapacities();
|
|
||||||
|
|
||||||
// Application control
|
// Application control
|
||||||
void onExit();
|
|
||||||
void onRefresh();
|
void onRefresh();
|
||||||
|
|
||||||
// Virtual keyboard slots
|
// Virtual keyboard slots
|
||||||
void onTextFieldFocused();
|
void onTextFieldFocused();
|
||||||
void onTextFieldClicked();
|
void showVirtualKeyboard();
|
||||||
|
void hideVirtualKeyboard();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupUI();
|
void setupUI();
|
||||||
void setupStockManagementTab();
|
void setupLeftMenu();
|
||||||
void setupItemTypeManagementTab();
|
void setupStackedWidget();
|
||||||
void setupItemManagementTab();
|
void setupMainMenuScreens();
|
||||||
void setupDisplayTab();
|
void setupActionScreens();
|
||||||
void applyModernStyling();
|
void setupStockActionScreens();
|
||||||
void updateComboBoxes();
|
void setupItemTypeActionScreens();
|
||||||
void clearInputFields();
|
void setupItemActionScreens();
|
||||||
void showSuccessMessage(const QString& message);
|
void setupDisplayActionScreens();
|
||||||
void showErrorMessage(const QString& message);
|
void applyTouchFriendlyStyling();
|
||||||
void setupVirtualKeyboard();
|
void setupVirtualKeyboard();
|
||||||
void connectTextFieldEvents();
|
void connectTextFieldEvents();
|
||||||
|
void updateMenuButtonStyles();
|
||||||
|
|
||||||
|
// Navigation methods
|
||||||
|
void showMainMenu(int menuIndex);
|
||||||
|
void showActionScreen(QWidget* screen);
|
||||||
|
void goBack();
|
||||||
|
|
||||||
|
// Screen creation helpers
|
||||||
|
QWidget* createTitleAndButtonScreen(const QString& title, const QStringList& buttonTexts, const std::vector<std::function<void()>>& callbacks);
|
||||||
|
QWidget* createFormScreen(const QString& title, const QStringList& labels, const QStringList& placeholders = QStringList());
|
||||||
|
QWidget* createStockSelectionScreen();
|
||||||
|
void refreshStockSelectionScreen();
|
||||||
|
void confirmStockDeletion(const QString& stockName);
|
||||||
|
|
||||||
|
// Form execution methods
|
||||||
|
void executeFormAction(QWidget* screen, const QString& title);
|
||||||
|
void executeCreateStock(const QStringList& values);
|
||||||
|
void executeDeleteStock(const QStringList& values);
|
||||||
|
void executeCreateItemType(const QStringList& values);
|
||||||
|
void executeDeleteItemType(const QStringList& values);
|
||||||
|
void executeAddItem(const QStringList& values);
|
||||||
|
void executeMoveItem(const QStringList& values);
|
||||||
|
void executeRemoveItem(const QStringList& values);
|
||||||
|
void executeShowStockContent(const QStringList& values);
|
||||||
|
|
||||||
|
// Direct action methods (without forms)
|
||||||
|
void onShowStocks();
|
||||||
|
void onShowItemTypes();
|
||||||
|
void onShowCapacities();
|
||||||
|
void onShowStatistics();
|
||||||
|
|
||||||
|
// Méthodes pour les notifications (plus de popups)
|
||||||
|
void showMessage(const QString& message, bool isError = false);
|
||||||
|
void displayResult(const QString& message); // Méthode pour afficher les résultats
|
||||||
|
|
||||||
|
// Méthodes utilitaires pour obtenir les données du modèle
|
||||||
|
QStringList getAvailableStocks();
|
||||||
|
QStringList getAvailableItemTypes();
|
||||||
|
|
||||||
// Controller
|
// Controller
|
||||||
StockController* m_controller;
|
StockController* m_controller;
|
||||||
|
|
||||||
// Main layout and widgets
|
// Main layout and widgets
|
||||||
QVBoxLayout* m_mainLayout;
|
QVBoxLayout* m_mainLayout;
|
||||||
QTabWidget* m_tabWidget;
|
QWidget* m_menuDisplayWidget; // Widget conteneur pour le layout horizontal
|
||||||
|
QHBoxLayout* m_menuDisplayLayout;
|
||||||
|
|
||||||
|
// Left side menu (vertical selection)
|
||||||
|
QWidget* m_leftMenuWidget;
|
||||||
|
QVBoxLayout* m_leftMenuLayout;
|
||||||
|
QScrollArea* m_leftMenuScrollArea;
|
||||||
|
|
||||||
|
// Right side content area - using stacked widget for screens
|
||||||
|
QStackedWidget* m_stackedWidget;
|
||||||
|
|
||||||
|
// Menu buttons (left side)
|
||||||
|
QPushButton* m_stockMenuButton;
|
||||||
|
QPushButton* m_itemTypeMenuButton;
|
||||||
|
QPushButton* m_itemMenuButton;
|
||||||
|
QPushButton* m_displayMenuButton;
|
||||||
|
QPushButton* m_backButton; // Pour retourner au menu principal
|
||||||
|
|
||||||
|
// Main menu screens
|
||||||
|
QWidget* m_stockMainScreen;
|
||||||
|
QWidget* m_itemTypeMainScreen;
|
||||||
|
QWidget* m_itemMainScreen;
|
||||||
|
QWidget* m_displayMainScreen;
|
||||||
|
|
||||||
|
// Individual action screens
|
||||||
|
QWidget* m_createStockScreen;
|
||||||
|
QWidget* m_showStocksScreen;
|
||||||
|
QWidget* m_deleteStockScreen;
|
||||||
|
QVBoxLayout* m_stockSelectionLayout; // Layout pour les boutons de stock
|
||||||
|
|
||||||
|
QWidget* m_createItemTypeScreen;
|
||||||
|
QWidget* m_showItemTypesScreen;
|
||||||
|
QWidget* m_deleteItemTypeScreen;
|
||||||
|
|
||||||
|
QWidget* m_addItemScreen;
|
||||||
|
QWidget* m_moveItemScreen;
|
||||||
|
QWidget* m_removeItemScreen;
|
||||||
|
|
||||||
|
QWidget* m_showStockContentScreen;
|
||||||
|
QWidget* m_showCapacitiesScreen;
|
||||||
|
QWidget* m_showStatisticsScreen;
|
||||||
|
|
||||||
|
// Bottom area
|
||||||
QTextEdit* m_outputDisplay;
|
QTextEdit* m_outputDisplay;
|
||||||
QPushButton* m_exitButton;
|
|
||||||
QPushButton* m_refreshButton;
|
QPushButton* m_refreshButton;
|
||||||
|
|
||||||
// Stock management widgets
|
|
||||||
QWidget* m_stockTab;
|
|
||||||
QLineEdit* m_stockNameEdit;
|
|
||||||
QSpinBox* m_stockCapacitySpinBox;
|
|
||||||
QLineEdit* m_stockCommentEdit;
|
|
||||||
QComboBox* m_stockDeleteCombo;
|
|
||||||
QPushButton* m_createStockButton;
|
|
||||||
QPushButton* m_showStocksButton;
|
|
||||||
QPushButton* m_deleteStockButton;
|
|
||||||
|
|
||||||
// ItemType management widgets
|
|
||||||
QWidget* m_itemTypeTab;
|
|
||||||
QLineEdit* m_itemTypeNameEdit;
|
|
||||||
QLineEdit* m_itemTypeCommentEdit;
|
|
||||||
QSpinBox* m_itemTypeSizeSpinBox;
|
|
||||||
QComboBox* m_itemTypeDeleteCombo;
|
|
||||||
QPushButton* m_createItemTypeButton;
|
|
||||||
QPushButton* m_showItemTypesButton;
|
|
||||||
QPushButton* m_deleteItemTypeButton;
|
|
||||||
|
|
||||||
// Item management widgets
|
|
||||||
QWidget* m_itemTab;
|
|
||||||
QComboBox* m_addItemStockCombo;
|
|
||||||
QComboBox* m_addItemTypeCombo;
|
|
||||||
QSpinBox* m_addItemQuantitySpinBox;
|
|
||||||
QComboBox* m_moveFromStockCombo;
|
|
||||||
QComboBox* m_moveToStockCombo;
|
|
||||||
QComboBox* m_moveItemTypeCombo;
|
|
||||||
QSpinBox* m_moveQuantitySpinBox;
|
|
||||||
QPushButton* m_addItemButton;
|
|
||||||
QPushButton* m_moveItemButton;
|
|
||||||
|
|
||||||
// Display widgets
|
|
||||||
QWidget* m_displayTab;
|
|
||||||
QComboBox* m_displayStockCombo;
|
|
||||||
QPushButton* m_showContentButton;
|
|
||||||
QPushButton* m_showCapacitiesButton;
|
|
||||||
|
|
||||||
// Virtual keyboard
|
// Virtual keyboard
|
||||||
VirtualKeyboard* m_virtualKeyboard;
|
VirtualKeyboard* m_virtualKeyboard;
|
||||||
};
|
};
|
||||||
|
@ -337,6 +337,7 @@ void VirtualKeyboard::applyKeyboardStyling()
|
|||||||
|
|
||||||
#functionKey:hover {
|
#functionKey:hover {
|
||||||
background-color: #f39c12;
|
background-color: #f39c12;
|
||||||
|
}
|
||||||
|
|
||||||
#functionKey:pressed, #functionKey:checked {
|
#functionKey:pressed, #functionKey:checked {
|
||||||
background-color: #d35400;
|
background-color: #d35400;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user