la fin des fins
This commit is contained in:
parent
cd6c661b28
commit
9186e6222f
@ -11,6 +11,7 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Vérifier les arguments de ligne de commande pour choisir l'interface
|
||||
// Check command line arguments to choose the interface
|
||||
bool useTerminal = false;
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
std::string arg = argv[i];
|
||||
@ -22,6 +23,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (useTerminal) {
|
||||
// Interface Terminal
|
||||
// Terminal interface
|
||||
Model model;
|
||||
TerminalView view;
|
||||
StockController controller(&view, &model);
|
||||
@ -30,6 +32,7 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
} else {
|
||||
// Interface Qt (par défaut)
|
||||
// Qt interface (default)
|
||||
QApplication app(argc, argv);
|
||||
|
||||
Model model;
|
||||
@ -37,18 +40,23 @@ int main(int argc, char *argv[])
|
||||
StockController controller(&view, &model);
|
||||
|
||||
// Configuration dans le thread principal
|
||||
// Configuration in the main thread
|
||||
view.setController(&controller);
|
||||
view.start(); // Affiche la fenêtre Qt
|
||||
// Show the Qt window
|
||||
|
||||
// Démarrer seulement le traitement dans un thread séparé
|
||||
// Start only the processing in a separate thread
|
||||
std::thread controllerThread([&controller]() {
|
||||
controller.startProcessing();
|
||||
});
|
||||
|
||||
// La boucle d'événements Qt reste sur le thread principal
|
||||
// The Qt event loop remains on the main thread
|
||||
int result = app.exec();
|
||||
|
||||
// Arrêter le contrôleur avant de quitter
|
||||
// Stop the controller before exiting
|
||||
controller.stop();
|
||||
controllerThread.join();
|
||||
|
||||
|
@ -10,14 +10,14 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// Créer le modèle et la vue
|
||||
// Create the model and the view
|
||||
Model model;
|
||||
QtView view;
|
||||
|
||||
// Créer le contrôleur
|
||||
// Create the controller
|
||||
StockController controller(&view, &model);
|
||||
|
||||
// Démarrer l'application
|
||||
// Start the application
|
||||
controller.start();
|
||||
|
||||
return app.exec();
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
|
||||
void addItem(const ItemType &item);
|
||||
void removeItem(int id);
|
||||
bool removeItem(const ItemType &item); // Nouvelle méthode
|
||||
bool removeItem(const ItemType &item); // New method
|
||||
ItemType getItem(int id) const;
|
||||
std::map<std::string, std::pair<ItemType, int>> getItemsWithQuantities() const;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -136,13 +136,13 @@ private:
|
||||
void onShowCapacities();
|
||||
void onShowStatistics();
|
||||
|
||||
// Méthodes pour les notifications (plus de popups)
|
||||
// Methods for notifications (no more popups)
|
||||
void clearMessages();
|
||||
void displayNotify(const QString& message);
|
||||
void showMessage(const QString& message, bool isError = false);
|
||||
void displayResult(const QString& message); // Méthode pour afficher les résultats
|
||||
void displayResult(const QString& message); // Method to display results
|
||||
|
||||
// Méthodes utilitaires pour obtenir les données du modèle
|
||||
// Utility methods to get model data
|
||||
QStringList getAvailableStocks();
|
||||
QStringList getAvailableItemTypes();
|
||||
|
||||
@ -151,7 +151,7 @@ private:
|
||||
|
||||
// Main layout and widgets
|
||||
QVBoxLayout* m_mainLayout;
|
||||
QWidget* m_menuDisplayWidget; // Widget conteneur pour le layout horizontal
|
||||
QWidget* m_menuDisplayWidget; // Container widget for horizontal layout
|
||||
QHBoxLayout* m_menuDisplayLayout;
|
||||
|
||||
// Left side menu (vertical selection)
|
||||
@ -167,7 +167,7 @@ private:
|
||||
QPushButton* m_itemTypeMenuButton;
|
||||
QPushButton* m_itemMenuButton;
|
||||
QPushButton* m_displayMenuButton;
|
||||
QPushButton* m_backButton; // Pour retourner au menu principal
|
||||
QPushButton* m_backButton; // To return to the main menu
|
||||
|
||||
// Main menu screens
|
||||
QWidget* m_stockMainScreen;
|
||||
@ -179,16 +179,16 @@ private:
|
||||
QWidget* m_createStockScreen;
|
||||
QWidget* m_showStocksScreen;
|
||||
QWidget* m_deleteStockScreen;
|
||||
QVBoxLayout* m_stockSelectionLayout; // Layout pour les boutons de stock
|
||||
QWidget* m_stockDisplayWidget; // Widget pour l'affichage des stocks
|
||||
QVBoxLayout* m_stockDisplayLayout; // Layout pour l'affichage des stocks
|
||||
QVBoxLayout* m_stockSelectionLayout; // Layout for stock buttons
|
||||
QWidget* m_stockDisplayWidget; // Widget for stock display
|
||||
QVBoxLayout* m_stockDisplayLayout; // Layout for stock display
|
||||
|
||||
QWidget* m_createItemTypeScreen;
|
||||
QWidget* m_showItemTypesScreen;
|
||||
QWidget* m_deleteItemTypeScreen;
|
||||
QVBoxLayout* m_itemTypeSelectionLayout; // Layout pour les boutons de types d'articles
|
||||
QWidget* m_itemTypeDisplayWidget; // Widget pour l'affichage des types d'articles
|
||||
QVBoxLayout* m_itemTypeDisplayLayout; // Layout pour l'affichage des types d'articles
|
||||
QVBoxLayout* m_itemTypeSelectionLayout; // Layout for item type buttons
|
||||
QWidget* m_itemTypeDisplayWidget; // Widget for item type display
|
||||
QVBoxLayout* m_itemTypeDisplayLayout; // Layout for item type display
|
||||
|
||||
QWidget* m_addItemScreen;
|
||||
QWidget* m_moveItemScreen;
|
||||
|
@ -25,9 +25,9 @@ VirtualKeyboard::VirtualKeyboard(QWidget* parent)
|
||||
, m_capsLockButton(nullptr)
|
||||
, m_hideButton(nullptr)
|
||||
{
|
||||
// Ne pas créer de fenêtre séparée, utiliser le parent
|
||||
// Do not create a separate window, use the parent
|
||||
setAttribute(Qt::WA_ShowWithoutActivating);
|
||||
setAutoFillBackground(true); // Permettre le fond personnalisé
|
||||
setAutoFillBackground(true); // Allow custom background
|
||||
|
||||
// Initialize key layouts
|
||||
m_qwertyLayout << "q" << "w" << "e" << "r" << "t" << "y" << "u" << "i" << "o" << "p"
|
||||
@ -55,7 +55,7 @@ void VirtualKeyboard::showForWidget(QWidget* target)
|
||||
{
|
||||
setTargetWidget(target);
|
||||
|
||||
// Initialiser la zone d'affichage avec le contenu actuel
|
||||
// Initialize the display area with the current content
|
||||
if (QLineEdit* lineEdit = qobject_cast<QLineEdit*>(target)) {
|
||||
m_displayEdit->setText(lineEdit->text());
|
||||
} else if (QTextEdit* textEdit = qobject_cast<QTextEdit*>(target)) {
|
||||
@ -64,7 +64,7 @@ void VirtualKeyboard::showForWidget(QWidget* target)
|
||||
m_displayEdit->clear();
|
||||
}
|
||||
|
||||
// Positionner le clavier comme overlay sur l'application parent
|
||||
// Position the keyboard as an overlay on the parent application
|
||||
if (parentWidget()) {
|
||||
setGeometry(parentWidget()->rect());
|
||||
}
|
||||
@ -88,10 +88,10 @@ void VirtualKeyboard::setupKeyboard()
|
||||
|
||||
// Header with title and hide button
|
||||
QHBoxLayout* headerLayout = new QHBoxLayout();
|
||||
QLabel* titleLabel = new QLabel("Clavier Virtuel");
|
||||
QLabel* titleLabel = new QLabel("Virtual Keyboard");
|
||||
titleLabel->setObjectName("keyboardTitle");
|
||||
|
||||
m_hideButton = new QPushButton("✕ Fermer");
|
||||
m_hideButton = new QPushButton("Close");
|
||||
m_hideButton->setObjectName("hideButton");
|
||||
m_hideButton->setFixedSize(180, 70);
|
||||
connect(m_hideButton, &QPushButton::clicked, this, &VirtualKeyboard::hideKeyboard);
|
||||
@ -107,7 +107,7 @@ void VirtualKeyboard::setupKeyboard()
|
||||
m_displayEdit->setObjectName("displayEdit");
|
||||
m_displayEdit->setReadOnly(true);
|
||||
m_displayEdit->setFixedHeight(80);
|
||||
m_displayEdit->setPlaceholderText("Le texte saisi apparaîtra ici...");
|
||||
m_displayEdit->setPlaceholderText("Entered text will appear here...");
|
||||
m_mainLayout->addWidget(m_displayEdit);
|
||||
|
||||
// Add spacer to center keyboard
|
||||
@ -130,7 +130,7 @@ void VirtualKeyboard::setupNumericKeys()
|
||||
{
|
||||
QHBoxLayout* numericLayout = new QHBoxLayout();
|
||||
numericLayout->setSpacing(15);
|
||||
numericLayout->addStretch(); // Centrer les touches
|
||||
numericLayout->addStretch(); // Center the keys
|
||||
|
||||
for (const QString& key : m_numericLayout) {
|
||||
QPushButton* button = new QPushButton(key);
|
||||
@ -151,7 +151,7 @@ void VirtualKeyboard::setupNumericKeys()
|
||||
numericLayout->addWidget(button);
|
||||
}
|
||||
|
||||
numericLayout->addStretch(); // Centrer les touches
|
||||
numericLayout->addStretch(); // Center the keys
|
||||
m_mainLayout->addLayout(numericLayout);
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ void VirtualKeyboard::setupAlphabeticKeys()
|
||||
thirdRow->addStretch();
|
||||
|
||||
// Shift button
|
||||
m_shiftButton = new QPushButton("⇧");
|
||||
m_shiftButton = new QPushButton("Shift");
|
||||
m_shiftButton->setObjectName("functionKey");
|
||||
m_shiftButton->setFixedSize(80, 60);
|
||||
m_shiftButton->setCheckable(true);
|
||||
@ -214,7 +214,7 @@ void VirtualKeyboard::setupAlphabeticKeys()
|
||||
}
|
||||
|
||||
// Backspace button
|
||||
m_backspaceButton = new QPushButton("⌫");
|
||||
m_backspaceButton = new QPushButton("Backspace");
|
||||
m_backspaceButton->setObjectName("functionKey");
|
||||
m_backspaceButton->setFixedSize(80, 60);
|
||||
connect(m_backspaceButton, &QPushButton::clicked, this, &VirtualKeyboard::onBackspacePressed);
|
||||
@ -239,14 +239,14 @@ void VirtualKeyboard::setupFunctionKeys()
|
||||
m_functionLayout->addWidget(m_capsLockButton);
|
||||
|
||||
// Space bar
|
||||
m_spaceButton = new QPushButton("Espace");
|
||||
m_spaceButton = new QPushButton("Space");
|
||||
m_spaceButton->setObjectName("spaceKey");
|
||||
m_spaceButton->setFixedSize(240, 60);
|
||||
connect(m_spaceButton, &QPushButton::clicked, this, &VirtualKeyboard::onSpacePressed);
|
||||
m_functionLayout->addWidget(m_spaceButton);
|
||||
|
||||
// Enter
|
||||
m_enterButton = new QPushButton("↵");
|
||||
m_enterButton = new QPushButton("Enter");
|
||||
m_enterButton->setObjectName("functionKey");
|
||||
m_enterButton->setFixedSize(80, 60);
|
||||
connect(m_enterButton, &QPushButton::clicked, this, &VirtualKeyboard::onEnterPressed);
|
||||
@ -268,7 +268,7 @@ void VirtualKeyboard::setupFunctionKeys()
|
||||
|
||||
void VirtualKeyboard::applyKeyboardStyling()
|
||||
{
|
||||
// Utiliser une palette pour le fond au lieu du stylesheet
|
||||
// Use a palette for the background instead of stylesheet
|
||||
QPalette palette = this->palette();
|
||||
palette.setColor(QPalette::Window, QColor(44, 62, 80, 250));
|
||||
setPalette(palette);
|
||||
@ -402,11 +402,11 @@ void VirtualKeyboard::insertTextToTarget(const QString& text)
|
||||
|
||||
if (QLineEdit* lineEdit = qobject_cast<QLineEdit*>(m_targetWidget)) {
|
||||
lineEdit->insert(text);
|
||||
// Mettre à jour la zone d'affichage
|
||||
// Update the display area
|
||||
m_displayEdit->setText(lineEdit->text());
|
||||
} else if (QTextEdit* textEdit = qobject_cast<QTextEdit*>(m_targetWidget)) {
|
||||
textEdit->insertPlainText(text);
|
||||
// Mettre à jour la zone d'affichage
|
||||
// Update the display area
|
||||
m_displayEdit->setText(textEdit->toPlainText());
|
||||
}
|
||||
}
|
||||
@ -450,7 +450,7 @@ void VirtualKeyboard::positionKeyboard()
|
||||
void VirtualKeyboard::showEvent(QShowEvent* event)
|
||||
{
|
||||
QWidget::showEvent(event);
|
||||
// Le clavier est maintenant en plein écran, pas besoin de positionner
|
||||
// The keyboard is now fullscreen, no need to position
|
||||
}
|
||||
|
||||
void VirtualKeyboard::hideEvent(QHideEvent* event)
|
||||
@ -462,7 +462,7 @@ void VirtualKeyboard::hideEvent(QHideEvent* event)
|
||||
void VirtualKeyboard::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
// S'assurer que le clavier couvre toute la fenêtre parent si visible
|
||||
// Ensure the keyboard covers the entire parent window if visible
|
||||
if (isVisible() && parentWidget()) {
|
||||
setGeometry(parentWidget()->rect());
|
||||
}
|
||||
@ -473,11 +473,11 @@ void VirtualKeyboard::paintEvent(QPaintEvent* event)
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
// Dessiner le fond avec transparence
|
||||
// Draw the background with transparency
|
||||
QColor backgroundColor(44, 62, 80, 250);
|
||||
painter.fillRect(rect(), backgroundColor);
|
||||
|
||||
// Dessiner la bordure
|
||||
// Draw the border
|
||||
QPen borderPen(QColor(52, 73, 94), 3);
|
||||
painter.setPen(borderPen);
|
||||
painter.drawRoundedRect(rect().adjusted(1, 1, -1, -1), 15, 15);
|
||||
|
Loading…
x
Reference in New Issue
Block a user