From 45d1567057618736e018a15e27b4930c29f09829 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 7 Jul 2014 16:30:32 +0200 Subject: [PATCH] Move Folder, FolderMan, and FolderWatcher outside of owncloudsync Those class are maintaining the folder for the mirall configuration They are not usefull in command line clients Also the FolderWatcher is only used by the folder and not used by the command line clients --- src/CMakeLists.txt | 35 +++++++++++++++++------------------ src/mirall/folder.h | 2 +- src/mirall/folderman.h | 2 +- src/mirall/folderwatcher.cpp | 1 - test/CMakeLists.txt | 26 ++++++++++++++++++++------ test/owncloud_add_test.cmake | 7 ++++--- 6 files changed, 43 insertions(+), 30 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 209fba264..74a67fc44 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -79,9 +79,6 @@ set(3rdparty_INC ) set(libsync_SRCS - mirall/folderman.cpp - mirall/folder.cpp - mirall/folderwatcher.cpp mirall/syncresult.cpp mirall/mirallconfigfile.cpp mirall/syncengine.cpp @@ -129,24 +126,10 @@ else() ) endif() -IF( NOT WIN32 AND NOT APPLE ) - set(libsync_SRCS ${libsync_SRCS} mirall/folderwatcher_linux.cpp) -ENDIF() -IF( WIN32 ) - set(libsync_SRCS ${libsync_SRCS} mirall/folderwatcher_win.cpp) -ENDIF() -IF( APPLE ) - list(APPEND libsync_SRCS mirall/folderwatcher_mac.cpp) -ENDIF() - - # These headers are installed for libowncloudsync to be used by 3rd party apps set(owncloudsync_HEADERS mirall/account.h mirall/syncengine.h - mirall/folder.h - mirall/folderman.h - mirall/folderwatcher.h mirall/mirallconfigfile.h mirall/networkjobs.h mirall/progressdispatcher.h @@ -272,6 +255,9 @@ qt_wrap_ui(mirall_UI_SRCS ${mirall_UI}) set(mirall_SRCS mirall/application.cpp mirall/systray.cpp + mirall/folderman.cpp + mirall/folder.cpp + mirall/folderwatcher.cpp mirall/folderwizard.cpp mirall/folderstatusmodel.cpp mirall/protocolwidget.cpp @@ -313,6 +299,9 @@ set(mirall_HEADERS wizard/owncloudwizardcommon.h wizard/owncloudshibbolethcredspage.h wizard/owncloudadvancedsetuppage.h + mirall/folder.h + mirall/folderman.h + mirall/folderwatcher.h mirall/folderstatusmodel.h mirall/sslerrordialog.h mirall/logbrowser.h @@ -339,7 +328,7 @@ set(updater_HEADERS ) IF( APPLE ) - list(APPEND mirall_SRCS mirall/cocoainitializer_mac.mm) + list(APPEND mirall_SRCSmirall_SRCS mirall/cocoainitializer_mac.mm) list(APPEND mirall_HEADERS mirall/cocoainitializer.h) list(APPEND mirall_SRCS mirall/settingsdialogmac.cpp) @@ -353,6 +342,16 @@ IF( APPLE ) endif() ENDIF() +IF( NOT WIN32 AND NOT APPLE ) +set(mirall_SRCS ${mirall_SRCS} mirall/folderwatcher_linux.cpp) +ENDIF() +IF( WIN32 ) +set(mirall_SRCS ${mirall_SRCS} mirall/folderwatcher_win.cpp) +ENDIF() +IF( APPLE ) +list(APPEND mirall_SRCS mirall/folderwatcher_mac.cpp) +ENDIF() + # csync is required. include_directories(../csync/src ../csync/src/httpbf/src ${CMAKE_CURRENT_BINARY_DIR}/../csync ${CMAKE_CURRENT_BINARY_DIR}/../csync/src ) include_directories(${3rdparty_INC}) diff --git a/src/mirall/folder.h b/src/mirall/folder.h index db5fd0be6..22f9f68c8 100644 --- a/src/mirall/folder.h +++ b/src/mirall/folder.h @@ -58,7 +58,7 @@ enum SyncFileStatus { FILE_STATUS_SHARED }; -class OWNCLOUDSYNC_EXPORT Folder : public QObject +class Folder : public QObject { Q_OBJECT diff --git a/src/mirall/folderman.h b/src/mirall/folderman.h index 3c51a0e62..82f69701d 100644 --- a/src/mirall/folderman.h +++ b/src/mirall/folderman.h @@ -32,7 +32,7 @@ namespace Mirall { class Application; -class OWNCLOUDSYNC_EXPORT FolderMan : public QObject +class FolderMan : public QObject { Q_OBJECT public: diff --git a/src/mirall/folderwatcher.cpp b/src/mirall/folderwatcher.cpp index ae119ca1e..7813a1e7f 100644 --- a/src/mirall/folderwatcher.cpp +++ b/src/mirall/folderwatcher.cpp @@ -13,7 +13,6 @@ // event masks #include "mirall/folderwatcher.h" -#include "mirall/folder.h" #include diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3521be168..37ac1e83b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,13 +4,27 @@ include_directories(${CMAKE_SOURCE_DIR}/csync/src/std) include(owncloud_add_test.cmake) -owncloud_add_test(OwncloudPropagator) -owncloud_add_test(Utility) -owncloud_add_test(Updater) -owncloud_add_test(FolderWatcher) -owncloud_add_test(CSyncSqlite) +owncloud_add_test(OwncloudPropagator "") +owncloud_add_test(Utility "") +owncloud_add_test(Updater "") +SET(FolderWatcher_SRC ../src/mirall/folderwatcher.cpp) + +IF( NOT WIN32 AND NOT APPLE ) +list(APPEND FolderWatcher_SRC ../src/mirall/folderwatcher_linux.cpp) +ENDIF() +IF( WIN32 ) +list(APPEND FolderWatcher_SRC ../src/mirall/folderwatcher_win.cpp) +ENDIF() +IF( APPLE ) +list(APPEND FolderWatcher_SRC ../src/mirall/folderwatcher_mac.cpp) +ENDIF() + +owncloud_add_test(FolderWatcher "${FolderWatcher_SRC}") if( UNIX AND NOT APPLE ) - owncloud_add_test(InotifyWatcher) + owncloud_add_test(InotifyWatcher "${FolderWatcher_SRC}") endif(UNIX AND NOT APPLE) +owncloud_add_test(CSyncSqlite "") + + diff --git a/test/owncloud_add_test.cmake b/test/owncloud_add_test.cmake index a7bf265a0..523819b64 100644 --- a/test/owncloud_add_test.cmake +++ b/test/owncloud_add_test.cmake @@ -1,13 +1,14 @@ -macro(owncloud_add_test test_class) +macro(owncloud_add_test test_class additional_cpp) include_directories(${QT_INCLUDES} "${PROJECT_SOURCE_DIR}/src" ${CMAKE_CURRENT_BINARY_DIR}) set(OWNCLOUD_TEST_CLASS ${test_class}) + set(CMAKE_AUTOMOC TRUE) string(TOLOWER "${OWNCLOUD_TEST_CLASS}" OWNCLOUD_TEST_CLASS_LOWERCASE) configure_file(main.cpp.in test${OWNCLOUD_TEST_CLASS_LOWERCASE}.cpp) configure_file(test${OWNCLOUD_TEST_CLASS_LOWERCASE}.h test${OWNCLOUD_TEST_CLASS_LOWERCASE}.h) - qt_wrap_cpp(${OWNCLOUD_TEST_CLASS}_MOCS test${OWNCLOUD_TEST_CLASS_LOWERCASE}.h) + qt_wrap_cpp(test${OWNCLOUD_TEST_CLASS_LOWERCASE}.h) - add_executable(${OWNCLOUD_TEST_CLASS}Test test${OWNCLOUD_TEST_CLASS_LOWERCASE}.cpp ${${OWNCLOUD_TEST_CLASS}_MOCS}) + add_executable(${OWNCLOUD_TEST_CLASS}Test test${OWNCLOUD_TEST_CLASS_LOWERCASE}.cpp ${additional_cpp}) qt5_use_modules(${OWNCLOUD_TEST_CLASS}Test Test Sql Xml) target_link_libraries(${OWNCLOUD_TEST_CLASS}Test