From 1d6683f3e07d9a73af5fab702bc3a551ec7dabc9 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 3 Sep 2015 15:56:37 -0300 Subject: [PATCH] Move Profile widget out of desktop-widgets The reason for that is, even if profile widget is made with qpainter and for that reason it should be a desktop widget, it's being used on the mobile version because of a lack of QML plotting library that is fast and reliable. We discovered that it was faster just to encapsulate our Profile in a QML class and call it directly. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- CMakeLists.txt | 3 ++- desktop-widgets/CMakeLists.txt | 19 ------------------- desktop-widgets/diveplanner.cpp | 6 +++--- desktop-widgets/maintab.cpp | 2 +- desktop-widgets/mainwindow.cpp | 2 +- desktop-widgets/modeldelegates.cpp | 2 +- desktop-widgets/printer.cpp | 1 + desktop-widgets/printer.h | 1 - desktop-widgets/simplewidgets.cpp | 2 +- desktop-widgets/socialnetworks.cpp | 2 +- profile-widget/CMakeLists.txt | 19 +++++++++++++++++++ .../animationfunctions.cpp | 0 .../animationfunctions.h | 0 .../divecartesianaxis.cpp | 0 .../divecartesianaxis.h | 0 .../diveeventitem.cpp | 0 .../diveeventitem.h | 0 .../divelineitem.cpp | 0 .../profile => profile-widget}/divelineitem.h | 0 .../divepixmapitem.cpp | 0 .../divepixmapitem.h | 0 .../diveprofileitem.cpp | 2 +- .../diveprofileitem.h | 0 .../diverectitem.cpp | 0 .../profile => profile-widget}/diverectitem.h | 0 .../divetextitem.cpp | 0 .../profile => profile-widget}/divetextitem.h | 0 .../divetooltipitem.cpp | 0 .../divetooltipitem.h | 0 .../profilewidget2.cpp | 0 .../profilewidget2.h | 0 .../profile => profile-widget}/ruleritem.cpp | 0 .../profile => profile-widget}/ruleritem.h | 0 .../profile => profile-widget}/tankitem.cpp | 0 .../profile => profile-widget}/tankitem.h | 0 qt-models/CMakeLists.txt | 1 + 36 files changed, 32 insertions(+), 30 deletions(-) create mode 100644 profile-widget/CMakeLists.txt rename {desktop-widgets/profile => profile-widget}/animationfunctions.cpp (100%) rename {desktop-widgets/profile => profile-widget}/animationfunctions.h (100%) rename {desktop-widgets/profile => profile-widget}/divecartesianaxis.cpp (100%) rename {desktop-widgets/profile => profile-widget}/divecartesianaxis.h (100%) rename {desktop-widgets/profile => profile-widget}/diveeventitem.cpp (100%) rename {desktop-widgets/profile => profile-widget}/diveeventitem.h (100%) rename {desktop-widgets/profile => profile-widget}/divelineitem.cpp (100%) rename {desktop-widgets/profile => profile-widget}/divelineitem.h (100%) rename {desktop-widgets/profile => profile-widget}/divepixmapitem.cpp (100%) rename {desktop-widgets/profile => profile-widget}/divepixmapitem.h (100%) rename {desktop-widgets/profile => profile-widget}/diveprofileitem.cpp (99%) rename {desktop-widgets/profile => profile-widget}/diveprofileitem.h (100%) rename {desktop-widgets/profile => profile-widget}/diverectitem.cpp (100%) rename {desktop-widgets/profile => profile-widget}/diverectitem.h (100%) rename {desktop-widgets/profile => profile-widget}/divetextitem.cpp (100%) rename {desktop-widgets/profile => profile-widget}/divetextitem.h (100%) rename {desktop-widgets/profile => profile-widget}/divetooltipitem.cpp (100%) rename {desktop-widgets/profile => profile-widget}/divetooltipitem.h (100%) rename {desktop-widgets/profile => profile-widget}/profilewidget2.cpp (100%) rename {desktop-widgets/profile => profile-widget}/profilewidget2.h (100%) rename {desktop-widgets/profile => profile-widget}/ruleritem.cpp (100%) rename {desktop-widgets/profile => profile-widget}/ruleritem.h (100%) rename {desktop-widgets/profile => profile-widget}/tankitem.cpp (100%) rename {desktop-widgets/profile => profile-widget}/tankitem.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index cdee60858..b5b0195a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,6 +313,8 @@ endif() add_subdirectory(translations) add_subdirectory(subsurface-core) add_subdirectory(qt-models) +add_subdirectory(profile-widget) +add_subdirectory(desktop-widgets) if(FBSUPPORT) add_definitions(-DFBSUPPORT) @@ -338,7 +340,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ANDROID) set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lpthread) endif() -add_subdirectory(desktop-widgets) # create the executables if(SUBSURFACE_MOBILE) diff --git a/desktop-widgets/CMakeLists.txt b/desktop-widgets/CMakeLists.txt index 2c373b83f..635a8b68e 100644 --- a/desktop-widgets/CMakeLists.txt +++ b/desktop-widgets/CMakeLists.txt @@ -75,23 +75,6 @@ endif() source_group("Subsurface Interface" FILES ${SUBSURFACE_INTERFACE}) -# the profile widget -set(SUBSURFACE_PROFILE_LIB_SRCS - profile/profilewidget2.cpp - profile/diverectitem.cpp - profile/divepixmapitem.cpp - profile/divelineitem.cpp - profile/divetextitem.cpp - profile/animationfunctions.cpp - profile/divecartesianaxis.cpp - profile/diveprofileitem.cpp - profile/diveeventitem.cpp - profile/divetooltipitem.cpp - profile/ruleritem.cpp - profile/tankitem.cpp -) -source_group("Subsurface Profile" FILES ${SUBSURFACE_PROFILE_LIB_SRCS}) - # the yearly statistics widget. set(SUBSURFACE_STATISTICS_LIB_SRCS statistics/statisticswidget.cpp @@ -101,8 +84,6 @@ set(SUBSURFACE_STATISTICS_LIB_SRCS ) source_group("Subsurface Statistics" FILES ${SUBSURFACE_STATISTICS_LIB_SRCS}) -add_library(subsurface_profile STATIC ${SUBSURFACE_PROFILE_LIB_SRCS}) -target_link_libraries(subsurface_profile ${QT_LIBRARIES}) add_library(subsurface_statistics STATIC ${SUBSURFACE_STATISTICS_LIB_SRCS}) target_link_libraries(subsurface_statistics ${QT_LIBRARIES}) add_library(subsurface_generated_ui STATIC ${SUBSURFACE_UI_HDRS}) diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index b4413d11a..86f03b1d2 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -5,7 +5,7 @@ #include "helpers.h" #include "cylindermodel.h" #include "models.h" -#include "profile/profilewidget2.h" +#include "profile-widget/profilewidget2.h" #include "diveplannermodel.h" #include @@ -328,11 +328,11 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) modeMapper->setMapping(ui.recreational_deco, int(RECREATIONAL)); modeMapper->setMapping(ui.buehlmann_deco, int(BUEHLMANN)); modeMapper->setMapping(ui.vpmb_deco, int(VPMB)); - + connect(ui.recreational_deco, SIGNAL(clicked()), modeMapper, SLOT(map())); connect(ui.buehlmann_deco, SIGNAL(clicked()), modeMapper, SLOT(map())); connect(ui.vpmb_deco, SIGNAL(clicked()), modeMapper, SLOT(map())); - + connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool))); connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(bool))); connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool))); diff --git a/desktop-widgets/maintab.cpp b/desktop-widgets/maintab.cpp index 0afb7b4c0..4d4cd3a5e 100644 --- a/desktop-widgets/maintab.cpp +++ b/desktop-widgets/maintab.cpp @@ -13,7 +13,7 @@ #include "diveplannermodel.h" #include "divelistview.h" #include "display.h" -#include "profile/profilewidget2.h" +#include "profile-widget/profilewidget2.h" #include "diveplanner.h" #include "divesitehelpers.h" #include "cylindermodel.h" diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index e1e0d81a2..43b433d62 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -21,7 +21,7 @@ #include "updatemanager.h" #include "planner.h" #include "filtermodels.h" -#include "profile/profilewidget2.h" +#include "profile-widget/profilewidget2.h" #include "globe.h" #include "divecomputer.h" #include "maintab.h" diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index 881037a83..1b1a31c0b 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -5,7 +5,7 @@ #include "cylindermodel.h" #include "models.h" #include "starwidget.h" -#include "profile/profilewidget2.h" +#include "profile-widget/profilewidget2.h" #include "tankinfomodel.h" #include "weigthsysteminfomodel.h" #include "weightmodel.h" diff --git a/desktop-widgets/printer.cpp b/desktop-widgets/printer.cpp index f0197d446..33ee71b55 100644 --- a/desktop-widgets/printer.cpp +++ b/desktop-widgets/printer.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "profile-widget/profilewidget2.h" Printer::Printer(QPaintDevice *paintDevice, print_options *printOptions, template_options *templateOptions, PrintMode printMode) { diff --git a/desktop-widgets/printer.h b/desktop-widgets/printer.h index 979cacd6a..e5f16d77d 100644 --- a/desktop-widgets/printer.h +++ b/desktop-widgets/printer.h @@ -6,7 +6,6 @@ #include #include -#include "profile/profilewidget2.h" #include "printoptions.h" #include "templateedit.h" diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 62a9cc646..43ad1ddc0 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -14,7 +14,7 @@ #include "libdivecomputer/parser.h" #include "divelistview.h" #include "display.h" -#include "profile/profilewidget2.h" +#include "profile-widget/profilewidget2.h" #include "undocommands.h" class MinMaxAvgWidgetPrivate { diff --git a/desktop-widgets/socialnetworks.cpp b/desktop-widgets/socialnetworks.cpp index 6e191267a..0794c764e 100644 --- a/desktop-widgets/socialnetworks.cpp +++ b/desktop-widgets/socialnetworks.cpp @@ -16,7 +16,7 @@ #include #include #include "mainwindow.h" -#include "profile/profilewidget2.h" +#include "profile-widget/profilewidget2.h" #include "pref.h" #include "helpers.h" #include "ui_socialnetworksdialog.h" diff --git a/profile-widget/CMakeLists.txt b/profile-widget/CMakeLists.txt new file mode 100644 index 000000000..f0a1d8439 --- /dev/null +++ b/profile-widget/CMakeLists.txt @@ -0,0 +1,19 @@ +# the profile widget +set(SUBSURFACE_PROFILE_LIB_SRCS + profilewidget2.cpp + diverectitem.cpp + divepixmapitem.cpp + divelineitem.cpp + divetextitem.cpp + animationfunctions.cpp + divecartesianaxis.cpp + diveprofileitem.cpp + diveeventitem.cpp + divetooltipitem.cpp + ruleritem.cpp + tankitem.cpp +) +source_group("Subsurface Profile" FILES ${SUBSURFACE_PROFILE_LIB_SRCS}) + +add_library(subsurface_profile STATIC ${SUBSURFACE_PROFILE_LIB_SRCS}) +target_link_libraries(subsurface_profile ${QT_LIBRARIES}) \ No newline at end of file diff --git a/desktop-widgets/profile/animationfunctions.cpp b/profile-widget/animationfunctions.cpp similarity index 100% rename from desktop-widgets/profile/animationfunctions.cpp rename to profile-widget/animationfunctions.cpp diff --git a/desktop-widgets/profile/animationfunctions.h b/profile-widget/animationfunctions.h similarity index 100% rename from desktop-widgets/profile/animationfunctions.h rename to profile-widget/animationfunctions.h diff --git a/desktop-widgets/profile/divecartesianaxis.cpp b/profile-widget/divecartesianaxis.cpp similarity index 100% rename from desktop-widgets/profile/divecartesianaxis.cpp rename to profile-widget/divecartesianaxis.cpp diff --git a/desktop-widgets/profile/divecartesianaxis.h b/profile-widget/divecartesianaxis.h similarity index 100% rename from desktop-widgets/profile/divecartesianaxis.h rename to profile-widget/divecartesianaxis.h diff --git a/desktop-widgets/profile/diveeventitem.cpp b/profile-widget/diveeventitem.cpp similarity index 100% rename from desktop-widgets/profile/diveeventitem.cpp rename to profile-widget/diveeventitem.cpp diff --git a/desktop-widgets/profile/diveeventitem.h b/profile-widget/diveeventitem.h similarity index 100% rename from desktop-widgets/profile/diveeventitem.h rename to profile-widget/diveeventitem.h diff --git a/desktop-widgets/profile/divelineitem.cpp b/profile-widget/divelineitem.cpp similarity index 100% rename from desktop-widgets/profile/divelineitem.cpp rename to profile-widget/divelineitem.cpp diff --git a/desktop-widgets/profile/divelineitem.h b/profile-widget/divelineitem.h similarity index 100% rename from desktop-widgets/profile/divelineitem.h rename to profile-widget/divelineitem.h diff --git a/desktop-widgets/profile/divepixmapitem.cpp b/profile-widget/divepixmapitem.cpp similarity index 100% rename from desktop-widgets/profile/divepixmapitem.cpp rename to profile-widget/divepixmapitem.cpp diff --git a/desktop-widgets/profile/divepixmapitem.h b/profile-widget/divepixmapitem.h similarity index 100% rename from desktop-widgets/profile/divepixmapitem.h rename to profile-widget/divepixmapitem.h diff --git a/desktop-widgets/profile/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp similarity index 99% rename from desktop-widgets/profile/diveprofileitem.cpp rename to profile-widget/diveprofileitem.cpp index 2c814678a..7cdccee32 100644 --- a/desktop-widgets/profile/diveprofileitem.cpp +++ b/profile-widget/diveprofileitem.cpp @@ -11,7 +11,7 @@ #include "libdivecomputer/parser.h" #include "mainwindow.h" #include "maintab.h" -#include "profile/profilewidget2.h" +#include "profilewidget2.h" #include "diveplanner.h" #include diff --git a/desktop-widgets/profile/diveprofileitem.h b/profile-widget/diveprofileitem.h similarity index 100% rename from desktop-widgets/profile/diveprofileitem.h rename to profile-widget/diveprofileitem.h diff --git a/desktop-widgets/profile/diverectitem.cpp b/profile-widget/diverectitem.cpp similarity index 100% rename from desktop-widgets/profile/diverectitem.cpp rename to profile-widget/diverectitem.cpp diff --git a/desktop-widgets/profile/diverectitem.h b/profile-widget/diverectitem.h similarity index 100% rename from desktop-widgets/profile/diverectitem.h rename to profile-widget/diverectitem.h diff --git a/desktop-widgets/profile/divetextitem.cpp b/profile-widget/divetextitem.cpp similarity index 100% rename from desktop-widgets/profile/divetextitem.cpp rename to profile-widget/divetextitem.cpp diff --git a/desktop-widgets/profile/divetextitem.h b/profile-widget/divetextitem.h similarity index 100% rename from desktop-widgets/profile/divetextitem.h rename to profile-widget/divetextitem.h diff --git a/desktop-widgets/profile/divetooltipitem.cpp b/profile-widget/divetooltipitem.cpp similarity index 100% rename from desktop-widgets/profile/divetooltipitem.cpp rename to profile-widget/divetooltipitem.cpp diff --git a/desktop-widgets/profile/divetooltipitem.h b/profile-widget/divetooltipitem.h similarity index 100% rename from desktop-widgets/profile/divetooltipitem.h rename to profile-widget/divetooltipitem.h diff --git a/desktop-widgets/profile/profilewidget2.cpp b/profile-widget/profilewidget2.cpp similarity index 100% rename from desktop-widgets/profile/profilewidget2.cpp rename to profile-widget/profilewidget2.cpp diff --git a/desktop-widgets/profile/profilewidget2.h b/profile-widget/profilewidget2.h similarity index 100% rename from desktop-widgets/profile/profilewidget2.h rename to profile-widget/profilewidget2.h diff --git a/desktop-widgets/profile/ruleritem.cpp b/profile-widget/ruleritem.cpp similarity index 100% rename from desktop-widgets/profile/ruleritem.cpp rename to profile-widget/ruleritem.cpp diff --git a/desktop-widgets/profile/ruleritem.h b/profile-widget/ruleritem.h similarity index 100% rename from desktop-widgets/profile/ruleritem.h rename to profile-widget/ruleritem.h diff --git a/desktop-widgets/profile/tankitem.cpp b/profile-widget/tankitem.cpp similarity index 100% rename from desktop-widgets/profile/tankitem.cpp rename to profile-widget/tankitem.cpp diff --git a/desktop-widgets/profile/tankitem.h b/profile-widget/tankitem.h similarity index 100% rename from desktop-widgets/profile/tankitem.h rename to profile-widget/tankitem.h diff --git a/qt-models/CMakeLists.txt b/qt-models/CMakeLists.txt index 463d61412..c9bcf5c3d 100644 --- a/qt-models/CMakeLists.txt +++ b/qt-models/CMakeLists.txt @@ -23,6 +23,7 @@ set(SUBSURFACE_MODELS_LIB_SRCS divesitepicturesmodel.cpp ssrfsortfilterproxymodel.cpp ) + source_group("Subsurface Models" FILES ${SUBSURFACE_MODELS}) add_library(subsurface_models STATIC ${SUBSURFACE_MODELS_LIB_SRCS}) target_link_libraries(subsurface_models ${QT_LIBRARIES}) \ No newline at end of file