mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Selection: move commands/command_private.* to core/selection.*
The file command_private.cpp had functions concerning selections only. To make these functions accessible from outside the undo machinery, turn it into a part of the core-library. Currently, only C++ functions are exported. We might think about also exporting a C interface. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
d0b3a06e03
commit
7787bfbf9e
8 changed files with 19 additions and 23 deletions
|
@ -14,8 +14,6 @@ set(SUBSURFACE_GENERIC_COMMANDS_SRCS
|
|||
command_edit.h
|
||||
command_edit_trip.cpp
|
||||
command_edit_trip.h
|
||||
command_private.cpp
|
||||
command_private.h
|
||||
)
|
||||
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
|
||||
add_library(subsurface_commands_desktop STATIC ${SUBSURFACE_GENERIC_COMMANDS_SRCS})
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include "command_divelist.h"
|
||||
#include "command_private.h"
|
||||
#include "core/divelist.h"
|
||||
#include "core/display.h" // for amount_selected
|
||||
#include "core/qthelper.h"
|
||||
#include "core/selection.h"
|
||||
#include "core/subsurface-qt/DiveListNotifier.h"
|
||||
#include "qt-models/filtermodels.h"
|
||||
#include "../profile-widget/profilewidget2.h"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include "command_divesite.h"
|
||||
#include "command_private.h"
|
||||
#include "core/divesite.h"
|
||||
#include "core/subsurface-qt/DiveListNotifier.h"
|
||||
#include "core/qthelper.h"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include "command_edit.h"
|
||||
#include "command_private.h"
|
||||
#include "core/divelist.h"
|
||||
#include "core/qthelper.h" // for copy_qstring
|
||||
#include "core/selection.h"
|
||||
#include "core/subsurface-string.h"
|
||||
#include "core/tag.h"
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include "command_edit_trip.h"
|
||||
#include "command_private.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/selection.h"
|
||||
|
||||
namespace Command {
|
||||
|
||||
|
|
|
@ -139,6 +139,8 @@ set(SUBSURFACE_CORE_LIB_SRCS
|
|||
save-html.h
|
||||
save-profiledata.c
|
||||
save-xml.c
|
||||
selection.cpp
|
||||
selection.h
|
||||
sha1.c
|
||||
sha1.h
|
||||
ssrf.h
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Helper functions for the undo-commands
|
||||
|
||||
#include "command_private.h"
|
||||
#include "core/divelist.h"
|
||||
#include "core/display.h" // for amount_selected
|
||||
#include "core/subsurface-qt/DiveListNotifier.h"
|
||||
#include "selection.h"
|
||||
#include "divelist.h"
|
||||
#include "display.h" // for amount_selected
|
||||
#include "subsurface-qt/DiveListNotifier.h"
|
||||
|
||||
namespace Command {
|
||||
#include <QVector>
|
||||
|
||||
// Set the current dive either from a list of selected dives,
|
||||
// or a newly selected dive. In both cases, try to select the
|
||||
|
@ -104,5 +104,3 @@ std::vector<dive *> getDiveSelection()
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
} // namespace Command
|
|
@ -1,25 +1,24 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Private definitions for the command-objects
|
||||
// Selection related functions
|
||||
|
||||
#ifndef COMMAND_PRIVATE_H
|
||||
#define COMMAND_PRIVATE_H
|
||||
#ifndef SELECTION_H
|
||||
#define SELECTION_H
|
||||
|
||||
#include "core/dive.h"
|
||||
/*** C++-only functions ***/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <QVector>
|
||||
|
||||
namespace Command {
|
||||
struct dive;
|
||||
|
||||
// Reset the selection to the dives of the "selection" vector and send the appropriate signals.
|
||||
// Set the current dive to "currentDive". "currentDive" must be an element of "selection" (or
|
||||
// null if "seletion" is empty). Return true if the selection or current dive changed.
|
||||
// null if "seletion" is empty).
|
||||
void setSelection(const std::vector<dive *> &selection, dive *currentDive);
|
||||
|
||||
// Get currently selectd dives
|
||||
std::vector<dive *> getDiveSelection();
|
||||
|
||||
} // namespace Command
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // COMMAND_PRIVATE_H
|
||||
#endif // SELECTION_H
|
Loading…
Add table
Reference in a new issue