Changeset 68691c9 in subsurface


Ignore:
Timestamp:
Feb 11, 2015, 4:34:02 PM (3 years ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
Mtest, android_test, dcDownload, foratdotde, gitMerge, gitdebug, gitpictures, ios, master, mergeKirigamiPort, pictimeshift, resolutionIndependence, spinner, testTomaz, testing, v4.5-branch
Children:
d769c60
Parents:
7d66dcd
git-author:
Tomaz Canabrava <tomaz.canabrava@…> (02/11/15 07:58:23)
git-committer:
Dirk Hohndel <dirk@…> (02/11/15 16:34:02)
Message:

Accept / Cancel location edit

Make it possible to cancel or accept the location edit and
get back to the mainwindow default state.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@…>
Signed-off-by: Dirk Hohndel <dirk@…>

Location:
qt-ui
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • qt-ui/maintab.cpp

    r7d66dcd r68691c9  
    5858        action = new QAction(tr("Discard changes"), this);
    5959        connect(action, SIGNAL(triggered(bool)), this, SLOT(rejectChanges()));
     60        addMessageAction(action);
    6061
    6162        QShortcut *closeKey = new QShortcut(QKeySequence(Qt::Key_Escape), this);
    6263        connect(closeKey, SIGNAL(activated()), this, SLOT(escDetected()));
    63 
    64         addMessageAction(action);
    6564
    6665        if (qApp->style()->objectName() == "oxygen")
  • qt-ui/mainwindow.cpp

    r7d66dcd r68691c9  
    113113        connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan()));
    114114        connect(mainTab, SIGNAL(requestDiveSiteEdit()), this, SLOT(enableDiveSiteEdit()));
     115        connect(locationInformation, SIGNAL(informationManagementEnded()), this, SLOT(setDefaultState()));
    115116#ifdef NO_PRINTING
    116117        ui.printPlan->hide();
     
    216217void MainWindow::enableDiveSiteEdit() {
    217218        setApplicationState("EditDiveSite");
     219}
     220
     221void MainWindow::setDefaultState() {
     222        setApplicationState("Default");
    218223}
    219224
  • qt-ui/mainwindow.h

    r7d66dcd r68691c9  
    161161        void on_actionConfigure_Dive_Computer_triggered();
    162162        void enableDiveSiteEdit();
     163        void setDefaultState();
    163164
    164165protected:
  • qt-ui/simplewidgets.cpp

    r3516ff2 r68691c9  
    77#include <QCalendarWidget>
    88#include <QKeyEvent>
     9#include <QAction>
    910
    1011#include "file.h"
     
    647648        hide();
    648649}
    649 
    650 LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent) {
    651         ui.setupUi(this);
    652 }
     650#include <QDebug>
     651#include <QShowEvent>
     652
     653LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent)
     654{
     655        ui.setupUi(this);
     656        ui.diveSiteMessage->setText("You are editing the Dive Site");
     657        ui.diveSiteMessage->setCloseButtonVisible(false);
     658
     659        QAction *action = new QAction(tr("Apply changes"), this);
     660        connect(action, SIGNAL(triggered(bool)), this, SLOT(acceptChanges()));
     661        ui.diveSiteMessage->addAction(action);
     662
     663        action = new QAction(tr("Discard changes"), this);
     664        connect(action, SIGNAL(triggered(bool)), this, SLOT(rejectChanges()));
     665        ui.diveSiteMessage->addAction(action);
     666}
     667
     668void LocationInformationWidget::acceptChanges()
     669{
     670        emit informationManagementEnded();
     671}
     672
     673void LocationInformationWidget::rejectChanges()
     674{
     675        emit informationManagementEnded();
     676}
     677
     678void LocationInformationWidget::showEvent(QShowEvent *ev) {
     679        ui.diveSiteMessage->setCloseButtonVisible(false);
     680}
  • qt-ui/simplewidgets.h

    r3516ff2 r68691c9  
    222222public:
    223223        LocationInformationWidget(QWidget *parent = 0);
     224
     225public slots:
     226        void acceptChanges();
     227        void rejectChanges();
     228
     229        void showEvent(QShowEvent *);
     230signals:
     231        void informationManagementEnded();
     232
    224233private:
    225234        Ui::LocationInformation ui;
Note: See TracChangeset for help on using the changeset viewer.