diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-09-18 23:23:04 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-09-18 23:23:04 -0300 |
commit | df63bcd8b794ba5a2a1248503946b34757c73795 (patch) | |
tree | bef11378ac8f98ad1b7786c3c203aad778781acd /qt-ui | |
parent | 506b1338750ba9f29b80e7909693f60781a54ccc (diff) | |
download | subsurface-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')
-rw-r--r-- | qt-ui/kmessagewidget.cpp | 1 | ||||
-rw-r--r-- | qt-ui/maintab.cpp | 22 | ||||
-rw-r--r-- | qt-ui/maintab.ui | 12 |
3 files changed, 31 insertions, 4 deletions
diff --git a/qt-ui/kmessagewidget.cpp b/qt-ui/kmessagewidget.cpp index 5b37c7455..8094eca6f 100644 --- a/qt-ui/kmessagewidget.cpp +++ b/qt-ui/kmessagewidget.cpp @@ -389,6 +389,7 @@ void KMessageWidget::animatedShow() void KMessageWidget::animatedHide() { if (!isVisible()) { + hide(); return; } 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); diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui index 3a988fc3e..9253aff1e 100644 --- a/qt-ui/maintab.ui +++ b/qt-ui/maintab.ui @@ -150,7 +150,7 @@ <string>Equipment</string> </attribute> <layout class="QGridLayout" name="gridLayout_4"> - <item row="0" column="0"> + <item row="1" column="0"> <widget class="QWidget" name="widget" native="true"> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> @@ -180,6 +180,16 @@ </layout> </widget> </item> + <item row="0" column="0"> + <widget class="KMessageWidget" name="diveEquipmentMessage" native="true"/> + </item> + <item row="2" column="0"> + <widget class="QDialogButtonBox" name="equipmentButtonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> </layout> </widget> <widget class="QWidget" name="infoTab"> |