src/MainWindow.cpp

Fri, 25 Feb 2022 10:51:36 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 25 Feb 2022 10:51:36 +0100
changeset 28
93a70b1502ca
parent 25
a9da2744609e
child 29
76846c99f827
permissions
-rw-r--r--

Added the inventory miscs table.

/**
 * MainWindow.cpp is part of bmsapp.
 *
 * bmsapp is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * bmsapp is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include "MainWindow.h"
#include "AboutDialog.h"
#include "InventorySuppliers.h"
#include "InventoryFermentables.h"
#include "InventoryHops.h"
#include "InventoryYeasts.h"
#include "InventoryMiscs.h"
#include "Setup.h"
#include "../ui/ui_MainWindow.h"
#include "config.h"

#include <QApplication>
#include <QCloseEvent>
#include <QDebug>
#include <QStandardItem>
#include <QWidget>


MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),  ui(new Ui::MainWindow)
{
    qDebug() << Q_FUNC_INFO;
    ui->setupUi(this);

    setWindowTitle( QString("BMSapp - %1").arg(VERSIONSTRING) );
}


MainWindow::~MainWindow()
{
    qDebug() << Q_FUNC_INFO;
    delete ui;
}


void MainWindow::on_actionExit_triggered()
{
    qDebug() << Q_FUNC_INFO;
    this->close();
}


void MainWindow::fromInventorySuppliers()
{
    qDebug() << Q_FUNC_INFO;
    delete InventorySuppliersWindow;
    this->show();
}


void MainWindow::on_actionSuppliers_triggered()
{
    qDebug() << Q_FUNC_INFO;
    InventorySuppliersWindow = new InventorySuppliers(this);
    QObject::connect(InventorySuppliersWindow, SIGNAL(firstWindow()), this, SLOT(fromInventorySuppliers()));
    this->hide();    // Close the main window
    InventorySuppliersWindow->show();  // Show a second window
}


void MainWindow::fromInventoryFermentables()
{
    qDebug() << Q_FUNC_INFO;
    delete InventoryFermentablesWindow;
    this->show();
}


void MainWindow::on_actionFermentables_triggered()
{
    qDebug() << Q_FUNC_INFO;
    InventoryFermentablesWindow = new InventoryFermentables(this);
    QObject::connect(InventoryFermentablesWindow, SIGNAL(firstWindow()), this, SLOT(fromInventoryFermentables()));
    this->hide();    // Close the main window
    InventoryFermentablesWindow->show();  // Show a second window
}


void MainWindow::fromInventoryHops()
{
    qDebug() << Q_FUNC_INFO;
    delete InventoryHopsWindow;
    this->show();
}


void MainWindow::on_actionHops_triggered()
{
    qDebug() << Q_FUNC_INFO;
    InventoryHopsWindow = new InventoryHops(this);
    QObject::connect(InventoryHopsWindow, SIGNAL(firstWindow()), this, SLOT(fromInventoryHops()));
    this->hide();    // Close the main window
    InventoryHopsWindow->show();  // Show a second window
}


void MainWindow::fromInventoryYeasts()
{
    qDebug() << Q_FUNC_INFO;
    delete InventoryYeastsWindow;
    this->show();
}


void MainWindow::on_actionYeasts_triggered()
{
    qDebug() << Q_FUNC_INFO;
    InventoryYeastsWindow = new InventoryYeasts(this);
    QObject::connect(InventoryYeastsWindow, SIGNAL(firstWindow()), this, SLOT(fromInventoryYeasts()));
    this->hide();    // Close the main window
    InventoryYeastsWindow->show();  // Show a second window
}


void MainWindow::fromInventoryMiscs()
{
    qDebug() << Q_FUNC_INFO;
    delete InventoryMiscsWindow;
    this->show();
}


void MainWindow::on_actionMiscs_triggered()
{
    qDebug() << Q_FUNC_INFO;
    InventoryMiscsWindow = new InventoryMiscs(this);
    QObject::connect(InventoryMiscsWindow, SIGNAL(firstWindow()), this, SLOT(fromInventoryMiscs()));
    this->hide();    // Close the main window
    InventoryMiscsWindow->show();  // Show a second window
}


void MainWindow::fromSetup()
{
    qDebug() << Q_FUNC_INFO;
    delete SetupWindow;
    this->show();
}


void MainWindow::on_actionSetup_triggered()
{
    qDebug() << Q_FUNC_INFO;
    SetupWindow = new Setup(this);
    QObject::connect(SetupWindow, SIGNAL(firstWindow()), this, SLOT(fromSetup()));
    this->hide();		// Close the main window
    SetupWindow->show();	// Show a setup window
}


void MainWindow::on_actionAbout_triggered()
{
    AboutDialog dialog(this);
    dialog.setModal(true);
    dialog.exec();
}

mercurial