QtHPConnect/mainwindow.cpp

688 lines
18 KiB
C++
Raw Normal View History

2019-02-10 17:26:56 +01:00
/*
* QtHP Connect: hand-helds support interface.
* Copyright (C) 2019 Ian Gebbie
* Code patterns and snippets borrowed from libhpcalcs :
* Copyright (C) 1999-2009 Romain Li<EFBFBD>vin
* Copyright (C) 2009-2013 Lionel Debroux
* Copyright (C) 1999-2013 libti* contributors.
*
* This program 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.
*
* This program 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.
*
*/
2019-02-10 14:32:15 +01:00
#include "mainwindow.h"
#include "ui_mainwindow.h"
2019-02-10 14:43:00 +01:00
#include <QtWidgets/QApplication>
#include <QtWidgets/QTableView>
#include <QMessageBox>
2019-02-11 21:54:51 +01:00
#include <QTreeView>
2019-02-17 17:24:52 +01:00
#include <QLabel>
2019-02-18 21:15:04 +01:00
#include <QInputDialog>
2019-02-10 14:43:00 +01:00
#include <QFile>
#include <QTextStream>
2019-03-09 15:39:38 +01:00
#include <QTimer>
2019-02-18 21:15:04 +01:00
#include <QFileIconProvider>
2019-02-10 14:43:00 +01:00
2019-02-18 21:15:04 +01:00
#include "global.h"
2019-02-10 14:43:00 +01:00
#include "hpusb.h"
#include "datamodel.h"
#include "treemodel.h"
#include "variableview.h"
#include "texteditor.h"
#include "hp_mdiwindow.h"
#include "hptreeitem.h"
#include "hpdata.h"
#include "hp_mdivariableedit.h"
#include "hp_mditexteditor.h"
2019-03-16 20:34:09 +01:00
#include "options.h"
2020-01-19 17:55:14 +01:00
#include "eventthread.h"
#include "eventtimer.h"
2019-02-10 14:43:00 +01:00
errorHandler *main_err;
#define log(a) main_err->error(L7,0,QString(a),QString());
2019-02-10 14:32:15 +01:00
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
2019-02-10 14:43:00 +01:00
//setup
2019-02-18 21:15:04 +01:00
QCoreApplication::setOrganizationName("IRGP");
2019-02-10 14:43:00 +01:00
QCoreApplication::setOrganizationDomain("");
2019-02-18 21:15:04 +01:00
QCoreApplication::setApplicationName("Linux QtHPConnect");
QSettings appSettings("IRGP","QtHPconnect");
//Set config file location (default used)
2019-04-02 21:14:31 +02:00
if(!appSettings.contains("contentPath")) {
appSettings.setValue("contentPath",QDir::homePath()+"/.local/share/qthpconnect/contents/");
}
2019-02-10 14:43:00 +01:00
//error handler
main_err = new errorHandler(this);
//data models
2019-02-17 17:24:52 +01:00
myModel= new dataModel(this);
hpTreeModel = new treeModel(this);
2019-02-10 14:43:00 +01:00
//usbapi
hpapi = new hpusb();
//Interface
2019-02-10 14:32:15 +01:00
ui->setupUi(this);
2019-02-10 14:43:00 +01:00
setWindowIcon(QIcon::fromTheme("accessories-calculator",
QIcon(":/icons/monitor_32x32.png")));
createActions();
createLogWindow();
2019-02-11 21:54:51 +01:00
setTreeMenu();
2019-02-18 21:15:04 +01:00
setContentWindow();
2019-02-10 14:43:00 +01:00
2019-04-02 21:14:31 +02:00
//Hack to fix QT resizing bug
resizeDocks({ui->dwCalculator,ui->dwContent},{0,0}, Qt::Horizontal);
2019-03-09 15:39:38 +01:00
2019-02-10 14:43:00 +01:00
//setup trees
ui->tvCalculators->setModel(hpTreeModel);
2019-04-02 21:14:31 +02:00
ui->tvCalculators->setAcceptDrops(true);
ui->tvCalculators->setDragEnabled(true);
ui->tvCalculators->setDragDropMode(QAbstractItemView::DragDrop);
ui->tvCalculators->setDropIndicatorShown(true);
2019-02-10 14:43:00 +01:00
ui->tvCalculators->show();
connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(onOpen()));
connect(ui->actionAbout_HP_Connect,SIGNAL(triggered()),this,SLOT(about()));
2019-09-21 18:00:43 +02:00
// connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(exit()));
2019-02-10 14:43:00 +01:00
connect(ui->actionContent,SIGNAL(triggered()),this,SLOT(showContent()));
connect(ui->actionCalculators,SIGNAL(triggered()),this,SLOT(showCalculator()));
connect(ui->actionMessages,SIGNAL(triggered()),this,SLOT(showMessage()));
connect(ui->actionMonitor,SIGNAL(triggered()),this,SLOT(showMonitor()));
connect(ui->tvCalculators,SIGNAL(clicked(QModelIndex)),this,SLOT(clickedCalculator(QModelIndex)));
2019-04-02 21:14:31 +02:00
connect(ui->tvContent,SIGNAL(clicked(QModelIndex)),this,SLOT(clickedContent(QModelIndex)));
2019-02-10 14:43:00 +01:00
connect(ui->actionLog,SIGNAL(triggered()),this,SLOT(createLogWindow()));
connect(ui->actionTest,SIGNAL(triggered()),this,SLOT(testFunction()));
2019-02-12 21:48:35 +01:00
connect(ui->actionTestSettings,SIGNAL(triggered()),this,SLOT(onTestSettings()));
2019-02-17 17:24:52 +01:00
connect(ui->actionTestScreen,SIGNAL(triggered()),this,SLOT(onTestScreen()));
2019-03-09 15:39:38 +01:00
connect(ui->actionRefresh,SIGNAL(triggered(bool)),this,SLOT(refresh(bool)));
2019-03-16 20:34:09 +01:00
connect(ui->actionPreferences,SIGNAL(triggered(bool)),this,SLOT(onOptions(bool)));
2019-02-11 21:54:51 +01:00
connect(ui->tvCalculators, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(on_tvCalculators_customContextMenuRequested(const QPoint &)));
2019-03-09 15:39:38 +01:00
connect(hpapi, SIGNAL(hotplug(int)), this, SLOT(hotplug_handler(int)));
2019-02-10 14:43:00 +01:00
//default data
log("Initialising....");
if (hpapi->hp_init())
err(L1,0,QString().sprintf("%s Failed to open libusb",__FUNCTION__));
2019-03-09 15:39:38 +01:00
//setup event handler
2020-01-19 17:55:14 +01:00
eventThread = new EventThread(this);
eventTimer = new EventTimer(this);
// connect(eventTimer,SIGNAL(timeout()),this,SLOT(eventHandler()));
connect(eventThread,SIGNAL(finished()),eventTimer,SLOT(exit()), Qt::DirectConnection);
connect(eventTimer,SIGNAL(stopped()),this,SLOT(setTimerStopped()), Qt::DirectConnection);
connect(this,SIGNAL(stopTimer()),eventTimer,SLOT(exit()), Qt::DirectConnection);
connect(eventThread,SIGNAL(startTimer()),eventTimer,SLOT(start()));
2019-03-09 15:39:38 +01:00
eventTimer->moveToThread(eventThread);
eventThread->start();
2019-02-10 14:43:00 +01:00
ui->dwMessenger->hide();
ui->dwMonitor->hide();
2019-03-09 15:39:38 +01:00
// addDummy();
2019-02-10 14:43:00 +01:00
// openHP();
}
void MainWindow::testFunction() {
hpCalcData * pH;
int cmd;
2019-02-19 22:10:58 +01:00
qDebug()<<"In Test Function";
2019-02-10 14:43:00 +01:00
pH=getTreeModel()->getCalculator("IAN");
if (pH) {
2019-02-17 17:24:52 +01:00
cmd = QInputDialog::getInt(this,"Get Command","CMD:",0,0,0xFFFF);
2019-02-10 14:43:00 +01:00
log("command is "+QString().sprintf("%x",cmd));
pH->vpkt_send_experiments(cmd);
}
else
log("Could not get calculator");
}
treeModel * MainWindow::getTreeModel() {
return hpTreeModel;
}
void MainWindow::writeStatus(QString msg)
{
statusBar()->showMessage(msg);
return;
}
void MainWindow::writeChatter(QString line)
{
if (logEdit)
{
logEdit->append(line);
}
return;
2019-02-10 14:32:15 +01:00
}
2019-03-09 15:39:38 +01:00
//eventhandler - for comms events
void MainWindow::eventHandler() {
if(hpapi) {
// qDebug()<<"In Eventhandler";
2020-01-19 17:55:14 +01:00
// hpapi->eventHandler();
2019-03-09 15:39:38 +01:00
}
}
2019-02-10 14:43:00 +01:00
void MainWindow::onOpen()
{
2019-02-12 21:48:35 +01:00
qDebug()<<"MainWindow::in on Open";
2019-02-10 14:43:00 +01:00
//test to see if data model works
hp_Information hpi;
hpi.serialnum="123-56";
QString key;
key=hpTreeModel->getLastDataKey();
hpCalcData * hpdata;
qDebug()<<"MainWindow:: getKey";
hpdata=hpTreeModel->getHpCalcData(key);
if(hpdata)
hpdata->setInfo(hpi);
openHP();
}
2019-02-12 21:48:35 +01:00
void MainWindow::onTestSettings()
{
qDebug()<<"MainWindow::in test Settings";
QString key;
key=hpTreeModel->getLastDataKey();
2019-03-09 15:39:38 +01:00
qDebug()<<key;
2019-02-12 21:48:35 +01:00
hpCalcData * hpdata;
hpdata=hpTreeModel->getHpCalcData(key);
if(hpdata)
hpdata->readSettings();
}
2019-02-17 17:24:52 +01:00
void MainWindow::onTestScreen()
{
qDebug()<<"MainWindow::in test Screen";
QString key;
key=hpTreeModel->getLastDataKey();
hpCalcData * hpdata;
qDebug()<<"MainWindow:: getKey";
hpdata=hpTreeModel->getHpCalcData(key);
if(hpdata)
hpdata->readScreen();
}
2019-02-12 21:48:35 +01:00
2019-02-10 14:43:00 +01:00
//Experimental
void MainWindow::loadTextFile()
{
QFile inputFile(":/input.txt");
inputFile.open(QIODevice::ReadOnly);
QTextStream in(&inputFile);
QString line = in.readAll();
inputFile.close();
}
//open the first calculator
//rework, find multiple or allow choice
void MainWindow::openHP()
{
hpCalcData * data;
2019-04-02 21:14:31 +02:00
qDebug()<<"openHP";
2019-02-10 14:43:00 +01:00
QString name1 = QString("IAN");
data=hpTreeModel->getCalculator(name1);
if(data) {
2019-04-02 21:14:31 +02:00
qDebug()<<"Read Info";
2019-02-12 21:48:35 +01:00
data->readInfo();
2019-04-02 21:14:31 +02:00
data->readSettings();
2019-02-10 14:43:00 +01:00
}
else {
qDebug()<<"In open Func";
hpTreeModel->addCalculator(name1,hpapi);
//handle lost on second call!
// hpapi->submit_sync_transfer(&handle);
}
}
2019-03-09 15:39:38 +01:00
//close and delete HP and associated functions.
void MainWindow::closeHP() {
}
2019-02-10 14:43:00 +01:00
//testcode to add a dummy calculator to the tree
void MainWindow::addDummy() {
QString name = QString("DUMMY");
hpTreeModel->addCalculator(name,nullptr);
}
//slot to handle tree selection
void MainWindow::selectionChangedSlot(const QItemSelection & /*newSelection*/, const QItemSelection & /*oldSelection*/)
{
//get the text of the selected item
const QModelIndex index = ui->tvCalculators->selectionModel()->currentIndex();
// hpTreeItem * item = (hpTreeItem *)index.internalPointer();
// if(item) {
// if (item->isSelectable())
// item->hptSelection(5);
// };
// hpTreeItem hpt= ui->tvCalculators->selectionModel()->
QString selectedText = index.data(Qt::DisplayRole).toString();
//find out the hierarchy level of the selected item
int hierarchyLevel=1;
QModelIndex seekRoot = index;
while(seekRoot.parent() != QModelIndex())
{
seekRoot = seekRoot.parent();
hierarchyLevel++;
}
QString showString = QString("%1, Level %2").arg(selectedText)
.arg(hierarchyLevel);
setWindowTitle(showString);
}
void MainWindow::clickedCalculator(QModelIndex index) {
QStandardItem * item = hpTreeModel->itemFromIndex(index);
hpTreeItem * treeItem = dynamic_cast<hpTreeItem *>(hpTreeModel->itemFromIndex(index));
if(treeItem) {
2019-02-25 08:36:58 +01:00
hp_DataType treetype;
2019-02-10 14:43:00 +01:00
treetype=treeItem->getType();
treeItem->clickAction(getMdi());
}
else
{
log(QStringLiteral("treeItem is null"));
}
2019-03-09 15:39:38 +01:00
//HACK
lastCalc=item->data(Qt::DisplayRole).toString();
log(item->data(Qt::DisplayRole).toString());
2019-02-10 14:43:00 +01:00
}
2019-04-02 21:14:31 +02:00
void MainWindow::clickedContent(QModelIndex index) {
contentModel.clickAction(getMdi(),index);
}
2019-02-10 14:43:00 +01:00
void MainWindow::about()
{
2019-02-18 21:15:04 +01:00
QMessageBox::about(this, tr("About QtHP Connect"),
2019-02-19 22:10:58 +01:00
QString("QtHp Connect is an interface for the HP Prime G2 Calculator\n\n")+QString("Version: ")+HP_VERSION_STRING);
2019-02-18 21:15:04 +01:00
2019-02-10 14:43:00 +01:00
}
2019-03-16 20:34:09 +01:00
//Show options window
void MainWindow::onOptions(bool clicked)
{
Options * optiondlg = new Options(this);
optiondlg->show();
}
2019-02-10 14:43:00 +01:00
//Dummy from examples -- edit
void MainWindow::createActions()
{
// ui->toolBar->addWidget(QPushButton(QIcon(":/icons/about_32x32.png"),"test"));
// const QIcon newIcon = QIcon::fromTheme("document-new", QIcon(":/icons/new.png"));
// QAction *newAct = new QAction(newIcon, tr("&New"), this);
};
//show or hide content window
void MainWindow::showContent() {
2019-02-18 21:15:04 +01:00
if (ui->dwContent->isVisible()) {
ui->dwContent->hide();
2019-02-10 14:43:00 +01:00
}
else
{
2019-02-18 21:15:04 +01:00
ui->dwContent->show();
}
}
//Setup the content window to show saved content
void MainWindow::setContentWindow() {
QSettings appSettings("IRGP","QtHPconnect");
QString path;
path=appSettings.value("contentPath").toString();
qDebug()<<"Content Path:"<<path;
contentModel.setRootPath(path);
2019-02-19 22:10:58 +01:00
// contentModel.iconProvider()->setOptions(QFileIconProvider::DontUseCustomDirectoryIcons);
2019-02-18 21:15:04 +01:00
ui->tvContent->setModel(&contentModel);
2020-01-07 19:41:18 +01:00
QDir dir(path);
if (!dir.exists()) {
qDebug()<<"Content Path Does not Exist:"<<path;
if(!dir.mkpath("."))
{
qDebug()<<"Path could not be created"<<path;
}
}
2019-02-18 21:15:04 +01:00
if (!path.isEmpty()) {
2020-01-07 19:41:18 +01:00
qDebug()<<"Content Path Empty:"<<path;
2019-02-18 21:15:04 +01:00
const QModelIndex rootIndex = contentModel.index(QDir::cleanPath(path));
if (rootIndex.isValid()) {
ui->tvContent->setRootIndex(rootIndex);
2019-04-02 21:14:31 +02:00
ui->tvContent->setAcceptDrops(true);
ui->tvContent->setDragEnabled(true);
ui->tvContent->setDragDropMode(QAbstractItemView::DragDrop);
ui->tvContent->setDropIndicatorShown(true);
2019-02-18 21:15:04 +01:00
}
2019-02-10 14:43:00 +01:00
}
2019-09-15 17:23:44 +02:00
readSettings();
2019-02-10 14:43:00 +01:00
}
//show or hide calculator window
void MainWindow::showCalculator() {
if (ui->dwCalculator->isVisible()) {
ui->dwCalculator->hide();
}
else
{
ui->dwCalculator->show();
}
}
//show or hide message window
void MainWindow::showMessage() {
if (ui->dwMessenger->isVisible()) {
ui->dwMessenger->hide();
}
else
{
ui->dwMessenger->show();
}
}
//show or hide message window
void MainWindow::showMonitor() {
if (ui->dwMonitor->isVisible()) {
ui->dwMonitor->hide();
}
else
{
ui->dwMonitor->show();
}
}
2019-02-17 17:24:52 +01:00
// slot to process low level changes that affect the main Window
void MainWindow::dataChange(hp_Change hpchange) {
hpCalcData * ptr=nullptr;
qDebug()<<"MainWindow Datachange";
switch (hpchange.dataChange) {
case HP_MAIN:
break;
case HP_SCREEN: {
if (hpchange.calc!=nullptr) {
hp_ScreenShot scrn;
scrn = hpchange.calc->getScreenShot();
monitorAddImage(scrn);
}
}
2019-09-15 17:23:44 +02:00
break;
default:;
2019-02-17 17:24:52 +01:00
}
}
//Add screen shots to the message window
void MainWindow::monitorAddImage(hp_ScreenShot scrnshot) {
2019-02-18 21:15:04 +01:00
QPixmap * pic;
2019-02-17 17:24:52 +01:00
int col;
int row;
int count;
2019-02-17 20:33:51 +01:00
int maxcol=2; //number of images in a column
2019-02-17 17:24:52 +01:00
if (scrnshot.image!=nullptr) {
//Todo fix default image
2019-02-17 20:33:51 +01:00
pic=new QPixmap(*scrnshot.image);
// pic->scaled(200, 200, Qt::KeepAspectRatio,Qt::SmoothTransformation);
2019-02-17 17:24:52 +01:00
QLabel * label = new QLabel("Screenshot");
label->setPixmap(*pic);
row = ui->wMonitorGrid->rowCount();
col = ui->wMonitorGrid->columnCount();
count = ui->wMonitorGrid->count();
2019-02-17 20:33:51 +01:00
col=count%maxcol;
row=count/maxcol;
2019-02-17 17:24:52 +01:00
2019-02-18 21:15:04 +01:00
// qDebug()<<"Row set"<<row;
// qDebug()<<"Column set"<<col;
2019-02-17 17:24:52 +01:00
ui->wMonitorGrid->addWidget(label,row,col,Qt::AlignTop);
}
else
{
log("Could not load image");
}
ui->dwMonitor->show();
}
2019-09-21 18:00:43 +02:00
void MainWindow::setTimerStopped() {
qDebug()<<"MainWindow:: set timerStopped Flag";
timerStopped=1;
2020-01-19 17:55:14 +01:00
eventThread->exit();
2019-02-10 14:43:00 +01:00
close();
}
2020-01-19 17:55:14 +01:00
2019-09-15 17:23:44 +02:00
void MainWindow::writeSettings()
{
QSettings appSettings("IRGP","QtHPconnect");
}
void MainWindow::readSettings()
{
QSettings appSettings("IRGP","QtHPconnect");
const QByteArray geometry = appSettings.value("geometry", QByteArray()).toByteArray();
if (!geometry.isEmpty()) {
restoreGeometry(geometry);
}
}
2019-03-09 15:39:38 +01:00
hpusb * MainWindow::getAPI() {
return hpapi;
}
2019-02-10 14:43:00 +01:00
//opens a new test window
//todo - link to hpdata
void MainWindow::createTextWindow() {
msgWindow = new QMdiSubWindow(ui->mdiArea);
QTextEdit * textWindow = new QTextEdit("hell",msgWindow);
}
//opens the log window
void MainWindow::createLogWindow() {
if (!logWindow)
logWindow = new hp_MdiWindow(ui->mdiArea);
else
logWindow->show();
if (!logEdit)
logEdit = logWindow->getEditor();
}
//returns the multi document area
QMdiArea * MainWindow::getMdi() {
return ui->mdiArea;
}
2019-02-11 21:54:51 +01:00
2019-03-09 15:39:38 +01:00
//action on refresh button
void MainWindow::refresh(bool clicked) {
qDebug()<<"MainWindow:: Refresh";
QString key;
key=hpTreeModel->getLastDataKey();
hpCalcData * hpdata;
hpdata=hpTreeModel->getHpCalcData(key);
if(hpdata)
hpdata->refresh();
}
//handle hotplug actions
void MainWindow::hotplug_handler(int status) {
qDebug()<<"MainWindow::hotplugin_handler";
if (status==HP_OPEN_DEVICE) {
openHP();
}
if (status==HP_CLOSE_DEVICE) {
//TODO
}
}
2019-02-11 21:54:51 +01:00
void MainWindow::setTreeMenu() {
treeMenu = new QMenu(ui->tvCalculators); // add menu items
2019-03-16 20:34:09 +01:00
treeMenu->addAction(ui->actionSettings);
2019-03-09 15:39:38 +01:00
treeMenu->addAction(ui->actionRefresh);
2019-02-11 21:54:51 +01:00
ui->tvCalculators->setContextMenuPolicy(Qt::CustomContextMenu);
2019-03-16 20:34:09 +01:00
connect(ui->actionSettings, SIGNAL(triggered(bool)),
2019-02-11 21:54:51 +01:00
this, SLOT(treeMenuAction(bool)));
2019-03-09 15:39:38 +01:00
connect(ui->actionRefresh, SIGNAL(triggered(bool)),
this, SLOT(refresh(bool)));
2019-02-11 21:54:51 +01:00
}
void MainWindow::treeMenuAction(bool clicked) {
QPoint pos;
2019-03-16 20:34:09 +01:00
pos=ui->actionSettings->data().toPoint();
2019-02-11 21:54:51 +01:00
QModelIndex index = ui->tvCalculators->indexAt(pos);
if (index.isValid()) {
hpTreeItem * treeItem = dynamic_cast<hpTreeItem *>(hpTreeModel->itemFromIndex(index));
if(treeItem) {
2019-02-25 08:36:58 +01:00
hp_DataType treetype;
2019-02-11 21:54:51 +01:00
treetype=treeItem->getType();
switch (treetype) {
case HP_MAIN:
treeItem->contextAction(getMdi(),CT_PREFERENCE);
break;
2019-09-15 17:23:44 +02:00
default:;
2019-02-11 21:54:51 +01:00
}
}
else
{
log(QStringLiteral("treeItem is null"));
}
}
}
void MainWindow::on_tvCalculators_customContextMenuRequested(const QPoint &pos)
{
QModelIndex index = ui->tvCalculators->indexAt(pos);
if (index.isValid()) {
hpTreeItem * treeItem = dynamic_cast<hpTreeItem *>(hpTreeModel->itemFromIndex(index));
if(treeItem) {
2019-02-25 08:36:58 +01:00
hp_DataType treetype;
2019-02-11 21:54:51 +01:00
treetype=treeItem->getType();
switch (treetype) {
//only show menu on main
case HP_MAIN: {
if(treeMenu) {
ui->actionPreferences->setData(QVariant(pos));
treeMenu->exec(ui->tvCalculators->viewport()->mapToGlobal(pos));
}
}
break;
2019-09-15 17:23:44 +02:00
default:;
2019-02-11 21:54:51 +01:00
}
}
}
}
2019-09-15 17:23:44 +02:00
2020-01-19 17:55:14 +01:00
void MainWindow::closeEvent(QCloseEvent *event)
2019-09-15 17:23:44 +02:00
{
2019-09-21 18:00:43 +02:00
2020-01-19 17:55:14 +01:00
qDebug()<<"MainWindow:: closeEvent Step 1";
writeSettings();
2019-09-21 18:00:43 +02:00
2020-01-19 17:55:14 +01:00
//stop the timer pulse
emit stopTimer();
eventThread->quit();
eventThread->terminate();
eventThread->wait();
event->accept();
qDebug()<<"MainWindow:: closeEvent Step 2";
}
2019-09-21 18:00:43 +02:00
2020-01-19 17:55:14 +01:00
//destructor
MainWindow::~MainWindow()
{
// qDebug()<<"MainWindow:: closeEvent Step 4";
if (myModel!=nullptr) {
2019-09-21 18:00:43 +02:00
delete myModel;
myModel=nullptr;
}
2020-01-19 17:55:14 +01:00
// qDebug()<<"MainWindow:: closeEvent Step 3";
2019-09-21 18:00:43 +02:00
2020-01-19 17:55:14 +01:00
ui->tvCalculators->close();
ui->tvContent->close();
ui->dwContent->close();
ui->dwMonitor->close();
ui->dwMessenger->close();
ui->dwCalculator->close();
2019-09-21 18:00:43 +02:00
2020-01-19 17:55:14 +01:00
// qDebug()<<"MainWindow:: closeEvent Step 5";
if (main_err!=nullptr) {
delete main_err;
main_err=nullptr;
}
2019-09-21 18:00:43 +02:00
2019-09-15 17:23:44 +02:00
qDebug()<<"MainWindow:: closing";
}