mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
506b133875
commit
df63bcd8b7
3 changed files with 32 additions and 5 deletions
|
@ -389,6 +389,7 @@ void KMessageWidget::animatedShow()
|
|||
void KMessageWidget::animatedHide()
|
||||
{
|
||||
if (!isVisible()) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
mainWindow()->dive_list()->setEnabled(true);
|
||||
|
||||
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);
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue