Refactoring: move undo commands to top level

In the future we might want to use undo-commands for mobile as
well (even if not implementing undo).

Therefore, move the undo-command source from desktop-widgets
to their own commands top-level folder.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-11-13 15:08:40 +01:00 committed by bstoeger
parent 685b92b9c2
commit 5e29245e68
34 changed files with 45 additions and 31 deletions

View file

@ -272,6 +272,7 @@ endif()
add_subdirectory(translations)
add_subdirectory(core)
add_subdirectory(qt-models)
add_subdirectory(commands)
add_subdirectory(profile-widget)
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
@ -343,6 +344,7 @@ elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
subsurface_profile
subsurface_statistics
subsurface_models_desktop
subsurface_commands_desktop
subsurface_corelib
${SUBSURFACE_LINK_LIBRARIES}
)

26
commands/CMakeLists.txt Normal file
View file

@ -0,0 +1,26 @@
# the undo-commands that perform undoable actions.
# models used both mobile and desktop builds
set(SUBSURFACE_GENERIC_COMMANDS_SRCS
command_base.cpp
command_base.h
command.cpp
command.h
command_divelist.cpp
command_divelist.h
command_divesite.cpp
command_divesite.h
command_edit.cpp
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})
target_link_libraries(subsurface_commands_desktop ${QT_LIBRARIES})
#elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
# add_library(subsurface_commands_mobile STATIC ${SUBSURFACE_GENERIC_COMMANDS_SRCS})
# target_link_libraries(subsurface_commands_mobile ${QT_LIBRARIES})
endif()

View file

