mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: make owning pointers a top-level features
The undo-code uses owning pointers based on std::unique_ptr to manage lifetime of C-objects. Since these are generally useful, move them from the undo-code to the core-code. In fact, this eliminates one instance of code duplication. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5b1557ccb1
commit
c5d6e0f44f
7 changed files with 50 additions and 31 deletions
|
@ -5,10 +5,10 @@
|
|||
#define PROFILEWIDGET_H
|
||||
|
||||
#include "ui_profilewidget.h"
|
||||
#include "core/owning_ptrs.h"
|
||||
#include "core/subsurface-qt/divelistnotifier.h"
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
struct dive;
|
||||
class ProfileWidget2;
|
||||
|
@ -40,11 +40,6 @@ slots:
|
|||
void stopRemoved(int count);
|
||||
void stopMoved(int count);
|
||||
private:
|
||||
// The same code is in command/command_base.h. Should we make that a global feature?
|
||||
struct DiveDeleter {
|
||||
void operator()(dive *d) { free_dive(d); }
|
||||
};
|
||||
|
||||
std::unique_ptr<EmptyView> emptyView;
|
||||
std::vector<QAction *> toolbarActions;
|
||||
Ui::ProfileWidget ui;
|
||||
|
@ -53,7 +48,7 @@ private:
|
|||
void editDive();
|
||||
void exitEditMode();
|
||||
void rotateDC(int dir);
|
||||
std::unique_ptr<dive, DiveDeleter> editedDive;
|
||||
OwningDivePtr editedDive;
|
||||
int editedDc;
|
||||
dive *originalDive;
|
||||
bool placingCommand;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue