From 7ce12f1e8b4614a7b77bf4f05668ff5c79e7f541 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 2 Dec 2013 15:33:00 -0200 Subject: Removed The button box from mainwindow, buttons are now on the message. The button box on the bottom of the window made it a bit cluttered on small screens, this patch uses the window of the MessageWidget to show the butons - this way less space is used and things are better spaced on screen. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 22 ++++++++++------------ qt-ui/maintab.ui | 54 +++++++++++++++++++----------------------------------- 2 files changed, 29 insertions(+), 47 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 119f154ce..103fe7b8d 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -34,11 +34,19 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), ui.weights->setModel(weightModel); ui.diveNotesMessage->hide(); ui.diveEquipmentMessage->hide(); - ui.notesButtonBox->hide(); - ui.equipmentButtonBox->hide(); ui.diveNotesMessage->setCloseButtonVisible(false); ui.diveEquipmentMessage->setCloseButtonVisible(false); + QAction *action = new QAction(tr("Save"), this); + connect(action, SIGNAL(triggered(bool)), this, SLOT(acceptChanges())); + ui.diveEquipmentMessage->addAction(action); + ui.diveNotesMessage->addAction(action); + + action = new QAction(tr("Cancel"), this); + connect(action, SIGNAL(triggered(bool)), this, SLOT(rejectChanges())); + ui.diveEquipmentMessage->addAction(action); + ui.diveNotesMessage->addAction(action); + if (qApp->style()->objectName() == "oxygen") setDocumentMode(true); else @@ -77,10 +85,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), connect(ui.cylinders->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editCylinderWidget(QModelIndex))); connect(ui.weights->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editWeightWidget(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()); @@ -169,8 +173,6 @@ void MainTab::enableEdition(EditMode newEditMode) mainWindow()->globe()->prepareForGetDiveCoordinates(); // 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 Cancel when done.")); @@ -513,8 +515,6 @@ void MainTab::acceptChanges() 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() || @@ -715,8 +715,6 @@ void MainTab::rejectChanges() ui.diveNotesMessage->animatedHide(); ui.diveEquipmentMessage->animatedHide(); mainWindow()->dive_list()->setEnabled(true); - ui.notesButtonBox->hide(); - ui.equipmentButtonBox->hide(); notesBackup.clear(); resetPallete(); editMode = NONE; diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui index 90bcf57b7..8133afb03 100644 --- a/qt-ui/maintab.ui +++ b/qt-ui/maintab.ui @@ -34,8 +34,8 @@ 0 0 - 501 - 535 + 493 + 586 @@ -170,6 +170,13 @@ + + + + false + + + @@ -195,10 +202,10 @@ - - - - false + + + + Notes @@ -219,20 +226,6 @@ - - - - Notes - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Save - - - @@ -285,8 +278,8 @@ 0 0 - 515 - 473 + 507 + 459 @@ -338,13 +331,6 @@ - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Save - - - @@ -372,8 +358,8 @@ 0 0 - 515 - 473 + 492 + 375 @@ -679,8 +665,8 @@ 0 0 - 515 - 473 + 323 + 130 @@ -857,9 +843,7 @@ suit tagWidget notes - notesButtonBox scrollArea_2 - equipmentButtonBox scrollArea_3 scrollArea_4 -- cgit v1.2.3-70-g09d2