aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-09-18 23:23:04 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-09-18 23:23:04 -0300
commitdf63bcd8b794ba5a2a1248503946b34757c73795 (patch)
treebef11378ac8f98ad1b7786c3c203aad778781acd /qt-ui/maintab.cpp
parent506b1338750ba9f29b80e7909693f60781a54ccc (diff)
downloadsubsurface-df63bcd8b794ba5a2a1248503946b34757c73795.tar.gz
Added the Message and the Buttons on the Equipment Tab
Added the Message and the ok/cancel buttons on the Equipment Tab, they don't control the Equipment edition yet, but already does the same as the Notes one, Now I need to merge the other part - the actuall Equipment Edition. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 3b879133b..18702e7ce 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -33,8 +33,11 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui->cylinders->setModel(cylindersModel);
ui->weights->setModel(weightModel);
ui->diveNotesMessage->hide();
+ ui->diveEquipmentMessage->hide();
ui->notesButtonBox->hide();
+ ui->equipmentButtonBox->hide();
ui->diveNotesMessage->setCloseButtonVisible(false);
+ ui->diveEquipmentMessage->setCloseButtonVisible(false);
#ifdef __APPLE__
setDocumentMode(false);
#else
@@ -71,6 +74,9 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
connect(ui->weights->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editWeigthWidget(QModelIndex)));
connect(ui->notesButtonBox, SIGNAL(accepted()), this, SLOT(acceptChanges()));
connect(ui->notesButtonBox, SIGNAL(rejected()), this, SLOT(rejectChanges()));
+ connect(ui->equipmentButtonBox, SIGNAL(accepted()), this, SLOT(acceptChanges()));
+ connect(ui->equipmentButtonBox, SIGNAL(rejected()), this, SLOT(rejectChanges()));
+
ui->cylinders->view()->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate());
ui->weights->view()->setItemDelegateForColumn(WeightModel::TYPE, new WSInfoDelegate());
@@ -86,24 +92,29 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
void MainTab::enableEdition()
{
- mainWindow()->dive_list()->setEnabled(false);
- if (ui->notesButtonBox->isVisible() || !selected_dive)
+ if (!selected_dive)
return;
+ mainWindow()->dive_list()->setEnabled(false);
// We may be editing one or more dives here. backup everything.
notesBackup.clear();
ui->notesButtonBox->show();
+ ui->equipmentButtonBox->show();
if (mainWindow() && mainWindow()->dive_list()->selectedTrips.count() == 1) {
// we are editing trip location and notes
ui->diveNotesMessage->setText(tr("This trip is being edited. Select Save or Undo when ready."));
ui->diveNotesMessage->animatedShow();
+ ui->diveEquipmentMessage->setText(tr("This trip is being edited. Select Save or Undo when ready."));
+ ui->diveEquipmentMessage->animatedShow();
notesBackup[NULL].notes = ui->notes->toPlainText();
notesBackup[NULL].location = ui->location->text();
editMode = TRIP;
} else {
ui->diveNotesMessage->setText(tr("This dive is being edited. Select Save or Undo when ready."));
ui->diveNotesMessage->animatedShow();
+ ui->diveEquipmentMessage->setText(tr("This dive is being edited. Select Save or Undo when ready."));
+ ui->diveEquipmentMessage->animatedShow();
// We may be editing one or more dives here. backup everything.
struct dive *mydive;
@@ -345,7 +356,9 @@ void MainTab::acceptChanges()
tabBar()->setTabIcon(0, QIcon()); // Notes
tabBar()->setTabIcon(1, QIcon()); // Equipment
ui->diveNotesMessage->animatedHide();
+ ui->diveEquipmentMessage->animatedHide();
ui->notesButtonBox->hide();
+ ui->equipmentButtonBox->hide();
/* now figure out if things have changed */
if (mainWindow() && mainWindow()->dive_list()->selectedTrips.count() == 1) {
if (notesBackup[NULL].notes != ui->notes->toPlainText() ||
@@ -393,6 +406,7 @@ void MainTab::rejectChanges()
{
tabBar()->setTabIcon(0, QIcon()); // Notes
tabBar()->setTabIcon(1, QIcon()); // Equipment
+
mainWindow()->dive_list()->setEnabled(true);
if (mainWindow() && mainWindow()->dive_list()->selectedTrips.count() == 1){
ui->notes->setText(notesBackup[NULL].notes );
@@ -428,10 +442,12 @@ void MainTab::rejectChanges()
mydive->visibility = notesBackup[mydive].visibility;
}
}
+
ui->diveNotesMessage->animatedHide();
+ ui->diveEquipmentMessage->animatedHide();
mainWindow()->dive_list()->setEnabled(true);
-
ui->notesButtonBox->hide();
+ ui->equipmentButtonBox->hide();
notesBackup.clear();
QPalette p;
ui->buddy->setPalette(p);