@ -58,20 +58,6 @@ set(SUBSURFACE_INTERFACE
../map-widget/qmlmapwidgethelper.cpp
about.cpp
about.h
command.cpp
command.h
command_base.cpp
command_base.h
command_divelist.cpp
command_divelist.h
command_divesite.cpp
command_divesite.h
command_edit.cpp
command_edit.h
command_edit_trip.cpp
command_edit_trip.h
command_private.cpp
command_private.h
configuredivecomputerdialog.cpp
configuredivecomputerdialog.h
divecomputermanagementdialog.cpp

View file

@ -19,10 +19,10 @@
#include <QStandardPaths>
#include <QMessageBox>
#include <QHeaderView>
#include "commands/command.h"
#include "core/errorhelper.h"
#include "core/qthelper.h"
#include "core/trip.h"
#include "desktop-widgets/command.h"
#include "desktop-widgets/divelistview.h"
#include "qt-models/divepicturemodel.h"
#include "core/metrics.h"

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "desktop-widgets/divelogimportdialog.h"
#include "desktop-widgets/mainwindow.h"
#include "desktop-widgets/command.h"
#include "commands/command.h"
#include "core/color.h"
#include "ui_divelogimportdialog.h"
#include <QShortcut>

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "desktop-widgets/divesiteimportdialog.h"
#include "desktop-widgets/command.h"
#include "commands/command.h"
#include "core/display.h"
#include "core/qthelper.h"
#include "core/metrics.h"

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "desktop-widgets/downloadfromdivecomputer.h"
#include "desktop-widgets/command.h"
#include "commands/command.h"
#include "core/display.h"
#include "core/qthelper.h"
#include "core/divelist.h"

View file

@ -9,9 +9,9 @@
#include "core/divesitehelpers.h"
#include "desktop-widgets/modeldelegates.h"
#include "core/subsurface-qt/DiveListNotifier.h"
#include "command.h"
#include "core/taxonomy.h"
#include "core/settings/qPrefUnit.h"
#include "commands/command.h"
#include <QDebug>
#include <QShowEvent>

View file

@ -41,7 +41,6 @@
#include "core/subsurface-qt/DiveListNotifier.h"
#include "desktop-widgets/about.h"
#include "desktop-widgets/command.h"
#include "desktop-widgets/divecomputermanagementdialog.h"
#include "desktop-widgets/divelistview.h"
#include "desktop-widgets/divelogexportdialog.h"
@ -57,6 +56,7 @@
#include "desktop-widgets/updatemanager.h"
#include "desktop-widgets/usersurvey.h"
#include "desktop-widgets/simplewidgets.h"
#include "commands/command.h"
#include "profile-widget/profilewidget2.h"

View file

@ -11,7 +11,7 @@
#include "qt-models/divelocationmodel.h"
#include "mainwindow.h"
#include "divelistview.h"
#include "command.h"
#include "commands/command.h"
static const QUrl urlMapWidget = QUrl(QStringLiteral("qrc:/qml/MapWidget.qml"));
static const QUrl urlMapWidgetError = QUrl(QStringLiteral("qrc:/qml/MapWidgetError.qml"));

View file

@ -20,7 +20,7 @@
#include "desktop-widgets/divelistview.h"
#include "core/display.h"
#include "profile-widget/profilewidget2.h"
#include "desktop-widgets/command.h"
#include "commands/command.h"
#include "core/metadata.h"
#include "core/tag.h"
#include "core/divelist.h" // for mark_divelist_changed

View file

@ -4,8 +4,8 @@
#include "core/webservice.h"
#include "core/settings/qPrefCloudStorage.h"
#include "desktop-widgets/mainwindow.h"
#include "desktop-widgets/command.h"
#include "desktop-widgets/usersurvey.h"
#include "commands/command.h"
#include "core/trip.h"
#include "core/errorhelper.h"
#include "core/file.h"

View file

@ -4,7 +4,7 @@
#include "desktop-widgets/mainwindow.h" // TODO: Only used temporarilly for edit mode changes
#include "desktop-widgets/simplewidgets.h" // For isGnome3Session()
#include "desktop-widgets/modeldelegates.h"
#include "desktop-widgets/command.h"
#include "commands/command.h"
#include "profile-widget/profilewidget2.h"
#include "qt-models/cylindermodel.h"

View file

@ -4,9 +4,9 @@
#include "desktop-widgets/mainwindow.h" // TODO: Only used temporarilly for edit mode changes
#include "profile-widget/profilewidget2.h"
#include "../tagwidget.h"
#include "commands/command.h"
#include "core/units.h"
#include "core/dive.h"
#include "desktop-widgets/command.h"
#include "core/qthelper.h"
#include "core/statistics.h"
#include "core/display.h"

View file

@ -4,7 +4,7 @@
#include "core/divesite.h"
#include "qt-models/divelocationmodel.h"
#include "qt-models/filtermodels.h"
#include "desktop-widgets/command.h"
#include "commands/command.h"
#include <qt-models/divecomputerextradatamodel.h>

View file

@ -24,8 +24,8 @@
#include "core/subsurface-string.h"
#include "core/gettextfromc.h"
#include "desktop-widgets/locationinformation.h"
#include "desktop-widgets/command.h"
#include "desktop-widgets/simplewidgets.h"
#include "commands/command.h"
#include "TabDiveEquipment.h"
#include "TabDiveExtraInfo.h"

View file

@ -24,8 +24,8 @@
#include "desktop-widgets/diveplanner.h"
#include "desktop-widgets/simplewidgets.h"
#include "desktop-widgets/divepicturewidget.h"
#include "desktop-widgets/command.h"
#include "desktop-widgets/mainwindow.h"
#include "commands/command.h"
#include "core/qthelper.h"
#include "core/gettextfromc.h"
#include "core/imagedownloader.h"

View file

@ -8,7 +8,7 @@
#ifndef SUBSURFACE_MOBILE
#include "cleanertablemodel.h" // for trashIcon() and editIcon()
#include "desktop-widgets/mainwindow.h" // to place message box
#include "desktop-widgets/command.h"
#include "commands/command.h"
#include <QMessageBox>
#endif
#include <QLineEdit>

View file

@ -7,7 +7,7 @@
#include "core/device.h"
#include "core/qthelper.h"
#include "core/settings/qPrefDivePlanner.h"
#include "desktop-widgets/command.h"
#include "commands/command.h"
#include "core/gettextfromc.h"
#include "core/deco.h"
#include <QApplication>

View file

@ -9,7 +9,7 @@
#include "core/subsurface-string.h"
#include "core/tag.h"
#include "qt-models/divelocationmodel.h" // For the dive-site field ids
#include "desktop-widgets/command.h"
#include "commands/command.h"
#include <QIcon>
#include <QDebug>
#include <memory>