diff --git a/qt-ui/divecomponentselection.ui b/qt-ui/divecomponentselection.ui
new file mode 100644
index 000000000..644a1fef2
--- /dev/null
+++ b/qt-ui/divecomponentselection.ui
@@ -0,0 +1,165 @@
+
+
+ DiveComponentSelectionDialog
+
+
+ Qt::WindowModal
+
+
+
+ 0
+ 0
+ 308
+ 263
+
+
+
+
+ 0
+ 0
+
+
+
+ Component selection
+
+
+
+ :/subsurface-icon
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Which components would you like to copy
+
+
+
-
+
+
+ Location
+
+
+
+ -
+
+
+ Suit
+
+
+
+ -
+
+
+ GPS coordinates
+
+
+
+ -
+
+
+ Cylinders
+
+
+
+ -
+
+
+ Divemaster
+
+
+
+ -
+
+
+ Weights
+
+
+
+ -
+
+
+ Buddy
+
+
+
+ -
+
+
+ Rating
+
+
+
+ -
+
+
+ Visibility
+
+
+
+ -
+
+
+ Notes
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ DiveComponentSelectionDialog
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ DiveComponentSelectionDialog
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 687fc778d..29212564b 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -114,6 +114,8 @@ MainWindow::MainWindow() : QMainWindow(),
#ifdef NO_PRINTING
ui.menuFile->removeAction(ui.actionPrint);
#endif
+ memset(©PasteDive, 0, sizeof(copyPasteDive));
+ memset(&what, 0, sizeof(what));
}
MainWindow::~MainWindow()
@@ -1300,3 +1302,16 @@ void MainWindow::setEnabledToolbar(bool arg1)
Q_FOREACH(QToolButton *b, toolBar)
b->setEnabled(arg1);
}
+
+void MainWindow::on_copy_triggered()
+{
+ // open dialog to select what gets copied
+ // copy the displayed dive
+ DiveComponentSelection dialog(this, ©PasteDive, &what);
+ dialog.exec();
+}
+
+void MainWindow::on_paste_triggered()
+{
+ // take the data in our copyPasteDive and apply it to selected dives
+}
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index 9081bf457..40d82afb9 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -143,6 +143,8 @@ slots:
void on_profTogglePicture_clicked(bool triggered);
void on_profTankbar_clicked(bool triggered);
void on_actionExport_triggered();
+ void on_copy_triggered();
+ void on_paste_triggered();
protected:
void closeEvent(QCloseEvent *);
@@ -185,6 +187,8 @@ private:
bool plannerStateClean();
void setupForAddAndPlan(const char *model);
QDialog *survey;
+ struct dive copyPasteDive;
+ struct dive_components what;
};
#endif // MAINWINDOW_H
diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
index 5faac083b..63d78c702 100644
--- a/qt-ui/mainwindow.ui
+++ b/qt-ui/mainwindow.ui
@@ -720,6 +720,8 @@ p, li { white-space: pre-wrap; }
+
+
@@ -879,6 +881,22 @@ p, li { white-space: pre-wrap; }
Ctrl++
+
+
+ &Copy dive components
+
+
+ Ctrl+C
+
+
+
+
+ &Paste dive components
+
+
+ Ctrl+V
+
+
&Renumber
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index 217291277..a10092ff6 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -411,3 +411,45 @@ void DateWidget::keyPressEvent(QKeyEvent *event)
QWidget::keyPressEvent(event);
}
}
+
+#define COMPONENT_FROM_UI(_component) what->_component = ui._component->isChecked()
+#define UI_FROM_COMPONENT(_component) ui._component->setChecked(what->_component)
+
+DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *target, struct dive_components *_what):
+ targetDive(target)
+{
+ ui.setupUi(this);
+ what = _what;
+ UI_FROM_COMPONENT(location);
+ UI_FROM_COMPONENT(gps);
+ UI_FROM_COMPONENT(divemaster);
+ UI_FROM_COMPONENT(buddy);
+ UI_FROM_COMPONENT(rating);
+ UI_FROM_COMPONENT(visibility);
+ UI_FROM_COMPONENT(notes);
+ UI_FROM_COMPONENT(suit);
+ UI_FROM_COMPONENT(cylinders);
+ UI_FROM_COMPONENT(weights);
+ connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
+ QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
+ connect(close, SIGNAL(activated()), this, SLOT(close()));
+ QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
+ connect(quit, SIGNAL(activated()), parent, SLOT(close()));
+}
+
+void DiveComponentSelection::buttonClicked(QAbstractButton *button)
+{
+ if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
+ COMPONENT_FROM_UI(location);
+ COMPONENT_FROM_UI(gps);
+ COMPONENT_FROM_UI(divemaster);
+ COMPONENT_FROM_UI(buddy);
+ COMPONENT_FROM_UI(rating);
+ COMPONENT_FROM_UI(visibility);
+ COMPONENT_FROM_UI(notes);
+ COMPONENT_FROM_UI(suit);
+ COMPONENT_FROM_UI(cylinders);
+ COMPONENT_FROM_UI(weights);
+ selective_copy_dive(&displayed_dive, targetDive, *what);
+ }
+}
diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h
index 58c9199a5..b41189fe5 100644
--- a/qt-ui/simplewidgets.h
+++ b/qt-ui/simplewidgets.h
@@ -11,6 +11,7 @@ class QAbstractButton;
#include "ui_renumber.h"
#include "ui_shifttimes.h"
#include "ui_shiftimagetimes.h"
+#include "ui_divecomponentselection.h"
#include "exif.h"
class MinMaxAvgWidget : public QWidget {
@@ -112,6 +113,19 @@ private:
QCalendarWidget *calendarWidget;
};
+class DiveComponentSelection : public QDialog {
+ Q_OBJECT
+public:
+ explicit DiveComponentSelection(QWidget *parent, struct dive *target, struct dive_components *_what);
+private
+slots:
+ void buttonClicked(QAbstractButton *button);
+private:
+ Ui::DiveComponentSelectionDialog ui;
+ struct dive *targetDive;
+ struct dive_components *what;
+};
+
bool isGnome3Session();
QImage grayImage(const QImage& coloredImg);
diff --git a/subsurface.pro b/subsurface.pro
index 0aa6a5de9..14003f0a6 100644
--- a/subsurface.pro
+++ b/subsurface.pro
@@ -198,7 +198,8 @@ FORMS = \
qt-ui/searchbar.ui \
qt-ui/divelogexportdialog.ui \
qt-ui/plannerSettings.ui \
- qt-ui/usersurvey.ui
+ qt-ui/usersurvey.ui \
+ qt-ui/divecomponentselection.ui
# Nether usermanual or printing is supported on android right now
android: FORMS -= qt-ui/printoptions.ui