mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Make impossible to change dives while editing one.
This is to prevent loss of data, so if the user is editing something, either cancel the edition or save it, to continue moving around on the Dive List. - Only the dive list is affected, user can still play with the globe and the profile. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
80274b5788
commit
046eacabe5
3 changed files with 51 additions and 6 deletions
|
@ -8,8 +8,10 @@
|
|||
#include "ui_maintab.h"
|
||||
#include "addcylinderdialog.h"
|
||||
#include "addweightsystemdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "../helpers.h"
|
||||
#include "../statistics.h"
|
||||
#include "divelistview.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QDebug>
|
||||
|
@ -218,6 +220,8 @@ void MainTab::on_editNotes_clicked(bool edit)
|
|||
ui->notes->setReadOnly(!edit);
|
||||
ui->rating->setReadOnly(!edit);
|
||||
|
||||
mainWindow()->dive_list()->setEnabled(!edit);
|
||||
|
||||
if (edit){
|
||||
ui->diveNotesMessage->setText("This dive is being edited. click on finish / reset when ready.");
|
||||
ui->diveNotesMessage->animatedShow();
|
||||
|
@ -247,12 +251,13 @@ void MainTab::on_resetNotes_clicked()
|
|||
ui->editNotes->setChecked(false);
|
||||
ui->diveNotesMessage->animatedHide();
|
||||
|
||||
ui->location->setReadOnly(false);
|
||||
ui->divemaster->setReadOnly(false);
|
||||
ui->buddy->setReadOnly(false);
|
||||
ui->suit->setReadOnly(false);
|
||||
ui->notes->setReadOnly(false);
|
||||
ui->rating->setReadOnly(false);
|
||||
ui->location->setReadOnly(true);
|
||||
ui->divemaster->setReadOnly(true);
|
||||
ui->buddy->setReadOnly(true);
|
||||
ui->suit->setReadOnly(true);
|
||||
ui->notes->setReadOnly(true);
|
||||
ui->rating->setReadOnly(true);
|
||||
mainWindow()->dive_list()->setEnabled(true);
|
||||
}
|
||||
|
||||
#define EDIT_NOTES(what, text) \
|
||||
|
|
|
@ -26,6 +26,13 @@
|
|||
#include "modeldelegates.h"
|
||||
#include "models.h"
|
||||
|
||||
static MainWindow* instance = 0;
|
||||
|
||||
MainWindow* mainWindow()
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
|
||||
MainWindow::MainWindow() : ui(new Ui::MainWindow())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -39,6 +46,7 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow())
|
|||
ui->ListWidget->reload();
|
||||
ui->ListWidget->setFocus();
|
||||
ui->globe->reload();
|
||||
instance = this;
|
||||
}
|
||||
|
||||
void MainWindow::current_dive_changed(int divenr)
|
||||
|
@ -465,3 +473,23 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||
event->accept();
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
DiveListView* MainWindow::dive_list()
|
||||
{
|
||||
return ui->ListWidget;
|
||||
}
|
||||
|
||||
GlobeGPS* MainWindow::globe()
|
||||
{
|
||||
return ui->globe;
|
||||
}
|
||||
|
||||
ProfileGraphicsView* MainWindow::graphics()
|
||||
{
|
||||
return ui->ProfileWidget;
|
||||
}
|
||||
|
||||
MainTab* MainWindow::information()
|
||||
{
|
||||
return ui->InfoWidget;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <QModelIndex>
|
||||
#include <QAction>
|
||||
|
||||
struct DiveList;
|
||||
class QSortFilterProxyModel;
|
||||
class DiveTripModel;
|
||||
|
||||
|
@ -24,15 +25,24 @@ class DiveNotes;
|
|||
class Stats;
|
||||
class Equipment;
|
||||
class QItemSelection;
|
||||
class DiveListView;
|
||||
class GlobeGPS;
|
||||
class MainTab;
|
||||
class ProfileGraphicsView;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow();
|
||||
ProfileGraphicsView *graphics();
|
||||
MainTab *information();
|
||||
DiveListView *dive_list();
|
||||
GlobeGPS *globe();
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
|
||||
/* file menu action */
|
||||
void on_actionNew_triggered();
|
||||
void on_actionOpen_triggered();
|
||||
|
@ -86,4 +96,6 @@ private:
|
|||
void redrawProfile();
|
||||
};
|
||||
|
||||
MainWindow *mainWindow();
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue