mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Merge branch 'cmakeAndPreferences'
This commit is contained in:
commit
8ea7f40457
287 changed files with 3677 additions and 2921 deletions
314
CMakeLists.txt
314
CMakeLists.txt
|
@ -3,6 +3,7 @@
|
|||
project(Subsurface)
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
|
||||
|
||||
# global settings
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
@ -11,8 +12,8 @@ option(LIBGIT2_FROM_PKGCONFIG "use pkg-config to retrieve libgit2" OFF)
|
|||
option(LIBDC_FROM_PKGCONFIG "use pkg-config to retrieve libdivecomputer" OFF)
|
||||
option(LIBGRANTLEE_FROM_PKGCONFIG "use pkg-config to retrieve grantlee" OFF)
|
||||
option(LIBMARBLE_FROM_PKGCONFIG "use pkg-config to retrieve marble" OFF)
|
||||
option(MAKE_TESTS "Make the tests" ON)
|
||||
option(NO_MARBLE "disable the marble widget" OFF)
|
||||
option(NO_TESTS "disable the tests" OFF)
|
||||
option(NO_DOCS "disable the docs" OFF)
|
||||
option(NO_PRINTING "disable the printing support" OFF)
|
||||
option(NO_USERMANUAL "don't include a viewer for the user manual" OFF)
|
||||
|
@ -23,6 +24,12 @@ option(FBSUPPORT "allow posting to Facebook" ON)
|
|||
option(BTSUPPORT "enable support for QtBluetooth (requires Qt5.4 or newer)" ON)
|
||||
option(FTDISUPPORT "enable support for libftdi based serial" OFF)
|
||||
|
||||
add_definitions(-DSUBSURFACE_SOURCE="${CMAKE_SOURCE_DIR}")
|
||||
|
||||
if(BTSUPPORT)
|
||||
add_definitions(-DBT_SUPPORT)
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_MODULE_PATH}
|
||||
${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules
|
||||
|
@ -31,9 +38,11 @@ set(CMAKE_MODULE_PATH
|
|||
include_directories(.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
qt-ui
|
||||
${CMAKE_BINARY_DIR}/desktop-widgets
|
||||
desktop-widgets/
|
||||
qt-models
|
||||
qt-ui/profile
|
||||
desktop-widgets/profile
|
||||
subsurface-core/
|
||||
)
|
||||
|
||||
# get the version string -- this is only used for Mac Bundle at this point
|
||||
|
@ -47,9 +56,19 @@ execute_process(
|
|||
|
||||
message(STATUS "Creating build files for Subsurface ${SSRF_VERSION_STRING}")
|
||||
|
||||
# compiler specific settings
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 ")
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 ")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 ")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
# using Intel C++
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
# using Visual Studio C++
|
||||
endif()
|
||||
|
||||
# pkgconfig for required libraries
|
||||
|
@ -136,7 +155,6 @@ if(FTDISUPPORT)
|
|||
if (NOT LIBFTDI_FOUND)
|
||||
pkg_config_library(LIBFTDI libftdi1 REQUIRED)
|
||||
endif()
|
||||
set(SERIAL_FTDI serial_ftdi.c)
|
||||
add_definitions(-DSERIAL_FTDI)
|
||||
endif()
|
||||
|
||||
|
@ -159,13 +177,6 @@ else()
|
|||
find_package(Grantlee5 REQUIRED)
|
||||
set(GRANTLEE_LIBRARIES Grantlee5::Templates)
|
||||
endif()
|
||||
set(SUBSURFACE_PRINTING_SRCS
|
||||
printer.cpp
|
||||
templatelayout.cpp
|
||||
qt-ui/templateedit.cpp
|
||||
qt-ui/printdialog.cpp
|
||||
qt-ui/printoptions.cpp
|
||||
)
|
||||
set(PRINTING_PKG PrintSupport)
|
||||
set(PRINTING_LIB Qt5::PrintSupport)
|
||||
endif()
|
||||
|
@ -174,7 +185,6 @@ if(NO_USERMANUAL)
|
|||
message(STATUS "building without usermanual")
|
||||
add_definitions(-DNO_USERMANUAL)
|
||||
else()
|
||||
set(USERMANUAL qt-ui/usermanual.cpp)
|
||||
set(WEBKIT_PKG WebKitWidgets)
|
||||
set(WEBKIT_LIB Qt5::WebKitWidgets)
|
||||
endif()
|
||||
|
@ -273,22 +283,18 @@ add_custom_target(
|
|||
)
|
||||
|
||||
# set up the different target platforms
|
||||
set(PLATFORM_SRC unknown_platform.c)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(SUBSURFACE_TARGET subsurface)
|
||||
set(PLATFORM_SRC linux.c)
|
||||
# in some builds we appear to be missing libz for some strange reason...
|
||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lz)
|
||||
endif()
|
||||
if(ANDROID)
|
||||
set(PLATFORM_SRC android.cpp)
|
||||
set(SUBSURFACE_TARGET subsurface)
|
||||
# To allow us to debug log to logcat
|
||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -llog)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(SUBSURFACE_TARGET Subsurface)
|
||||
set(PLATFORM_SRC macos.c)
|
||||
find_library(APP_SERVICES_LIBRARY ApplicationServices)
|
||||
find_library(HID_LIB HidApi)
|
||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${HID_LIB})
|
||||
|
@ -307,201 +313,36 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|||
endif()
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(SUBSURFACE_TARGET subsurface)
|
||||
set(PLATFORM_SRC windows.c)
|
||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32 -lws2_32)
|
||||
remove_definitions(-DUNICODE)
|
||||
add_definitions(-mwindows -D_WIN32)
|
||||
endif()
|
||||
|
||||
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc)
|
||||
|
||||
# include translations
|
||||
add_subdirectory(translations)
|
||||
|
||||
if(BTSUPPORT)
|
||||
add_definitions(-DBT_SUPPORT)
|
||||
set(BT_SRC_FILES qt-ui/btdeviceselectiondialog.cpp)
|
||||
set(BT_CORE_SRC_FILES qtserialbluetooth.cpp)
|
||||
endif()
|
||||
|
||||
# compile the core library, in C.
|
||||
set(SUBSURFACE_CORE_LIB_SRCS
|
||||
cochran.c
|
||||
datatrak.c
|
||||
deco.c
|
||||
device.c
|
||||
dive.c
|
||||
divesite.c
|
||||
divesite.cpp # some new stuff that is not c code but belongs to divesite.
|
||||
divelist.c
|
||||
equipment.c
|
||||
file.c
|
||||
git-access.c
|
||||
libdivecomputer.c
|
||||
liquivision.c
|
||||
load-git.c
|
||||
membuffer.c
|
||||
ostctools.c
|
||||
parse-xml.c
|
||||
planner.c
|
||||
profile.c
|
||||
gaspressures.c
|
||||
worldmap-save.c
|
||||
save-git.c
|
||||
save-xml.c
|
||||
save-html.c
|
||||
sha1.c
|
||||
statistics.c
|
||||
strtod.c
|
||||
subsurfacestartup.c
|
||||
time.c
|
||||
uemis.c
|
||||
uemis-downloader.c
|
||||
version.c
|
||||
# gettextfrommoc should be added because we are using it on the c-code.
|
||||
gettextfromc.cpp
|
||||
# dirk ported some core functionality to c++.
|
||||
qthelper.cpp
|
||||
divecomputer.cpp
|
||||
exif.cpp
|
||||
subsurfacesysinfo.cpp
|
||||
devicedetails.cpp
|
||||
configuredivecomputer.cpp
|
||||
configuredivecomputerthreads.cpp
|
||||
divesitehelpers.cpp
|
||||
taxonomy.c
|
||||
checkcloudconnection.cpp
|
||||
windowtitleupdate.cpp
|
||||
divelogexportlogic.cpp
|
||||
qt-init.cpp
|
||||
${BT_CORE_SRC_FILES}
|
||||
${SERIAL_FTDI}
|
||||
${PLATFORM_SRC}
|
||||
)
|
||||
source_group("Subsurface Core" FILES ${SUBSURFACE_CORE_LIB_SRCS})
|
||||
add_subdirectory(subsurface-core)
|
||||
add_subdirectory(qt-models)
|
||||
add_subdirectory(profile-widget)
|
||||
add_subdirectory(desktop-widgets)
|
||||
|
||||
if(FBSUPPORT)
|
||||
add_definitions(-DFBSUPPORT)
|
||||
set(SOCIALNETWORKS qt-ui/socialnetworks.cpp)
|
||||
endif()
|
||||
|
||||
# the data models that will interface
|
||||
# with the views.
|
||||
set(SUBSURFACE_MODELS_LIB_SRCS
|
||||
qt-models/cleanertablemodel.cpp
|
||||
qt-models/cylindermodel.cpp
|
||||
qt-models/diveplannermodel.cpp
|
||||
qt-models/models.cpp
|
||||
qt-models/filtermodels.cpp
|
||||
qt-models/tankinfomodel.cpp
|
||||
qt-models/weigthsysteminfomodel.cpp
|
||||
qt-models/weightmodel.cpp
|
||||
qt-models/divecomputermodel.cpp
|
||||
qt-models/treemodel.cpp
|
||||
qt-models/tableprintmodel.cpp
|
||||
qt-models/yearlystatisticsmodel.cpp
|
||||
qt-models/divetripmodel.cpp
|
||||
qt-models/divecomputerextradatamodel.cpp
|
||||
qt-models/completionmodels.cpp
|
||||
qt-models/profileprintmodel.cpp
|
||||
qt-models/divepicturemodel.cpp
|
||||
qt-models/diveplotdatamodel.cpp
|
||||
qt-models/divelocationmodel.cpp
|
||||
qt-models/divesitepicturesmodel.cpp
|
||||
qt-models/ssrfsortfilterproxymodel.cpp
|
||||
)
|
||||
source_group("Subsurface Models" FILES ${SUBSURFACE_MODELS})
|
||||
|
||||
# the interface, in C++
|
||||
set(SUBSURFACE_INTERFACE
|
||||
qt-ui/updatemanager.cpp
|
||||
qt-ui/about.cpp
|
||||
qt-ui/divecomputermanagementdialog.cpp
|
||||
qt-ui/divelistview.cpp
|
||||
qt-ui/diveplanner.cpp
|
||||
qt-ui/diveshareexportdialog.cpp
|
||||
qt-ui/downloadfromdivecomputer.cpp
|
||||
qt-ui/globe.cpp
|
||||
qt-ui/graphicsview-common.cpp
|
||||
qt-ui/kmessagewidget.cpp
|
||||
qt-ui/maintab.cpp
|
||||
qt-ui/mainwindow.cpp
|
||||
qt-ui/modeldelegates.cpp
|
||||
qt-ui/metrics.cpp
|
||||
qt-ui/notificationwidget.cpp
|
||||
qt-ui/preferences.cpp
|
||||
qt-ui/simplewidgets.cpp
|
||||
qt-ui/starwidget.cpp
|
||||
qt-ui/subsurfacewebservices.cpp
|
||||
qt-ui/tableview.cpp
|
||||
qt-ui/divelogimportdialog.cpp
|
||||
qt-ui/tagwidget.cpp
|
||||
qt-ui/groupedlineedit.cpp
|
||||
${USERMANUAL}
|
||||
qt-ui/divelogexportdialog.cpp
|
||||
qt-ui/divepicturewidget.cpp
|
||||
qt-ui/usersurvey.cpp
|
||||
qt-ui/configuredivecomputerdialog.cpp
|
||||
qt-ui/undocommands.cpp
|
||||
qt-ui/locationinformation.cpp
|
||||
qt-ui/qtwaitingspinner.cpp
|
||||
${SUBSURFACE_PRINTING_SRCS}
|
||||
${SOCIALNETWORKS}
|
||||
${BT_SRC_FILES}
|
||||
)
|
||||
source_group("Subsurface Interface" FILES ${SUBSURFACE_INTERFACE})
|
||||
|
||||
# the profile widget
|
||||
set(SUBSURFACE_PROFILE_LIB_SRCS
|
||||
qt-ui/profile/profilewidget2.cpp
|
||||
qt-ui/profile/diverectitem.cpp
|
||||
qt-ui/profile/divepixmapitem.cpp
|
||||
qt-ui/profile/divelineitem.cpp
|
||||
qt-ui/profile/divetextitem.cpp
|
||||
qt-ui/profile/animationfunctions.cpp
|
||||
qt-ui/profile/divecartesianaxis.cpp
|
||||
qt-ui/profile/diveprofileitem.cpp
|
||||
qt-ui/profile/diveeventitem.cpp
|
||||
qt-ui/profile/divetooltipitem.cpp
|
||||
qt-ui/profile/ruleritem.cpp
|
||||
qt-ui/profile/tankitem.cpp
|
||||
)
|
||||
source_group("Subsurface Profile" FILES ${SUBSURFACE_PROFILE_LIB_SRCS})
|
||||
|
||||
# the yearly statistics widget.
|
||||
set(SUBSURFACE_STATISTICS_LIB_SRCS
|
||||
qt-ui/statistics/statisticswidget.cpp
|
||||
qt-ui/statistics/yearstatistics.cpp
|
||||
qt-ui/statistics/statisticsbar.cpp
|
||||
qt-ui/statistics/monthstatistics.cpp
|
||||
)
|
||||
source_group("Subsurface Statistics" FILES ${SUBSURFACE_STATISTICS_LIB_SRCS})
|
||||
if(BTSUPPORT)
|
||||
add_definitions(-DBT_SUPPORT)
|
||||
endif()
|
||||
|
||||
# the main app.
|
||||
set(SUBSURFACE_APP
|
||||
main.cpp
|
||||
qt-gui.cpp
|
||||
qthelper.cpp
|
||||
subsurface-desktop-main.cpp
|
||||
subsurface-desktop-helper.cpp
|
||||
)
|
||||
|
||||
source_group("Subsurface App" FILES ${SUBSURFACE_APP})
|
||||
|
||||
# create the libraries
|
||||
file(GLOB SUBSURFACE_UI qt-ui/*.ui)
|
||||
qt5_wrap_ui(SUBSURFACE_UI_HDRS ${SUBSURFACE_UI})
|
||||
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc)
|
||||
source_group("Subsurface Interface Files" FILES ${SUBSURFACE_UI})
|
||||
|
||||
add_library(subsurface_corelib STATIC ${SUBSURFACE_CORE_LIB_SRCS} )
|
||||
target_link_libraries(subsurface_corelib ${QT_LIBRARIES})
|
||||
add_library(subsurface_models STATIC ${SUBSURFACE_MODELS_LIB_SRCS})
|
||||
target_link_libraries(subsurface_models ${QT_LIBRARIES})
|
||||
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})
|
||||
target_link_libraries(subsurface_generated_ui ${QT_LIBRARIES})
|
||||
add_library(subsurface_interface STATIC ${SUBSURFACE_INTERFACE})
|
||||
target_link_libraries(subsurface_interface ${QT_LIBRARIES} ${MARBLE_LIBRARIES})
|
||||
|
||||
# add pthread to the end of the library list on Linux
|
||||
# this is only needed on Ubuntu (why do these idiots break everything?)
|
||||
# but shouldn't hurt on other Linux versions
|
||||
|
@ -511,13 +352,19 @@ endif()
|
|||
|
||||
# create the executables
|
||||
if(SUBSURFACE_MOBILE)
|
||||
set(MOBILE_SRC qt-mobile/qmlmanager.cpp qt-mobile/qmlprofile.cpp qt-models/divelistmodel.cpp)
|
||||
set(MOBILE_SRC
|
||||
qt-mobile/qmlmanager.cpp
|
||||
qt-mobile/qmlprofile.cpp
|
||||
qt-models/divelistmodel.cpp
|
||||
subsurface-android-main.cpp
|
||||
subsurface-android-helper.cpp
|
||||
)
|
||||
add_definitions(-DSUBSURFACE_MOBILE)
|
||||
qt5_add_resources(MOBILE_RESOURCES qt-mobile/mobile-resources.qrc)
|
||||
if(ANDROID)
|
||||
add_library(subsurface-mobile SHARED ${MOBILE_SRC} ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES})
|
||||
add_library(subsurface-mobile SHARED ${MOBILE_SRC} ${SUBSURFACE_PKG} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES})
|
||||
else()
|
||||
add_executable(subsurface-mobile ${MOBILE_SRC} ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES})
|
||||
add_executable(subsurface-mobile ${MOBILE_SRC} ${SUBSURFACE_PKG} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES})
|
||||
endif()
|
||||
target_link_libraries(
|
||||
subsurface-mobile
|
||||
|
@ -528,26 +375,27 @@ if(SUBSURFACE_MOBILE)
|
|||
subsurface_models
|
||||
subsurface_corelib
|
||||
${SUBSURFACE_LINK_LIBRARIES})
|
||||
else()
|
||||
if(ANDROID)
|
||||
# Produce a shared-library instead of a program.
|
||||
# Something that androiddeployqt can work with.
|
||||
add_library(${SUBSURFACE_TARGET} SHARED ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
|
||||
else()
|
||||
add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
|
||||
endif()
|
||||
target_link_libraries(
|
||||
${SUBSURFACE_TARGET}
|
||||
subsurface_generated_ui
|
||||
subsurface_interface
|
||||
subsurface_profile
|
||||
subsurface_statistics
|
||||
subsurface_models
|
||||
subsurface_corelib
|
||||
${SUBSURFACE_LINK_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
# Produce a shared-library instead of a program.
|
||||
# Something that androiddeployqt can work with.
|
||||
# this is the desktop version, running on android.
|
||||
add_library(${SUBSURFACE_TARGET} SHARED ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
|
||||
else()
|
||||
add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
|
||||
endif()
|
||||
target_link_libraries(
|
||||
${SUBSURFACE_TARGET}
|
||||
subsurface_generated_ui
|
||||
subsurface_interface
|
||||
subsurface_profile
|
||||
subsurface_statistics
|
||||
subsurface_models
|
||||
subsurface_corelib
|
||||
${SUBSURFACE_LINK_LIBRARIES}
|
||||
)
|
||||
|
||||
add_dependencies(subsurface_statistics subsurface_generated_ui)
|
||||
add_dependencies(subsurface_profile subsurface_generated_ui)
|
||||
add_dependencies(subsurface_interface subsurface_generated_ui)
|
||||
|
@ -568,32 +416,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|||
endif()
|
||||
|
||||
# build an automated html exporter
|
||||
add_executable(export-html EXCLUDE_FROM_ALL export-html.cpp qt-init.cpp qthelper.cpp ${SUBSURFACE_RESOURCES})
|
||||
add_executable(export-html EXCLUDE_FROM_ALL export-html.cpp ${SUBSURFACE_RESOURCES})
|
||||
target_link_libraries(export-html subsurface_corelib ${SUBSURFACE_LINK_LIBRARIES})
|
||||
|
||||
# QTest based tests
|
||||
macro(TEST NAME FILE)
|
||||
add_executable(${NAME} EXCLUDE_FROM_ALL tests/${FILE} ${SUBSURFACE_RESOURCES})
|
||||
target_link_libraries(${NAME} subsurface_corelib ${QT_TEST_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES})
|
||||
add_test(NAME ${NAME}_build COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${NAME})
|
||||
add_test(NAME ${NAME}_run COMMAND ${NAME})
|
||||
set_tests_properties(${NAME}_run PROPERTIES DEPENDS ${NAME}_build)
|
||||
endmacro()
|
||||
|
||||
add_definitions(-DSUBSURFACE_SOURCE="${CMAKE_SOURCE_DIR}")
|
||||
add_definitions(-g)
|
||||
if(NOT NO_TESTS)
|
||||
enable_testing()
|
||||
TEST(TestUnitConversion testunitconversion.cpp)
|
||||
TEST(TestProfile testprofile.cpp)
|
||||
TEST(TestGpsCoords testgpscoords.cpp)
|
||||
TEST(TestParse testparse.cpp)
|
||||
TEST(TestPlan testplan.cpp)
|
||||
TEST(TestDiveSiteDuplication testdivesiteduplication.cpp)
|
||||
TEST(TestRenumber testrenumber.cpp)
|
||||
TEST(TestGitStorage testgitstorage.cpp)
|
||||
endif()
|
||||
|
||||
# install a few things so that one can run Subsurface from the build
|
||||
# directory
|
||||
if(NOT insource)
|
||||
|
@ -804,7 +629,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|||
install(DIRECTORY marbledata/bitmaps DESTINATION share/subsurface/data)
|
||||
install(FILES subsurface.debug DESTINATION bin)
|
||||
install(FILES subsurface.desktop DESTINATION share/applications)
|
||||
install(FILES subsurface-icon.svg DESTINATION share/icons/hicolor/scalable/apps)
|
||||
install(FILES icons/subsurface-icon.svg DESTINATION share/icons/hicolor/scalable/apps)
|
||||
install(DIRECTORY Documentation/images DESTINATION share/subsurface/Documentation)
|
||||
install(FILES ${DOCFILES} DESTINATION share/subsurface/Documentation)
|
||||
install(DIRECTORY theme DESTINATION share/subsurface)
|
||||
|
@ -822,7 +647,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# get_cmake_property(_variableNames VARIABLES)
|
||||
# foreach (_variableName ${_variableNames})
|
||||
# message(STATUS "${_variableName}=${${_variableName}}")
|
||||
# endforeach()
|
||||
|
||||
if (MAKE_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
|
93
desktop-widgets/CMakeLists.txt
Normal file
93
desktop-widgets/CMakeLists.txt
Normal file
|
@ -0,0 +1,93 @@
|
|||
# create the libraries
|
||||
file(GLOB SUBSURFACE_UI *.ui)
|
||||
qt5_wrap_ui(SUBSURFACE_UI_HDRS ${SUBSURFACE_UI})
|
||||
source_group("Subsurface Interface Files" FILES ${SUBSURFACE_UI})
|
||||
|
||||
if(BTSUPPORT)
|
||||
set(BT_SRC_FILES btdeviceselectiondialog.cpp)
|
||||
endif()
|
||||
|
||||
include_directories(.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
add_subdirectory(preferences)
|
||||
add_subdirectory(plugins)
|
||||
|
||||
# the interface, in C++
|
||||
set(SUBSURFACE_INTERFACE
|
||||
updatemanager.cpp
|
||||
about.cpp
|
||||
divecomputermanagementdialog.cpp
|
||||
divelistview.cpp
|
||||
diveplanner.cpp
|
||||
diveshareexportdialog.cpp
|
||||
downloadfromdivecomputer.cpp
|
||||
globe.cpp
|
||||
kmessagewidget.cpp
|
||||
maintab.cpp
|
||||
mainwindow.cpp
|
||||
modeldelegates.cpp
|
||||
notificationwidget.cpp
|
||||
simplewidgets.cpp
|
||||
starwidget.cpp
|
||||
subsurfacewebservices.cpp
|
||||
tableview.cpp
|
||||
divelogimportdialog.cpp
|
||||
tagwidget.cpp
|
||||
groupedlineedit.cpp
|
||||
divelogexportdialog.cpp
|
||||
divepicturewidget.cpp
|
||||
usersurvey.cpp
|
||||
configuredivecomputerdialog.cpp
|
||||
undocommands.cpp
|
||||
locationinformation.cpp
|
||||
qtwaitingspinner.cpp
|
||||
)
|
||||
|
||||
if(NOT NO_USERMANUAL)
|
||||
set(SUBSURFACE_INTERFACE ${SUBSURFACE_INTERFACE}
|
||||
usermanual.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT NO_PRINTING)
|
||||
set(SUBSURFACE_INTERFACE ${SUBSURFACE_INTERFACE}
|
||||
templateedit.cpp
|
||||
printdialog.cpp
|
||||
printoptions.cpp
|
||||
printer.cpp
|
||||
templatelayout.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if (FBSUPPORT)
|
||||
set(SUBSURFACE_INTERFACE ${SUBSURFACE_INTERFACE}
|
||||
socialnetworks.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if (BTSUPPORT)
|
||||
set(SUBSURFACE_INTERFACE ${SUBSURFACE_INTERFACE}
|
||||
btdeviceselectiondialog.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
source_group("Subsurface Interface" FILES ${SUBSURFACE_INTERFACE})
|
||||
|
||||
# the yearly statistics widget.
|
||||
set(SUBSURFACE_STATISTICS_LIB_SRCS
|
||||
statistics/statisticswidget.cpp
|
||||
statistics/yearstatistics.cpp
|
||||
statistics/statisticsbar.cpp
|
||||
statistics/monthstatistics.cpp
|
||||
)
|
||||
source_group("Subsurface Statistics" FILES ${SUBSURFACE_STATISTICS_LIB_SRCS})
|
||||
|
||||
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})
|
||||
target_link_libraries(subsurface_generated_ui ${QT_LIBRARIES})
|
||||
add_library(subsurface_interface STATIC ${SUBSURFACE_INTERFACE})
|
||||
target_link_libraries(subsurface_interface ${QT_LIBRARIES} ${MARBLE_LIBRARIES} subsurface_desktop_preferences)
|
|
@ -4,7 +4,7 @@
|
|||
#include <QDialog>
|
||||
#include <QStringListModel>
|
||||
#include "ui_configuredivecomputerdialog.h"
|
||||
#include "../libdivecomputer.h"
|
||||
#include "subsurface-core/libdivecomputer.h"
|
||||
#include "configuredivecomputer.h"
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QNetworkAccessManager>
|
|
@ -9,8 +9,8 @@
|
|||
#include <QAbstractTableModel>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include "../dive.h"
|
||||
#include "../divelist.h"
|
||||
#include "subsurface-core/dive.h"
|
||||
#include "subsurface-core/divelist.h"
|
||||
|
||||
namespace Ui {
|
||||
class DiveLogImportDialog;
|
|
@ -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 <QGraphicsSceneMouseEvent>
|
||||
|
@ -104,7 +104,7 @@ void DiveHandler::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.dateEdit->setDisplayFormat(getDateFormat());
|
||||
ui.dateEdit->setDisplayFormat(prefs.date_format);
|
||||
ui.tableWidget->setTitle(tr("Dive planner points"));
|
||||
ui.tableWidget->setModel(plannerModel);
|
||||
plannerModel->setRecalc(true);
|
||||
|
@ -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)));
|
|
@ -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"
|
||||
|
@ -43,7 +43,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
|||
currentTrip(0)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.dateEdit->setDisplayFormat(getDateFormat());
|
||||
ui.dateEdit->setDisplayFormat(prefs.date_format);
|
||||
|
||||
memset(&displayed_dive, 0, sizeof(displayed_dive));
|
||||
memset(&displayedTrip, 0, sizeof(displayedTrip));
|
|
@ -525,8 +525,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>70</width>
|
||||
<height>16</height>
|
||||
<width>445</width>
|
||||
<height>754</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="equipmentTabScrollAreaLayout">
|
||||
|
@ -1229,7 +1229,7 @@
|
|||
<customwidget>
|
||||
<class>TagWidget</class>
|
||||
<extends>QPlainTextEdit</extends>
|
||||
<header>qt-ui/tagwidget.h</header>
|
||||
<header>tagwidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>DivePictureWidget</class>
|
|
@ -11,17 +11,17 @@
|
|||
#include <QSettings>
|
||||
#include <QShortcut>
|
||||
#include <QToolBar>
|
||||
|
||||
#include "version.h"
|
||||
#include "divelistview.h"
|
||||
#include "downloadfromdivecomputer.h"
|
||||
#include "preferences.h"
|
||||
#include "subsurfacewebservices.h"
|
||||
#include "divecomputermanagementdialog.h"
|
||||
#include "about.h"
|
||||
#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"
|
||||
|
@ -40,6 +40,7 @@
|
|||
#include "divesitehelpers.h"
|
||||
#include "windowtitleupdate.h"
|
||||
#include "locationinformation.h"
|
||||
#include "preferences/preferencesdialog.h"
|
||||
|
||||
#ifndef NO_USERMANUAL
|
||||
#include "usermanual.h"
|
||||
|
@ -50,6 +51,9 @@
|
|||
#include <QUndoStack>
|
||||
#include <qthelper.h>
|
||||
#include <QtConcurrentRun>
|
||||
#include "subsurface-core/color.h"
|
||||
#include "subsurface-core/isocialnetworkintegration.h"
|
||||
#include "subsurface-core/pluginmanager.h"
|
||||
|
||||
#if defined(FBSUPPORT)
|
||||
#include "socialnetworks.h"
|
||||
|
@ -250,6 +254,26 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
ui.actionFacebook->setEnabled(false);
|
||||
#endif
|
||||
|
||||
if(PluginManager::instance().socialNetworkIntegrationPlugins().count()) {
|
||||
QMenu *connections = new QMenu(tr("Connect to"));
|
||||
for(ISocialNetworkIntegration *plugin : PluginManager::instance().socialNetworkIntegrationPlugins()){
|
||||
QAction *toggle_connection = new QAction(this);
|
||||
toggle_connection->setText(plugin->socialNetworkName());
|
||||
toggle_connection->setIcon(QIcon(plugin->socialNetworkIcon()));
|
||||
toggle_connection->setData(QVariant::fromValue(plugin));
|
||||
|
||||
QAction *share_on = new QAction(this);
|
||||
share_on->setText(plugin->socialNetworkName());
|
||||
share_on->setIcon(QIcon(plugin->socialNetworkIcon()));
|
||||
share_on->setData(QVariant::fromValue(plugin));
|
||||
ui.menuShare_on->addAction(share_on);
|
||||
connections->addAction(toggle_connection);
|
||||
}
|
||||
ui.menuShare_on->addSeparator();
|
||||
ui.menuShare_on->addMenu(connections);
|
||||
} else {
|
||||
ui.menubar->removeAction(ui.menuShare_on->menuAction());
|
||||
}
|
||||
|
||||
ui.menubar->show();
|
||||
set_git_update_cb(&updateProgress);
|
||||
|
@ -1164,7 +1188,7 @@ void MainWindow::initialUiSetup()
|
|||
show();
|
||||
}
|
||||
|
||||
const char *getSetting(QSettings &s, QString name)
|
||||
const char *getSetting(const QSettings &s,const QString& name)
|
||||
{
|
||||
QVariant v;
|
||||
v = s.value(name);
|
||||
|
@ -1758,6 +1782,7 @@ void MainWindow::editCurrentDive()
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Remove the dependency to the PreferencesDialog here.
|
||||
#define PREF_PROFILE(QT_PREFS) \
|
||||
QSettings s; \
|
||||
s.beginGroup("TecDetails"); \
|
||||
|
@ -1897,8 +1922,7 @@ void MainWindow::setApplicationState(const QByteArray& state) {
|
|||
|
||||
void MainWindow::showProgressBar()
|
||||
{
|
||||
if (progressDialog)
|
||||
delete progressDialog;
|
||||
delete progressDialog;
|
||||
|
||||
progressDialog = new QProgressDialog(tr("Contacting cloud service..."), tr("Cancel"), 0, 100, this);
|
||||
progressDialog->setWindowModality(Qt::WindowModal);
|
|
@ -142,7 +142,6 @@
|
|||
<string>Share on</string>
|
||||
</property>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFacebook"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menu_Edit"/>
|
|
@ -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"
|
1
desktop-widgets/plugins/CMakeLists.txt
Normal file
1
desktop-widgets/plugins/CMakeLists.txt
Normal file
|
@ -0,0 +1 @@
|
|||
add_subdirectory(facebook)
|
6
desktop-widgets/plugins/facebook/CMakeLists.txt
Normal file
6
desktop-widgets/plugins/facebook/CMakeLists.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
set(FACEBOOK_PLUGIN_SRCS facebook_integration.cpp)
|
||||
|
||||
add_library(facebook_integration SHARED ${FACEBOOK_PLUGIN_SRCS})
|
||||
|
||||
target_link_libraries(facebook_integration subsurface_corelib ${QT_LIBRARIES})
|
||||
add_dependencies(facebook_integration subsurface_corelib)
|
36
desktop-widgets/plugins/facebook/facebook_integration.cpp
Normal file
36
desktop-widgets/plugins/facebook/facebook_integration.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include "facebook_integration.h"
|
||||
|
||||
FacebookPlugin::FacebookPlugin(QObject* parent): QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool FacebookPlugin::isConnected()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FacebookPlugin::requestLogin()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FacebookPlugin::requestLogoff()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString FacebookPlugin::socialNetworkIcon() const
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString FacebookPlugin::socialNetworkName() const
|
||||
{
|
||||
return tr("Facebook");
|
||||
}
|
||||
|
||||
void FacebookPlugin::uploadCurrentDive()
|
||||
{
|
||||
|
||||
}
|
21
desktop-widgets/plugins/facebook/facebook_integration.h
Normal file
21
desktop-widgets/plugins/facebook/facebook_integration.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef FACEBOOK_INTEGRATION_H
|
||||
#define FACEBOOK_INTEGRATION_H
|
||||
|
||||
#include "subsurface-core/isocialnetworkintegration.h"
|
||||
#include <QString>
|
||||
|
||||
class FacebookPlugin : public QObject, public ISocialNetworkIntegration {
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.subsurface.plugins.ISocialNetworkIntegration")
|
||||
Q_INTERFACES(ISocialNetworkIntegration)
|
||||
public:
|
||||
explicit FacebookPlugin(QObject* parent = 0);
|
||||
virtual bool isConnected();
|
||||
virtual void requestLogin();
|
||||
virtual void requestLogoff();
|
||||
virtual QString socialNetworkIcon() const;
|
||||
virtual QString socialNetworkName() const;
|
||||
virtual void uploadCurrentDive();
|
||||
};
|
||||
|
||||
#endif
|
173
desktop-widgets/preferences.cpp
Normal file
173
desktop-widgets/preferences.cpp
Normal file
|
@ -0,0 +1,173 @@
|
|||
#include "preferences.h"
|
||||
#include "mainwindow.h"
|
||||
#include "models.h"
|
||||
#include "divelocationmodel.h"
|
||||
#include "prefs-macros.h"
|
||||
#include "qthelper.h"
|
||||
#include "subsurfacestartup.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QShortcut>
|
||||
#include <QNetworkProxy>
|
||||
#include <QNetworkCookieJar>
|
||||
|
||||
#include "subsurfacewebservices.h"
|
||||
|
||||
#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
|
||||
#include "socialnetworks.h"
|
||||
#include <QWebView>
|
||||
#endif
|
||||
|
||||
PreferencesDialog *PreferencesDialog::instance()
|
||||
{
|
||||
static PreferencesDialog *dialog = new PreferencesDialog(MainWindow::instance());
|
||||
return dialog;
|
||||
}
|
||||
|
||||
PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
setAttribute(Qt::WA_QuitOnClose, false);
|
||||
|
||||
#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
|
||||
FacebookManager *fb = FacebookManager::instance();
|
||||
facebookWebView = new QWebView(this);
|
||||
ui.fbWebviewContainer->layout()->addWidget(facebookWebView);
|
||||
if (fb->loggedIn()) {
|
||||
facebookLoggedIn();
|
||||
} else {
|
||||
facebookDisconnect();
|
||||
}
|
||||
connect(facebookWebView, &QWebView::urlChanged, fb, &FacebookManager::tryLogin);
|
||||
connect(fb, &FacebookManager::justLoggedIn, this, &PreferencesDialog::facebookLoggedIn);
|
||||
connect(ui.fbDisconnect, &QPushButton::clicked, fb, &FacebookManager::logout);
|
||||
connect(fb, &FacebookManager::justLoggedOut, this, &PreferencesDialog::facebookDisconnect);
|
||||
#endif
|
||||
|
||||
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
|
||||
|
||||
// connect(ui.defaultSetpoint, SIGNAL(valueChanged(double)), this, SLOT(defaultSetpointChanged(double)));
|
||||
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()));
|
||||
loadSettings();
|
||||
setUiFromPrefs();
|
||||
rememberPrefs();
|
||||
}
|
||||
|
||||
void PreferencesDialog::facebookLoggedIn()
|
||||
{
|
||||
#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
|
||||
ui.fbDisconnect->show();
|
||||
ui.fbWebviewContainer->hide();
|
||||
ui.fbWebviewContainer->setEnabled(false);
|
||||
ui.FBLabel->setText(tr("To disconnect Subsurface from your Facebook account, use the button below"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void PreferencesDialog::facebookDisconnect()
|
||||
{
|
||||
#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
|
||||
// remove the connect/disconnect button
|
||||
// and instead add the login view
|
||||
ui.fbDisconnect->hide();
|
||||
ui.fbWebviewContainer->show();
|
||||
ui.fbWebviewContainer->setEnabled(true);
|
||||
ui.FBLabel->setText(tr("To connect to Facebook, please log in. This enables Subsurface to publish dives to your timeline"));
|
||||
if (facebookWebView) {
|
||||
facebookWebView->page()->networkAccessManager()->setCookieJar(new QNetworkCookieJar());
|
||||
facebookWebView->setUrl(FacebookManager::instance()->connectUrl());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void PreferencesDialog::showEvent(QShowEvent *event)
|
||||
{
|
||||
setUiFromPrefs();
|
||||
rememberPrefs();
|
||||
QDialog::showEvent(event);
|
||||
}
|
||||
|
||||
void PreferencesDialog::setUiFromPrefs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PreferencesDialog::restorePrefs()
|
||||
{
|
||||
prefs = oldPrefs;
|
||||
setUiFromPrefs();
|
||||
}
|
||||
|
||||
void PreferencesDialog::rememberPrefs()
|
||||
{
|
||||
oldPrefs = prefs;
|
||||
}
|
||||
|
||||
void PreferencesDialog::syncSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void PreferencesDialog::loadSettings()
|
||||
{
|
||||
// This code was on the mainwindow, it should belong nowhere, but since we didn't
|
||||
// correctly fixed this code yet ( too much stuff on the code calling preferences )
|
||||
// force this here.
|
||||
loadPreferences();
|
||||
QSettings s;
|
||||
QVariant v;
|
||||
}
|
||||
|
||||
void PreferencesDialog::buttonClicked(QAbstractButton *button)
|
||||
{
|
||||
switch (ui.buttonBox->standardButton(button)) {
|
||||
case QDialogButtonBox::Discard:
|
||||
restorePrefs();
|
||||
syncSettings();
|
||||
close();
|
||||
break;
|
||||
case QDialogButtonBox::Apply:
|
||||
syncSettings();
|
||||
break;
|
||||
case QDialogButtonBox::FirstButton:
|
||||
syncSettings();
|
||||
close();
|
||||
break;
|
||||
default:
|
||||
break; // ignore warnings.
|
||||
}
|
||||
}
|
||||
#undef SB
|
||||
|
||||
#if 0
|
||||
// TODO: Copy this later.
|
||||
void PreferencesDialog::on_resetSettings_clicked()
|
||||
{
|
||||
QSettings s;
|
||||
QMessageBox response(this);
|
||||
response.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
||||
response.setDefaultButton(QMessageBox::Cancel);
|
||||
response.setWindowTitle(tr("Warning"));
|
||||
response.setText(tr("If you click OK, all settings of Subsurface will be reset to their default values. This will be applied immediately."));
|
||||
response.setWindowModality(Qt::WindowModal);
|
||||
|
||||
int result = response.exec();
|
||||
if (result == QMessageBox::Ok) {
|
||||
copy_prefs(&default_prefs, &prefs);
|
||||
setUiFromPrefs();
|
||||
Q_FOREACH (QString key, s.allKeys()) {
|
||||
s.remove(key);
|
||||
}
|
||||
syncSettings();
|
||||
close();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void PreferencesDialog::emitSettingsChanged()
|
||||
{
|
||||
emit settingsChanged();
|
||||
}
|
241
desktop-widgets/preferences.ui
Normal file
241
desktop-widgets/preferences.ui
Normal file
|
@ -0,0 +1,241 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PreferencesDialog</class>
|
||||
<widget class="QDialog" name="PreferencesDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>835</width>
|
||||
<height>698</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Preferences</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normalon>:/subsurface-icon</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="mainHorizontalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="textElideMode">
|
||||
<enum>Qt::ElideNone</enum>
|
||||
</property>
|
||||
<property name="movement">
|
||||
<enum>QListView::Static</enum>
|
||||
</property>
|
||||
<property name="isWrapping" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="layoutMode">
|
||||
<enum>QListView::Batched</enum>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="gridSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::ListMode</enum>
|
||||
</property>
|
||||
<property name="uniformItemSizes">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="currentRow">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Facebook</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/facebook</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="facebook_page">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="fbLayout" stretch="0">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="FBLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connect to facebook text placeholder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="fbWebviewContainer" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="fbDisconnect">
|
||||
<property name="text">
|
||||
<string>Disconnect</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Discard|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>PreferencesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>264</x>
|
||||
<y>720</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>PreferencesDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>332</x>
|
||||
<y>720</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>listWidget</sender>
|
||||
<signal>currentRowChanged(int)</signal>
|
||||
<receiver>stackedWidget</receiver>
|
||||
<slot>setCurrentIndex(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>37</x>
|
||||
<y>97</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>282</x>
|
||||
<y>18</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
27
desktop-widgets/preferences/CMakeLists.txt
Normal file
27
desktop-widgets/preferences/CMakeLists.txt
Normal file
|
@ -0,0 +1,27 @@
|
|||
# the profile widget
|
||||
include_directories(.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
file(GLOB SUBSURFACE_PREFERENCES_UI *.ui)
|
||||
qt5_wrap_ui(SUBSURFACE_PREFERENCES_UI_HDRS ${SUBSURFACE_PREFERENCES_UI})
|
||||
|
||||
source_group("Subsurface Interface Files" FILES ${SUBSURFACE_PREFERENCES_UI})
|
||||
|
||||
set(SUBSURFACE_PREFERENCES_LIB_SRCS
|
||||
abstractpreferenceswidget.cpp
|
||||
preferencesdialog.cpp
|
||||
preferences_language.cpp
|
||||
preferences_georeference.cpp
|
||||
preferences_defaults.cpp
|
||||
preferences_units.cpp
|
||||
preferences_graph.cpp
|
||||
preferences_network.cpp
|
||||
)
|
||||
|
||||
source_group("Subsurface Preferences" FILES ${SUBSURFACE_PREFERENCES_LIB_SRCS})
|
||||
|
||||
add_library(subsurface_desktop_preferences STATIC ${SUBSURFACE_PREFERENCES_LIB_SRCS} ${SUBSURFACE_PREFERENCES_UI_HDRS})
|
||||
target_link_libraries(subsurface_desktop_preferences ${QT_LIBRARIES})
|
||||
|
21
desktop-widgets/preferences/abstractpreferenceswidget.cpp
Normal file
21
desktop-widgets/preferences/abstractpreferenceswidget.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include "abstractpreferenceswidget.h"
|
||||
|
||||
AbstractPreferencesWidget::AbstractPreferencesWidget(const QString& name, const QIcon& icon, float positionHeight)
|
||||
: QWidget(), _name(name), _icon(icon), _positionHeight(positionHeight)
|
||||
{
|
||||
}
|
||||
|
||||
QIcon AbstractPreferencesWidget::icon() const
|
||||
{
|
||||
return _icon;
|
||||
}
|
||||
|
||||
QString AbstractPreferencesWidget::name() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
float AbstractPreferencesWidget::positionHeight() const
|
||||
{
|
||||
return _positionHeight;
|
||||
}
|
27
desktop-widgets/preferences/abstractpreferenceswidget.h
Normal file
27
desktop-widgets/preferences/abstractpreferenceswidget.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef ABSTRACTPREFERENCESWIDGET_H
|
||||
#define ABSTRACTPREFERENCESWIDGET_H
|
||||
|
||||
#include <QIcon>
|
||||
#include <QWidget>
|
||||
|
||||
class AbstractPreferencesWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AbstractPreferencesWidget(const QString& name, const QIcon& icon, float positionHeight);
|
||||
QIcon icon() const;
|
||||
QString name() const;
|
||||
float positionHeight() const;
|
||||
|
||||
/* gets the values from the preferences and should set the correct values in
|
||||
* the interface */
|
||||
virtual void refreshSettings() = 0;
|
||||
|
||||
/* gets the values from the interface and set in the preferences object. */
|
||||
virtual void syncSettings() = 0;
|
||||
|
||||
private:
|
||||
QIcon _icon;
|
||||
QString _name;
|
||||
float _positionHeight;
|
||||
};
|
||||
#endif
|
103
desktop-widgets/preferences/preferences_defaults.cpp
Normal file
103
desktop-widgets/preferences/preferences_defaults.cpp
Normal file
|
@ -0,0 +1,103 @@
|
|||
#include "preferences_defaults.h"
|
||||
#include "ui_preferences_defaults.h"
|
||||
#include "dive.h"
|
||||
#include "subsurface-core/prefs-macros.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
|
||||
PreferencesDefaults::PreferencesDefaults(): AbstractPreferencesWidget(tr("Defaults"), QIcon(":defaults"), 0 ), ui(new Ui::PreferencesDefaults())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
PreferencesDefaults::~PreferencesDefaults()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PreferencesDefaults::on_chooseFile_clicked()
|
||||
{
|
||||
QFileInfo fi(system_default_filename());
|
||||
QString choosenFileName = QFileDialog::getOpenFileName(this, tr("Open default log file"), fi.absolutePath(), tr("Subsurface XML files (*.ssrf *.xml *.XML)"));
|
||||
|
||||
if (!choosenFileName.isEmpty())
|
||||
ui->defaultfilename->setText(choosenFileName);
|
||||
}
|
||||
|
||||
void PreferencesDefaults::on_btnUseDefaultFile_toggled(bool toggle)
|
||||
{
|
||||
if (toggle) {
|
||||
ui->defaultfilename->setText(system_default_filename());
|
||||
ui->defaultfilename->setEnabled(false);
|
||||
} else {
|
||||
ui->defaultfilename->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDefaults::on_localDefaultFile_toggled(bool toggle)
|
||||
{
|
||||
ui->defaultfilename->setEnabled(toggle);
|
||||
ui->btnUseDefaultFile->setEnabled(toggle);
|
||||
ui->chooseFile->setEnabled(toggle);
|
||||
}
|
||||
|
||||
void PreferencesDefaults::refreshSettings()
|
||||
{
|
||||
ui->font->setCurrentFont(QString(prefs.divelist_font));
|
||||
ui->fontsize->setValue(prefs.font_size);
|
||||
ui->defaultfilename->setText(prefs.default_filename);
|
||||
ui->noDefaultFile->setChecked(prefs.default_file_behavior == NO_DEFAULT_FILE);
|
||||
ui->cloudDefaultFile->setChecked(prefs.default_file_behavior == CLOUD_DEFAULT_FILE);
|
||||
ui->localDefaultFile->setChecked(prefs.default_file_behavior == LOCAL_DEFAULT_FILE);
|
||||
|
||||
ui->default_cylinder->clear();
|
||||
for (int i = 0; tank_info[i].name != NULL; i++) {
|
||||
ui->default_cylinder->addItem(tank_info[i].name);
|
||||
if (prefs.default_cylinder && strcmp(tank_info[i].name, prefs.default_cylinder) == 0)
|
||||
ui->default_cylinder->setCurrentIndex(i);
|
||||
}
|
||||
ui->displayinvalid->setChecked(prefs.display_invalid_dives);
|
||||
ui->velocitySlider->setValue(prefs.animation_speed);
|
||||
ui->btnUseDefaultFile->setChecked(prefs.use_default_file);
|
||||
|
||||
if (prefs.cloud_verification_status == CS_VERIFIED) {
|
||||
ui->cloudDefaultFile->setEnabled(true);
|
||||
} else {
|
||||
if (ui->cloudDefaultFile->isChecked())
|
||||
ui->noDefaultFile->setChecked(true);
|
||||
ui->cloudDefaultFile->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->defaultfilename->setEnabled(prefs.default_file_behavior == LOCAL_DEFAULT_FILE);
|
||||
ui->btnUseDefaultFile->setEnabled(prefs.default_file_behavior == LOCAL_DEFAULT_FILE);
|
||||
ui->chooseFile->setEnabled(prefs.default_file_behavior == LOCAL_DEFAULT_FILE);
|
||||
}
|
||||
|
||||
void PreferencesDefaults::syncSettings()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("GeneralSettings");
|
||||
s.setValue("default_filename", ui->defaultfilename->text());
|
||||
s.setValue("default_cylinder", ui->default_cylinder->currentText());
|
||||
s.setValue("use_default_file", ui->btnUseDefaultFile->isChecked());
|
||||
if (ui->noDefaultFile->isChecked())
|
||||
s.setValue("default_file_behavior", NO_DEFAULT_FILE);
|
||||
else if (ui->localDefaultFile->isChecked())
|
||||
s.setValue("default_file_behavior", LOCAL_DEFAULT_FILE);
|
||||
else if (ui->cloudDefaultFile->isChecked())
|
||||
s.setValue("default_file_behavior", CLOUD_DEFAULT_FILE);
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("Display");
|
||||
SAVE_OR_REMOVE_SPECIAL("divelist_font", system_divelist_default_font, ui->font->currentFont().toString(), ui->font->currentFont());
|
||||
SAVE_OR_REMOVE("font_size", system_divelist_default_font_size, ui->fontsize->value());
|
||||
s.setValue("displayinvalid", ui->displayinvalid->isChecked());
|
||||
s.endGroup();
|
||||
s.sync();
|
||||
|
||||
// Animation
|
||||
s.beginGroup("Animations");
|
||||
s.setValue("animation_speed", ui->velocitySlider->value());
|
||||
s.endGroup();
|
||||
}
|
28
desktop-widgets/preferences/preferences_defaults.h
Normal file
28
desktop-widgets/preferences/preferences_defaults.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#ifndef PREFERENCES_DEFAULTS_H
|
||||
#define PREFERENCES_DEFAULTS_H
|
||||
|
||||
#include "abstractpreferenceswidget.h"
|
||||
#include "subsurface-core/pref.h"
|
||||
|
||||
namespace Ui {
|
||||
class PreferencesDefaults;
|
||||
}
|
||||
|
||||
class PreferencesDefaults : public AbstractPreferencesWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreferencesDefaults();
|
||||
virtual ~PreferencesDefaults();
|
||||
virtual void refreshSettings();
|
||||
virtual void syncSettings();
|
||||
public slots:
|
||||
void on_chooseFile_clicked();
|
||||
void on_btnUseDefaultFile_toggled(bool toggled);
|
||||
void on_localDefaultFile_toggled(bool toggled);
|
||||
|
||||
private:
|
||||
Ui::PreferencesDefaults *ui;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
251
desktop-widgets/preferences/preferences_defaults.ui
Normal file
251
desktop-widgets/preferences/preferences_defaults.ui
Normal file
|
@ -0,0 +1,251 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PreferencesDefaults</class>
|
||||
<widget class="QWidget" name="PreferencesDefaults">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>555</width>
|
||||
<height>558</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Lists and tables</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Font</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFontComboBox" name="font"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Font size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="fontsize"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Dives</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="defaultDiveLogFileLabel">
|
||||
<property name="text">
|
||||
<string>Default dive log file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="defaultFileBehaviorLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="noDefaultFile">
|
||||
<property name="text">
|
||||
<string>No default file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="localDefaultFile">
|
||||
<property name="text">
|
||||
<string>&Local default file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="cloudDefaultFile">
|
||||
<property name="text">
|
||||
<string>Clo&ud storage default file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Local dive log file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3b">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="defaultfilename"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnUseDefaultFile">
|
||||
<property name="text">
|
||||
<string>Use default</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="chooseFile">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Display invalid</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="displayinvalid">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="title">
|
||||
<string>Default cylinder</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_6">
|
||||
<property name="horizontalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Use default cylinder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QComboBox" name="default_cylinder"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="title">
|
||||
<string>Animations</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Speed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="velocitySlider">
|
||||
<property name="maximum">
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="velocitySpinBox">
|
||||
<property name="maximum">
|
||||
<number>500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_9">
|
||||
<property name="title">
|
||||
<string>Clear all settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7b">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetSettings">
|
||||
<property name="text">
|
||||
<string>Reset all settings to their default value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>195</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
45
desktop-widgets/preferences/preferences_georeference.cpp
Normal file
45
desktop-widgets/preferences/preferences_georeference.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include "preferences_georeference.h"
|
||||
#include "ui_prefs_georeference.h"
|
||||
#include "prefs-macros.h"
|
||||
#include "qthelper.h"
|
||||
#include "qt-models/divelocationmodel.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <QSettings>
|
||||
|
||||
PreferencesGeoreference::PreferencesGeoreference() : AbstractPreferencesWidget(tr("Georeference"), QIcon(":/georeference"), 9)
|
||||
{
|
||||
ui = new Ui::PreferencesGeoreference();
|
||||
ui->setupUi(this);
|
||||
ui->first_item->setModel(GeoReferencingOptionsModel::instance());
|
||||
ui->second_item->setModel(GeoReferencingOptionsModel::instance());
|
||||
ui->third_item->setModel(GeoReferencingOptionsModel::instance());
|
||||
}
|
||||
|
||||
PreferencesGeoreference::~PreferencesGeoreference()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PreferencesGeoreference::refreshSettings()
|
||||
{
|
||||
ui->enable_geocoding->setChecked(prefs.geocoding.enable_geocoding);
|
||||
ui->parse_without_gps->setChecked(prefs.geocoding.parse_dive_without_gps);
|
||||
ui->tag_existing_dives->setChecked(prefs.geocoding.tag_existing_dives);
|
||||
ui->first_item->setCurrentIndex(prefs.geocoding.category[0]);
|
||||
ui->second_item->setCurrentIndex(prefs.geocoding.category[1]);
|
||||
ui->third_item->setCurrentIndex(prefs.geocoding.category[2]);
|
||||
}
|
||||
|
||||
void PreferencesGeoreference::syncSettings()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("geocoding");
|
||||
s.setValue("enable_geocoding", ui->enable_geocoding->isChecked());
|
||||
s.setValue("parse_dives_without_gps", ui->parse_without_gps->isChecked());
|
||||
s.setValue("tag_existing_dives", ui->tag_existing_dives->isChecked());
|
||||
s.setValue("cat0", ui->first_item->currentIndex());
|
||||
s.setValue("cat1", ui->second_item->currentIndex());
|
||||
s.setValue("cat2", ui->third_item->currentIndex());
|
||||
s.endGroup();
|
||||
}
|
21
desktop-widgets/preferences/preferences_georeference.h
Normal file
21
desktop-widgets/preferences/preferences_georeference.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef PREFERENCES_GEOREFERENCE_H
|
||||
#define PREFERENCES_GEOREFERENCE_H
|
||||
|
||||
#include "abstractpreferenceswidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class PreferencesGeoreference;
|
||||
}
|
||||
|
||||
class PreferencesGeoreference : public AbstractPreferencesWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreferencesGeoreference();
|
||||
virtual ~PreferencesGeoreference();
|
||||
virtual void refreshSettings();
|
||||
virtual void syncSettings();
|
||||
private:
|
||||
Ui::PreferencesGeoreference *ui;
|
||||
};
|
||||
|
||||
#endif
|
77
desktop-widgets/preferences/preferences_graph.cpp
Normal file
77
desktop-widgets/preferences/preferences_graph.cpp
Normal file
|
@ -0,0 +1,77 @@
|
|||
#include "preferences_graph.h"
|
||||
#include "ui_preferences_graph.h"
|
||||
#include "subsurface-core/prefs-macros.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "qt-models/models.h"
|
||||
|
||||
PreferencesGraph::PreferencesGraph() : AbstractPreferencesWidget(tr("Graph"), QIcon(":graph"), 5)
|
||||
{
|
||||
ui = new Ui::PreferencesGraph();
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
PreferencesGraph::~PreferencesGraph()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PreferencesGraph::refreshSettings()
|
||||
{
|
||||
ui->pheThreshold->setValue(prefs.pp_graphs.phe_threshold);
|
||||
ui->po2Threshold->setValue(prefs.pp_graphs.po2_threshold);
|
||||
ui->pn2Threshold->setValue(prefs.pp_graphs.pn2_threshold);
|
||||
ui->maxpo2->setValue(prefs.modpO2);
|
||||
ui->red_ceiling->setChecked(prefs.redceiling);
|
||||
|
||||
ui->gflow->setValue(prefs.gflow);
|
||||
ui->gfhigh->setValue(prefs.gfhigh);
|
||||
ui->gf_low_at_maxdepth->setChecked(prefs.gf_low_at_maxdepth);
|
||||
ui->show_ccr_setpoint->setChecked(prefs.show_ccr_setpoint);
|
||||
ui->show_ccr_sensors->setChecked(prefs.show_ccr_sensors);
|
||||
ui->defaultSetpoint->setValue((double)prefs.defaultsetpoint / 1000.0);
|
||||
ui->psro2rate->setValue(prefs.o2consumption / 1000.0);
|
||||
ui->pscrfactor->setValue(rint(1000.0 / prefs.pscr_ratio));
|
||||
|
||||
ui->display_unused_tanks->setChecked(prefs.display_unused_tanks);
|
||||
ui->show_average_depth->setChecked(prefs.show_average_depth);
|
||||
}
|
||||
|
||||
void PreferencesGraph::syncSettings()
|
||||
{
|
||||
QSettings s;
|
||||
|
||||
s.beginGroup("GeneralSettings");
|
||||
s.setValue("defaultsetpoint", rint(ui->defaultSetpoint->value() * 1000.0));
|
||||
s.setValue("o2consumption", rint(ui->psro2rate->value() *1000.0));
|
||||
s.setValue("pscr_ratio", rint(1000.0 / ui->pscrfactor->value()));
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("TecDetails");
|
||||
SAVE_OR_REMOVE("phethreshold", default_prefs.pp_graphs.phe_threshold, ui->pheThreshold->value());
|
||||
SAVE_OR_REMOVE("po2threshold", default_prefs.pp_graphs.po2_threshold, ui->po2Threshold->value());
|
||||
SAVE_OR_REMOVE("pn2threshold", default_prefs.pp_graphs.pn2_threshold, ui->pn2Threshold->value());
|
||||
SAVE_OR_REMOVE("modpO2", default_prefs.modpO2, ui->maxpo2->value());
|
||||
SAVE_OR_REMOVE("redceiling", default_prefs.redceiling, ui->red_ceiling->isChecked());
|
||||
SAVE_OR_REMOVE("gflow", default_prefs.gflow, ui->gflow->value());
|
||||
SAVE_OR_REMOVE("gfhigh", default_prefs.gfhigh, ui->gfhigh->value());
|
||||
SAVE_OR_REMOVE("gf_low_at_maxdepth", default_prefs.gf_low_at_maxdepth, ui->gf_low_at_maxdepth->isChecked());
|
||||
SAVE_OR_REMOVE("show_ccr_setpoint", default_prefs.show_ccr_setpoint, ui->show_ccr_setpoint->isChecked());
|
||||
SAVE_OR_REMOVE("show_ccr_sensors", default_prefs.show_ccr_sensors, ui->show_ccr_sensors->isChecked());
|
||||
SAVE_OR_REMOVE("display_unused_tanks", default_prefs.display_unused_tanks, ui->display_unused_tanks->isChecked());
|
||||
SAVE_OR_REMOVE("show_average_depth", default_prefs.show_average_depth, ui->show_average_depth->isChecked());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
#define DANGER_GF (gf > 100) ? "* { color: red; }" : ""
|
||||
void PreferencesGraph::on_gflow_valueChanged(int gf)
|
||||
{
|
||||
ui->gflow->setStyleSheet(DANGER_GF);
|
||||
}
|
||||
void PreferencesGraph::on_gfhigh_valueChanged(int gf)
|
||||
{
|
||||
ui->gfhigh->setStyleSheet(DANGER_GF);
|
||||
}
|
||||
#undef DANGER_GF
|
27
desktop-widgets/preferences/preferences_graph.h
Normal file
27
desktop-widgets/preferences/preferences_graph.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef PREFERENCES_GRAPH_H
|
||||
#define PREFERENCES_GRAPH_H
|
||||
|
||||
#include "abstractpreferenceswidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class PreferencesGraph;
|
||||
}
|
||||
|
||||
class PreferencesGraph : public AbstractPreferencesWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreferencesGraph();
|
||||
virtual ~PreferencesGraph();
|
||||
virtual void refreshSettings();
|
||||
virtual void syncSettings();
|
||||
|
||||
private slots:
|
||||
void on_gflow_valueChanged(int gf);
|
||||
void on_gfhigh_valueChanged(int gf);
|
||||
|
||||
private:
|
||||
Ui::PreferencesGraph *ui;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
268
desktop-widgets/preferences/preferences_graph.ui
Normal file
268
desktop-widgets/preferences/preferences_graph.ui
Normal file
|
@ -0,0 +1,268 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PreferencesGraph</class>
|
||||
<widget class="QWidget" name="PreferencesGraph">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>505</width>
|
||||
<height>623</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Threshold when showing pO₂</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="po2Threshold">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Threshold when showing pN₂</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="pn2Threshold">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Threshold when showing pHe</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="pheThreshold">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Max pO₂ when showing MOD</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="maxpo2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="red_ceiling">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Draw dive computer reported ceiling red</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="display_unused_tanks">
|
||||
<property name="text">
|
||||
<string>Show unused cylinders in Equipment tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="show_average_depth">
|
||||
<property name="text">
|
||||
<string>Show average depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>Misc</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="gflow">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>150</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="defaultSetpoint">
|
||||
<property name="suffix">
|
||||
<string>bar</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="text">
|
||||
<string>Default CCR set-point for dive planning</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="pSCR">
|
||||
<property name="text">
|
||||
<string>pSCR O₂ metabolism rate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>GFLow</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>GFHigh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="gfhigh">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>150</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="psro2rate">
|
||||
<property name="suffix">
|
||||
<string>ℓ/min</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string>pSCR ratio</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="pscrfactor">
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>1:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="show_ccr_sensors">
|
||||
<property name="text">
|
||||
<string>CCR: show individual O₂ sensor values when viewing pO₂</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="show_ccr_setpoint">
|
||||
<property name="text">
|
||||
<string>CCR: show setpoints when viewing pO₂</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="gf_low_at_maxdepth">
|
||||
<property name="text">
|
||||
<string>GFLow at max depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
72
desktop-widgets/preferences/preferences_language.cpp
Normal file
72
desktop-widgets/preferences/preferences_language.cpp
Normal file
|
@ -0,0 +1,72 @@
|
|||
#include "preferences_language.h"
|
||||
#include "ui_prefs_language.h"
|
||||
#include "subsurface-core/helpers.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "qt-models/models.h"
|
||||
|
||||
PreferencesLanguage::PreferencesLanguage() : AbstractPreferencesWidget(tr("Language"), QIcon(":/language"), 4)
|
||||
{
|
||||
ui = new Ui::PreferencesLanguage();
|
||||
ui->setupUi(this);
|
||||
|
||||
QSortFilterProxyModel *filterModel = new QSortFilterProxyModel();
|
||||
filterModel->setSourceModel(LanguageModel::instance());
|
||||
filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
ui->languageDropdown->setModel(filterModel);
|
||||
filterModel->sort(0);
|
||||
connect(ui->languageFilter, &QLineEdit::textChanged,
|
||||
filterModel, &QSortFilterProxyModel::setFilterFixedString);
|
||||
}
|
||||
|
||||
PreferencesLanguage::~PreferencesLanguage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PreferencesLanguage::refreshSettings()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("Language");
|
||||
ui->languageSystemDefault->setChecked(s.value("UseSystemLanguage", true).toBool());
|
||||
ui->timeFormatSystemDefault->setChecked(!s.value("time_format_override", false).toBool());
|
||||
ui->dateFormatSystemDefault->setChecked(!s.value("date_format_override", false).toBool());
|
||||
ui->timeFormatEntry->setText(s.value("time_format").toString());
|
||||
ui->dateFormatEntry->setText(s.value("date_format").toString());
|
||||
ui->shortDateFormatEntry->setText(s.value("date_format_short").toString());
|
||||
QAbstractItemModel *m = ui->languageDropdown->model();
|
||||
QModelIndexList languages = m->match(m->index(0, 0), Qt::UserRole, s.value("UiLanguage").toString());
|
||||
if (languages.count())
|
||||
ui->languageDropdown->setCurrentIndex(languages.first().row());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void PreferencesLanguage::syncSettings()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("Language");
|
||||
bool useSystemLang = s.value("UseSystemLanguage", true).toBool();
|
||||
QAbstractItemModel *m = ui->languageDropdown->model();
|
||||
QString currentText = m->data(m->index(ui->languageDropdown->currentIndex(),0), Qt::UserRole).toString();
|
||||
if (useSystemLang != ui->languageSystemDefault->isChecked() ||
|
||||
(!useSystemLang && s.value("UiLanguage").toString() != currentText)) {
|
||||
QMessageBox::warning(this, tr("Restart required"),
|
||||
tr("To correctly load a new language you must restart Subsurface."));
|
||||
}
|
||||
s.setValue("UiLanguage", currentText);
|
||||
s.setValue("UseSystemLanguage", ui->languageSystemDefault->isChecked());
|
||||
s.setValue("time_format_override", !ui->timeFormatSystemDefault->isChecked());
|
||||
s.setValue("date_format_override", !ui->dateFormatSystemDefault->isChecked());
|
||||
if (!ui->timeFormatSystemDefault->isChecked())
|
||||
s.setValue("time_format", ui->timeFormatEntry->text());
|
||||
if (!ui->dateFormatSystemDefault->isChecked()) {
|
||||
s.setValue("date_format", ui->dateFormatEntry->text());
|
||||
s.setValue("date_format_short", ui->shortDateFormatEntry->text());
|
||||
}
|
||||
s.endGroup();
|
||||
uiLanguage(NULL);
|
||||
}
|
21
desktop-widgets/preferences/preferences_language.h
Normal file
21
desktop-widgets/preferences/preferences_language.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef PREFERENCES_LANGUAGE_H
|
||||
#define PREFERENCES_LANGUAGE_H
|
||||
|
||||
#include "abstractpreferenceswidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class PreferencesLanguage;
|
||||
}
|
||||
|
||||
class PreferencesLanguage : public AbstractPreferencesWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreferencesLanguage();
|
||||
virtual ~PreferencesLanguage();
|
||||
virtual void refreshSettings();
|
||||
virtual void syncSettings();
|
||||
private:
|
||||
Ui::PreferencesLanguage *ui;
|
||||
};
|
||||
|
||||
#endif
|
172
desktop-widgets/preferences/preferences_network.cpp
Normal file
172
desktop-widgets/preferences/preferences_network.cpp
Normal file
|
@ -0,0 +1,172 @@
|
|||
#include "preferences_network.h"
|
||||
#include "ui_preferences_network.h"
|
||||
#include "dive.h"
|
||||
#include "subsurfacewebservices.h"
|
||||
#include "subsurface-core/prefs-macros.h"
|
||||
|
||||
#include <QNetworkProxy>
|
||||
#include <QSettings>
|
||||
|
||||
PreferencesNetwork::PreferencesNetwork() : AbstractPreferencesWidget(tr("Network"),QIcon(":network"), 9), ui(new Ui::PreferencesNetwork())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->proxyType->clear();
|
||||
ui->proxyType->addItem(tr("No proxy"), QNetworkProxy::NoProxy);
|
||||
ui->proxyType->addItem(tr("System proxy"), QNetworkProxy::DefaultProxy);
|
||||
ui->proxyType->addItem(tr("HTTP proxy"), QNetworkProxy::HttpProxy);
|
||||
ui->proxyType->addItem(tr("SOCKS proxy"), QNetworkProxy::Socks5Proxy);
|
||||
ui->proxyType->setCurrentIndex(-1);
|
||||
|
||||
connect(ui->proxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(proxyType_changed(int)));
|
||||
}
|
||||
|
||||
PreferencesNetwork::~PreferencesNetwork()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PreferencesNetwork::refreshSettings()
|
||||
{
|
||||
QSettings s;
|
||||
|
||||
ui->proxyHost->setText(prefs.proxy_host);
|
||||
ui->proxyPort->setValue(prefs.proxy_port);
|
||||
ui->proxyAuthRequired->setChecked(prefs.proxy_auth);
|
||||
ui->proxyUsername->setText(prefs.proxy_user);
|
||||
ui->proxyPassword->setText(prefs.proxy_pass);
|
||||
ui->proxyType->setCurrentIndex(ui->proxyType->findData(prefs.proxy_type));
|
||||
ui->cloud_storage_email->setText(prefs.cloud_storage_email);
|
||||
ui->cloud_storage_password->setText(prefs.cloud_storage_password);
|
||||
ui->save_password_local->setChecked(prefs.save_password_local);
|
||||
ui->cloud_background_sync->setChecked(prefs.cloud_background_sync);
|
||||
ui->save_uid_local->setChecked(prefs.save_userid_local);
|
||||
ui->default_uid->setText(s.value("subsurface_webservice_uid").toString().toUpper());
|
||||
|
||||
cloudPinNeeded();
|
||||
}
|
||||
|
||||
void PreferencesNetwork::syncSettings()
|
||||
{
|
||||
QSettings s;
|
||||
s.setValue("subsurface_webservice_uid", ui->default_uid->text().toUpper());
|
||||
set_save_userid_local(ui->save_uid_local->checkState());
|
||||
|
||||
s.beginGroup("Network");
|
||||
s.setValue("proxy_type", ui->proxyType->itemData(ui->proxyType->currentIndex()).toInt());
|
||||
s.setValue("proxy_host", ui->proxyHost->text());
|
||||
s.setValue("proxy_port", ui->proxyPort->value());
|
||||
SB("proxy_auth", ui->proxyAuthRequired);
|
||||
s.setValue("proxy_user", ui->proxyUsername->text());
|
||||
s.setValue("proxy_pass", ui->proxyPassword->text());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("CloudStorage");
|
||||
QString email = ui->cloud_storage_email->text();
|
||||
QString password = ui->cloud_storage_password->text();
|
||||
QString newpassword = ui->cloud_storage_new_passwd->text();
|
||||
if (prefs.cloud_verification_status == CS_VERIFIED && !newpassword.isEmpty()) {
|
||||
// deal with password change
|
||||
if (!email.isEmpty() && !password.isEmpty()) {
|
||||
// connect to backend server to check / create credentials
|
||||
QRegularExpression reg("^[a-zA-Z0-9@.+_-]+$");
|
||||
if (!reg.match(email).hasMatch() || (!password.isEmpty() && !reg.match(password).hasMatch())) {
|
||||
report_error(qPrintable(tr("Cloud storage email and password can only consist of letters, numbers, and '.', '-', '_', and '+'.")));
|
||||
} else {
|
||||
CloudStorageAuthenticate *cloudAuth = new CloudStorageAuthenticate(this);
|
||||
connect(cloudAuth, SIGNAL(finishedAuthenticate()), this, SLOT(cloudPinNeeded()));
|
||||
connect(cloudAuth, SIGNAL(passwordChangeSuccessful()), this, SLOT(passwordUpdateSuccessfull()));
|
||||
QNetworkReply *reply = cloudAuth->backend(email, password, "", newpassword);
|
||||
ui->cloud_storage_new_passwd->setText("");
|
||||
free(prefs.cloud_storage_newpassword);
|
||||
prefs.cloud_storage_newpassword = strdup(qPrintable(newpassword));
|
||||
}
|
||||
}
|
||||
} else if (prefs.cloud_verification_status == CS_UNKNOWN ||
|
||||
prefs.cloud_verification_status == CS_INCORRECT_USER_PASSWD ||
|
||||
email != prefs.cloud_storage_email ||
|
||||
password != prefs.cloud_storage_password) {
|
||||
|
||||
// different credentials - reset verification status
|
||||
prefs.cloud_verification_status = CS_UNKNOWN;
|
||||
if (!email.isEmpty() && !password.isEmpty()) {
|
||||
// connect to backend server to check / create credentials
|
||||
QRegularExpression reg("^[a-zA-Z0-9@.+_-]+$");
|
||||
if (!reg.match(email).hasMatch() || (!password.isEmpty() && !reg.match(password).hasMatch())) {
|
||||
report_error(qPrintable(tr("Cloud storage email and password can only consist of letters, numbers, and '.', '-', '_', and '+'.")));
|
||||
} else {
|
||||
CloudStorageAuthenticate *cloudAuth = new CloudStorageAuthenticate(this);
|
||||
connect(cloudAuth, SIGNAL(finishedAuthenticate()), this, SLOT(cloudPinNeeded()));
|
||||
QNetworkReply *reply = cloudAuth->backend(email, password);
|
||||
}
|
||||
}
|
||||
} else if (prefs.cloud_verification_status == CS_NEED_TO_VERIFY) {
|
||||
QString pin = ui->cloud_storage_pin->text();
|
||||
if (!pin.isEmpty()) {
|
||||
// connect to backend server to check / create credentials
|
||||
QRegularExpression reg("^[a-zA-Z0-9@.+_-]+$");
|
||||
if (!reg.match(email).hasMatch() || !reg.match(password).hasMatch()) {
|
||||
report_error(qPrintable(tr("Cloud storage email and password can only consist of letters, numbers, and '.', '-', '_', and '+'.")));
|
||||
}
|
||||
CloudStorageAuthenticate *cloudAuth = new CloudStorageAuthenticate(this);
|
||||
connect(cloudAuth, SIGNAL(finishedAuthenticate()), this, SLOT(cloudPinNeeded()));
|
||||
QNetworkReply *reply = cloudAuth->backend(email, password, pin);
|
||||
}
|
||||
}
|
||||
SAVE_OR_REMOVE("email", default_prefs.cloud_storage_email, email);
|
||||
SAVE_OR_REMOVE("save_password_local", default_prefs.save_password_local, ui->save_password_local->isChecked());
|
||||
if (ui->save_password_local->isChecked()) {
|
||||
SAVE_OR_REMOVE("password", default_prefs.cloud_storage_password, password);
|
||||
} else {
|
||||
s.remove("password");
|
||||
free(prefs.cloud_storage_password);
|
||||
prefs.cloud_storage_password = strdup(qPrintable(password));
|
||||
}
|
||||
SAVE_OR_REMOVE("cloud_verification_status", default_prefs.cloud_verification_status, prefs.cloud_verification_status);
|
||||
SAVE_OR_REMOVE("cloud_background_sync", default_prefs.cloud_background_sync, ui->cloud_background_sync->isChecked());
|
||||
|
||||
// at this point we intentionally do not have a UI for changing this
|
||||
// it could go into some sort of "advanced setup" or something
|
||||
SAVE_OR_REMOVE("cloud_base_url", default_prefs.cloud_base_url, prefs.cloud_base_url);
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void PreferencesNetwork::cloudPinNeeded()
|
||||
{
|
||||
ui->cloud_storage_pin->setEnabled(prefs.cloud_verification_status == CS_NEED_TO_VERIFY);
|
||||
ui->cloud_storage_pin->setVisible(prefs.cloud_verification_status == CS_NEED_TO_VERIFY);
|
||||
ui->cloud_storage_pin_label->setEnabled(prefs.cloud_verification_status == CS_NEED_TO_VERIFY);
|
||||
ui->cloud_storage_pin_label->setVisible(prefs.cloud_verification_status == CS_NEED_TO_VERIFY);
|
||||
ui->cloud_storage_new_passwd->setEnabled(prefs.cloud_verification_status == CS_VERIFIED);
|
||||
ui->cloud_storage_new_passwd->setVisible(prefs.cloud_verification_status == CS_VERIFIED);
|
||||
ui->cloud_storage_new_passwd_label->setEnabled(prefs.cloud_verification_status == CS_VERIFIED);
|
||||
ui->cloud_storage_new_passwd_label->setVisible(prefs.cloud_verification_status == CS_VERIFIED);
|
||||
if (prefs.cloud_verification_status == CS_VERIFIED) {
|
||||
ui->cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage (credentials verified)"));
|
||||
} else {
|
||||
ui->cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage"));
|
||||
}
|
||||
//TODO: Do not call mainWindow here. Verify things on SettingsChanged.
|
||||
//MainWindow::instance()->enableDisableCloudActions();
|
||||
}
|
||||
|
||||
void PreferencesNetwork::proxyType_changed(int idx)
|
||||
{
|
||||
if (idx == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int proxyType = ui->proxyType->itemData(idx).toInt();
|
||||
bool hpEnabled = (proxyType == QNetworkProxy::Socks5Proxy || proxyType == QNetworkProxy::HttpProxy);
|
||||
ui->proxyHost->setEnabled(hpEnabled);
|
||||
ui->proxyPort->setEnabled(hpEnabled);
|
||||
ui->proxyAuthRequired->setEnabled(hpEnabled);
|
||||
ui->proxyUsername->setEnabled(hpEnabled & ui->proxyAuthRequired->isChecked());
|
||||
ui->proxyPassword->setEnabled(hpEnabled & ui->proxyAuthRequired->isChecked());
|
||||
ui->proxyAuthRequired->setChecked(ui->proxyAuthRequired->isChecked());
|
||||
}
|
||||
|
||||
void PreferencesNetwork::passwordUpdateSuccessfull()
|
||||
{
|
||||
ui->cloud_storage_password->setText(prefs.cloud_storage_password);
|
||||
}
|
28
desktop-widgets/preferences/preferences_network.h
Normal file
28
desktop-widgets/preferences/preferences_network.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#ifndef PREFERENCES_NETWORK_H
|
||||
#define PREFERENCES_NETWORK_H
|
||||
|
||||
#include "abstractpreferenceswidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class PreferencesNetwork;
|
||||
}
|
||||
|
||||
class PreferencesNetwork : public AbstractPreferencesWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PreferencesNetwork();
|
||||
virtual ~PreferencesNetwork();
|
||||
virtual void refreshSettings();
|
||||
virtual void syncSettings();
|
||||
|
||||
public slots:
|
||||
void proxyType_changed(int i);
|
||||
|
||||
private:
|
||||
Ui::PreferencesNetwork *ui;
|
||||
void cloudPinNeeded();
|
||||
void passwordUpdateSuccessfull();
|
||||
};
|
||||
|
||||
#endif
|
293
desktop-widgets/preferences/preferences_network.ui
Normal file
293
desktop-widgets/preferences/preferences_network.ui
Normal file
|
@ -0,0 +1,293 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PreferencesNetwork</class>
|
||||
<widget class="QWidget" name="PreferencesNetwork">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>713</width>
|
||||
<height>558</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_10">
|
||||
<property name="title">
|
||||
<string>Proxy</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>Host</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>Proxy type</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QSpinBox" name="proxyPort">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>80</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="proxyHost">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>64</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="3">
|
||||
<widget class="QComboBox" name="proxyType"/>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="proxyAuthRequired">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Requires authentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="proxyUsername">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>32</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLineEdit" name="proxyPassword">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>32</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="cloudStorageGroupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>129</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Subsurface cloud storage</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_16b">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Email address used for the Subsurface cloud storage infrastructure"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Email address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_16c">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="cloud_storage_pin_label">
|
||||
<property name="text">
|
||||
<string>Verification PIN</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="cloud_storage_new_passwd_label">
|
||||
<property name="text">
|
||||
<string>New password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="cloud_storage_email">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Email address used for the Subsurface cloud storage infrastructure"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="cloud_storage_password">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="cloud_storage_pin">
|
||||
<property name="toolTip">
|
||||
<string extracomment="One time verification PIN for Subsurface cloud storage infrastructure"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="cloud_storage_new_passwd">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="cloud_background_sync">
|
||||
<property name="text">
|
||||
<string>Sync to cloud in the background?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="save_password_local">
|
||||
<property name="text">
|
||||
<string>Save Password locally?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_8">
|
||||
<property name="title">
|
||||
<string>Subsurface web service</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Default user ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="default_uid"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="save_uid_local">
|
||||
<property name="text">
|
||||
<string>Save user ID locally?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
60
desktop-widgets/preferences/preferences_units.cpp
Normal file
60
desktop-widgets/preferences/preferences_units.cpp
Normal file
|
@ -0,0 +1,60 @@
|
|||
#include "preferences_units.h"
|
||||
#include "ui_preferences_units.h"
|
||||
#include "prefs-macros.h"
|
||||
#include "qthelper.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
PreferencesUnits::PreferencesUnits(): AbstractPreferencesWidget(tr("Units"),QIcon(":units"),1), ui(new Ui::PreferencesUnits())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
PreferencesUnits::~PreferencesUnits()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PreferencesUnits::refreshSettings()
|
||||
{
|
||||
switch(prefs.unit_system) {
|
||||
case METRIC: ui->metric->setChecked(true); break;
|
||||
case IMPERIAL: ui->imperial->setChecked(true); break;
|
||||
default: ui->personalize->setChecked(true); break;
|
||||
}
|
||||
|
||||
ui->gpsTraditional->setChecked(prefs.coordinates_traditional);
|
||||
ui->gpsDecimal->setChecked(!prefs.coordinates_traditional);
|
||||
|
||||
ui->celsius->setChecked(prefs.units.temperature == units::CELSIUS);
|
||||
ui->fahrenheit->setChecked(prefs.units.temperature == units::FAHRENHEIT);
|
||||
ui->meter->setChecked(prefs.units.length == units::METERS);
|
||||
ui->feet->setChecked(prefs.units.length == units::FEET);
|
||||
ui->bar->setChecked(prefs.units.pressure == units::BAR);
|
||||
ui->psi->setChecked(prefs.units.pressure == units::PSI);
|
||||
ui->liter->setChecked(prefs.units.volume == units::LITER);
|
||||
ui->cuft->setChecked(prefs.units.volume == units::CUFT);
|
||||
ui->kg->setChecked(prefs.units.weight == units::KG);
|
||||
ui->lbs->setChecked(prefs.units.weight == units::LBS);
|
||||
ui->units_group->setEnabled(ui->personalize->isChecked());
|
||||
|
||||
ui->vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES);
|
||||
ui->vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS);
|
||||
}
|
||||
|
||||
void PreferencesUnits::syncSettings()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("Units");
|
||||
QString unitSystem[] = {"metric", "imperial", "personal"};
|
||||
short unitValue = ui->metric->isChecked() ? METRIC : (ui->imperial->isChecked() ? IMPERIAL : PERSONALIZE);
|
||||
SAVE_OR_REMOVE_SPECIAL("unit_system", default_prefs.unit_system, unitValue, unitSystem[unitValue]);
|
||||
s.setValue("temperature", ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS);
|
||||
s.setValue("length", ui->feet->isChecked() ? units::FEET : units::METERS);
|
||||
s.setValue("pressure", ui->psi->isChecked() ? units::PSI : units::BAR);
|
||||
s.setValue("volume", ui->cuft->isChecked() ? units::CUFT : units::LITER);
|
||||
s.setValue("weight", ui->lbs->isChecked() ? units::LBS : units::KG);
|
||||
s.setValue("vertical_speed_time", ui->vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS);
|
||||
s.setValue("coordinates", ui->gpsTraditional->isChecked());
|
||||
s.endGroup();
|
||||
}
|
21
desktop-widgets/preferences/preferences_units.h
Normal file
21
desktop-widgets/preferences/preferences_units.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef PREFERENCES_UNITS_H
|
||||
#define PREFERENCES_UNITS_H
|
||||
|
||||
#include "abstractpreferenceswidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class PreferencesUnits;
|
||||
}
|
||||
|
||||
class PreferencesUnits : public AbstractPreferencesWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreferencesUnits();
|
||||
virtual ~PreferencesUnits();
|
||||
virtual void refreshSettings();
|
||||
virtual void syncSettings();
|
||||
private:
|
||||
Ui::PreferencesUnits *ui;
|
||||
};
|
||||
|
||||
#endif
|
251
desktop-widgets/preferences/preferences_units.ui
Normal file
251
desktop-widgets/preferences/preferences_units.ui
Normal file
|
@ -0,0 +1,251 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PreferencesUnits</class>
|
||||
<widget class="QWidget" name="PreferencesUnits">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>374</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_units">
|
||||
<property name="title">
|
||||
<string>Unit system</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>System</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="metric">
|
||||
<property name="text">
|
||||
<string>&Metric</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="imperial">
|
||||
<property name="text">
|
||||
<string>Imperial</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="personalize">
|
||||
<property name="text">
|
||||
<string>Personali&ze</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="units_group">
|
||||
<property name="title">
|
||||
<string>Individual settings</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="meter">
|
||||
<property name="text">
|
||||
<string>meter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="feet">
|
||||
<property name="text">
|
||||
<string>feet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Pressure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="bar">
|
||||
<property name="text">
|
||||
<string>bar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QRadioButton" name="psi">
|
||||
<property name="text">
|
||||
<string>psi</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Volume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="liter">
|
||||
<property name="text">
|
||||
<string>&liter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QRadioButton" name="cuft">
|
||||
<property name="text">
|
||||
<string>cu ft</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Temperature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QRadioButton" name="celsius">
|
||||
<property name="text">
|
||||
<string>celsius</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QRadioButton" name="fahrenheit">
|
||||
<property name="text">
|
||||
<string>fahrenheit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Weight</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QRadioButton" name="kg">
|
||||
<property name="text">
|
||||
<string>kg</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QRadioButton" name="lbs">
|
||||
<property name="text">
|
||||
<string>lbs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Time units</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label13">
|
||||
<property name="text">
|
||||
<string>Ascent/descent speed denominator</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="vertical_speed_minutes">
|
||||
<property name="text">
|
||||
<string>Minutes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="vertical_speed_seconds">
|
||||
<property name="text">
|
||||
<string>Seconds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_11">
|
||||
<property name="title">
|
||||
<string>GPS coordinates</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>Location Display</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="gpsTraditional">
|
||||
<property name="text">
|
||||
<string>traditional (dms)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="gpsDecimal">
|
||||
<property name="text">
|
||||
<string>decimal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
140
desktop-widgets/preferences/preferencesdialog.cpp
Normal file
140
desktop-widgets/preferences/preferencesdialog.cpp
Normal file
|
@ -0,0 +1,140 @@
|
|||
#include "preferencesdialog.h"
|
||||
|
||||
#include "abstractpreferenceswidget.h"
|
||||
#include "preferences_language.h"
|
||||
#include "preferences_georeference.h"
|
||||
#include "preferences_defaults.h"
|
||||
#include "preferences_units.h"
|
||||
#include "preferences_graph.h"
|
||||
#include "preferences_network.h"
|
||||
|
||||
#include "subsurface-core/qthelper.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QListWidget>
|
||||
#include <QStackedWidget>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QAbstractButton>
|
||||
#include <QDebug>
|
||||
|
||||
PreferencesDialog* PreferencesDialog::instance()
|
||||
{
|
||||
static PreferencesDialog *self = new PreferencesDialog();
|
||||
return self;
|
||||
}
|
||||
|
||||
void PreferencesDialog::emitSettingsChanged()
|
||||
{
|
||||
emit settingsChanged();
|
||||
}
|
||||
|
||||
PreferencesDialog::PreferencesDialog()
|
||||
{
|
||||
loadPreferences(); //TODO: Move this code out of the qthelper.cpp
|
||||
|
||||
pagesList = new QListWidget();
|
||||
pagesStack = new QStackedWidget();
|
||||
buttonBox = new QDialogButtonBox(
|
||||
QDialogButtonBox::Save |
|
||||
QDialogButtonBox::Apply |
|
||||
QDialogButtonBox::Cancel);
|
||||
|
||||
pagesList->setMinimumWidth(120);
|
||||
pagesList->setMaximumWidth(120);
|
||||
|
||||
QHBoxLayout *h = new QHBoxLayout();
|
||||
h->addWidget(pagesList);
|
||||
h->addWidget(pagesStack);
|
||||
QVBoxLayout *v = new QVBoxLayout();
|
||||
v->addLayout(h);
|
||||
v->addWidget(buttonBox);
|
||||
|
||||
setLayout(v);
|
||||
|
||||
addPreferencePage(new PreferencesLanguage());
|
||||
addPreferencePage(new PreferencesGeoreference());
|
||||
addPreferencePage(new PreferencesDefaults());
|
||||
addPreferencePage(new PreferencesUnits());
|
||||
addPreferencePage(new PreferencesGraph());
|
||||
addPreferencePage(new PreferencesNetwork());
|
||||
refreshPages();
|
||||
|
||||
connect(pagesList, &QListWidget::currentRowChanged,
|
||||
pagesStack, &QStackedWidget::setCurrentIndex);
|
||||
connect(buttonBox, &QDialogButtonBox::clicked,
|
||||
this, &PreferencesDialog::buttonClicked);
|
||||
}
|
||||
|
||||
PreferencesDialog::~PreferencesDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void PreferencesDialog::buttonClicked(QAbstractButton* btn)
|
||||
{
|
||||
QDialogButtonBox::ButtonRole role = buttonBox->buttonRole(btn);
|
||||
switch(role) {
|
||||
case QDialogButtonBox::ApplyRole : applyRequested(false); return;
|
||||
case QDialogButtonBox::AcceptRole : applyRequested(true); return;
|
||||
case QDialogButtonBox::RejectRole : cancelRequested(); return;
|
||||
case QDialogButtonBox::ResetRole : defaultsRequested(); return;
|
||||
}
|
||||
}
|
||||
|
||||
bool abstractpreferenceswidget_lessthan(AbstractPreferencesWidget *p1, AbstractPreferencesWidget *p2)
|
||||
{
|
||||
return p1->positionHeight() <= p2->positionHeight();
|
||||
}
|
||||
|
||||
void PreferencesDialog::addPreferencePage(AbstractPreferencesWidget *page)
|
||||
{
|
||||
pages.push_back(page);
|
||||
qSort(pages.begin(), pages.end(), abstractpreferenceswidget_lessthan);
|
||||
}
|
||||
|
||||
void PreferencesDialog::refreshPages()
|
||||
{
|
||||
// Remove things
|
||||
pagesList->clear();
|
||||
while(pagesStack->count()) {
|
||||
QWidget *curr = pagesStack->widget(0);
|
||||
pagesStack->removeWidget(curr);
|
||||
curr->setParent(0);
|
||||
}
|
||||
|
||||
// Readd things.
|
||||
Q_FOREACH(AbstractPreferencesWidget *page, pages) {
|
||||
QListWidgetItem *item = new QListWidgetItem(page->icon(), page->name());
|
||||
pagesList->addItem(item);
|
||||
pagesStack->addWidget(page);
|
||||
page->refreshSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::applyRequested(bool closeIt)
|
||||
{
|
||||
Q_FOREACH(AbstractPreferencesWidget *page, pages) {
|
||||
page->syncSettings();
|
||||
}
|
||||
emit settingsChanged();
|
||||
if (closeIt)
|
||||
accept();
|
||||
}
|
||||
|
||||
void PreferencesDialog::cancelRequested()
|
||||
{
|
||||
Q_FOREACH(AbstractPreferencesWidget *page, pages) {
|
||||
page->refreshSettings();
|
||||
}
|
||||
reject();
|
||||
}
|
||||
|
||||
void PreferencesDialog::defaultsRequested()
|
||||
{
|
||||
prefs = default_prefs;
|
||||
Q_FOREACH(AbstractPreferencesWidget *page, pages) {
|
||||
page->refreshSettings();
|
||||
}
|
||||
emit settingsChanged();
|
||||
accept();
|
||||
}
|
35
desktop-widgets/preferences/preferencesdialog.h
Normal file
35
desktop-widgets/preferences/preferencesdialog.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#ifndef PREFERENCES_WIDGET_H
|
||||
#define PREFERENCES_WIDGET_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "pref.h"
|
||||
|
||||
class AbstractPreferencesWidget;
|
||||
class QListWidget;
|
||||
class QStackedWidget;
|
||||
class QDialogButtonBox;
|
||||
class QAbstractButton;
|
||||
|
||||
class PreferencesDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
static PreferencesDialog* instance();
|
||||
virtual ~PreferencesDialog();
|
||||
void addPreferencePage(AbstractPreferencesWidget *page);
|
||||
void refreshPages();
|
||||
void emitSettingsChanged();
|
||||
signals:
|
||||
void settingsChanged();
|
||||
private:
|
||||
PreferencesDialog();
|
||||
void cancelRequested();
|
||||
void applyRequested(bool closeIt);
|
||||
void defaultsRequested();
|
||||
void buttonClicked(QAbstractButton *btn);
|
||||
QList<AbstractPreferencesWidget*> pages;
|
||||
QListWidget *pagesList;
|
||||
QStackedWidget *pagesStack;
|
||||
QDialogButtonBox *buttonBox;
|
||||
};
|
||||
|
||||
#endif
|
123
desktop-widgets/preferences/prefs_georeference.ui
Normal file
123
desktop-widgets/preferences/prefs_georeference.ui
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PreferencesGeoreference</class>
|
||||
<widget class="QWidget" name="PreferencesGeoreference">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_Geocoding">
|
||||
<property name="title">
|
||||
<string>Dive site geo lookup</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enable_geocoding">
|
||||
<property name="text">
|
||||
<string>Enable geocoding for dive site management</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="parse_without_gps">
|
||||
<property name="text">
|
||||
<string>Parse site without GPS data</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="tag_existing_dives">
|
||||
<property name="text">
|
||||
<string>Same format for existing dives</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_12">
|
||||
<property name="title">
|
||||
<string>Dive Site Layout</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QComboBox" name="first_item">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>/</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="second_item">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
<string>/</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="third_item">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>109</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
260
desktop-widgets/preferences/prefs_language.ui
Normal file
260
desktop-widgets/preferences/prefs_language.ui
Normal file
|
@ -0,0 +1,260 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PreferencesLanguage</class>
|
||||
<widget class="QWidget" name="PreferencesLanguage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>621</width>
|
||||
<height>523</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="language_group">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>UI language</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="languageSystemDefault">
|
||||
<property name="text">
|
||||
<string>Use system default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="languageDropdown"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>203</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Filter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="languageFilter"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="dateformat_group">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Date format</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="dateFormatEntry">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Preferred date format. Commonly used fields are</p><p>d (day of month)</p><p>ddd (abbr. day name)</p><p>M (month number)</p><p>MMM (abbr. month name)</p><p>yy/yyyy (2/4 digit year)</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="dateFormatSystemDefault">
|
||||
<property name="text">
|
||||
<string>Use UI language default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="shortDateFormatEntry"/>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="toolTip">
|
||||
<string>This is used in places where there is less space to show the full date</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Short format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>203</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="timeformat_group">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Time format</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="timeFormatSystemDefault">
|
||||
<property name="text">
|
||||
<string>Use UI language default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="timeFormatEntry">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Preferred time format</p><p>Commonly used format specifiers are</p><p>h (hours in 12h format)</p><p>H (hours in 24h format)</p><p>mm (2 digit minutes)</p><p>ss (2 digit seconds)</p><p>t/tt (a/p or am/pm)</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>203</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>languageSystemDefault</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>languageDropdown</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>73</x>
|
||||
<y>273</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>179</x>
|
||||
<y>273</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>languageSystemDefault</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>languageFilter</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>73</x>
|
||||
<y>273</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>539</x>
|
||||
<y>273</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>dateFormatSystemDefault</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>dateFormatEntry</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>79</x>
|
||||
<y>132</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>264</x>
|
||||
<y>132</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>timeFormatSystemDefault</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>timeFormatEntry</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>79</x>
|
||||
<y>210</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>264</x>
|
||||
<y>210</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>dateFormatSystemDefault</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>shortDateFormatEntry</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>99</x>
|
||||
<y>132</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>293</x>
|
||||
<y>169</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -8,6 +8,7 @@
|
|||
#include <QPainter>
|
||||
#include <QWebElementCollection>
|
||||
#include <QWebElement>
|
||||
#include "profile-widget/profilewidget2.h"
|
||||
|
||||
Printer::Printer(QPaintDevice *paintDevice, print_options *printOptions, template_options *templateOptions, PrintMode printMode)
|
||||
{
|
|
@ -6,7 +6,6 @@
|
|||
#include <QRect>
|
||||
#include <QPainter>
|
||||
|
||||
#include "profile/profilewidget2.h"
|
||||
#include "printoptions.h"
|
||||
#include "templateedit.h"
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue