Break down MainTab into smaller classes

Maintab is one of our most complex classes, and it's
something I'm not actually proud of. But it currently
works and the idea of splitting it was in my head for
quite a while.

This is the third or fourth tentative of splitting it,
and this time I let the most complex part of it untouched,
the Notes and Equipment tab are way too complex to untangle
right now on my limited time.

A new class 'TabBase' should be used for any new tab that
we may create, and added on the MainTab (see the new lines
on the MainTab constructor).

Also, Extra Info, Information, Photos and Statistics where
ported to this new way helping reduce the number of
lines and functions on the MainTab quite a bit.

Overall this is a step in the right direction for the future.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2017-04-04 19:21:30 +02:00 committed by Dirk Hohndel
parent 8a71196e4e
commit 1fc4fba69f
23 changed files with 1152 additions and 886 deletions

View file

@ -0,0 +1,29 @@
#include "TabDiveExtraInfo.h"
#include "ui_TabDiveExtraInfo.h"
#include <qt-models/divecomputerextradatamodel.h>
TabDiveExtraInfo::TabDiveExtraInfo(QWidget *parent) :
TabBase(parent),
ui(new Ui::TabDiveExtraInfo()),
extraDataModel(new ExtraDataModel())
{
ui->setupUi(this);
ui->extraData->setModel(extraDataModel);
}
TabDiveExtraInfo::~TabDiveExtraInfo()
{
delete ui;
}
void TabDiveExtraInfo::updateData()
{
extraDataModel->updateDive();
}
void TabDiveExtraInfo::clear()
{
extraDataModel->updateDive();
}