Bläddra i källkod

Merge branch 'master' into plugin-framework

Conflicts:
	Libs/Core/CMakeLists.txt
Sascha Zelzer 15 år sedan
förälder
incheckning
8dbab26634

+ 0 - 30
Libs/Core/CMakeLists.txt

@@ -7,33 +7,6 @@ SET(CMAKE_MODULE_PATH ${CTKCore_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH})
 INCLUDE(CMake/ctkMacroBFDCheck.cmake)
 
 #
-# 3rd party dependencies
-#
-
-# use the QtMobility SuperBuild paths for now
-# we should add a FindQtMobility later
-SET(QTMOBILITY_INCLUDE_DIRS 
-  "${CTK_BINARY_DIR}/../CMakeExternals/Source/QtMobility/install/include"
-  )
-SET(QTMOBILITY_LIBRARY_DIR "${LIBRARY_OUTPUT_PATH}")
-FIND_LIBRARY(QTMOBILITY_QTSERVICEFW_LIBRARY_DEBUG QtServiceFrameworkd
-             PATHS ${QTMOBILITY_LIBRARY_DIR}
-             )
-             
-FIND_LIBRARY(QTMOBILITY_QTSERVICEFW_LIBRARY_RELEASE QtServiceFramework
-             PATHS ${QTMOBILITY_LIBRARY_DIR}
-             )
-             
-SET(QTMOBILITY_QTSERVICEFW_LIBRARIES )
-IF(QTMOBILITY_QTSERVICEFW_LIBRARY_RELEASE AND QTMOBILITY_QTSERVICEFW_LIBRARY_DEBUG)
-  SET(QTMOBILITY_QTSERVICEFW_LIBRARIES optimized ${QTMOBILITY_QTSERVICEFW_LIBRARY_RELEASE} debug ${QTMOBILITY_QTSERVICEFW_LIBRARY_DEBUG})
-ELSEIF(QTMOBILITY_QTSERVICEFW_LIBRARY_DEBUG)
-  SET(QTMOBILITY_QTSERVICEFW_LIBRARIES ${QTMOBILITY_QTSERVICEFW_LIBRARY_DEBUG})
-ELSEIF(QTMOBILITY_QTSERVICEFW_LIBRARY_RELEASE)
-  SET(QTMOBILITY_QTSERVICEFW_LIBRARIES ${QTMOBILITY_QTSERVICEFW_LIBRARY_RELEASE})
-ENDIF()
-
-#
 # See CTK/CMake/ctkMacroBuildLib.cmake for details
 #
 
@@ -140,9 +113,6 @@ ctkMacroBuildLib(
   LIBRARY_TYPE ${CTK_LIBRARY_MODE}
   )
 
-# Plugins
-#ADD_SUBDIRECTORY(Plugins)
-
 # Testing
 IF(BUILD_TESTING)
   ADD_SUBDIRECTORY(Testing)

+ 1 - 2
Libs/Core/target_libraries.cmake

@@ -6,6 +6,5 @@
 
 SET(target_libraries
   QT_LIBRARIES
-  QTMOBILITY_QTSERVICEFW_LIBRARIES
   BFD_LIBRARIES
-  )
+  )

+ 66 - 26
Libs/Widgets/ctkDirectoryButton.cpp

@@ -19,6 +19,8 @@
 =========================================================================*/
 
 // Qt includes
+#include <QHBoxLayout>
+#include <QPushButton>
 #include <QStyle>
 
 // CTK includes
@@ -30,92 +32,130 @@ class ctkDirectoryButtonPrivate: public ctkPrivate<ctkDirectoryButton>
 public:
   ctkDirectoryButtonPrivate();
   void init();
-  QString Caption;
-  ctkDirectoryButton::Options _Options;
+
+  QDir         Directory;
+  QPushButton* PushButton;
+  QString      DialogCaption;
+  ctkDirectoryButton::Options DialogOptions;
 };
 
 //-----------------------------------------------------------------------------
 ctkDirectoryButtonPrivate::ctkDirectoryButtonPrivate()
 {
-  this->_Options = ctkDirectoryButton::ShowDirsOnly;
+  this->DialogOptions = ctkDirectoryButton::ShowDirsOnly;
 }
 
 //-----------------------------------------------------------------------------
 void ctkDirectoryButtonPrivate::init()
 {
   CTK_P(ctkDirectoryButton);
-  QObject::connect(p, SIGNAL(clicked()), p, SLOT(browse()));
+  this->PushButton = new QPushButton(p);
+  QObject::connect(this->PushButton, SIGNAL(clicked()), p, SLOT(browse()));
+  QHBoxLayout* l = new QHBoxLayout(p);
+  l->addWidget(this->PushButton);
+  l->setContentsMargins(0,0,0,0);
+  p->setLayout(l);
 }
 
 //-----------------------------------------------------------------------------
 ctkDirectoryButton::ctkDirectoryButton(QWidget * parentWidget)
-  :QPushButton(parentWidget)
+  :QWidget(parentWidget)
 {
   CTK_INIT_PRIVATE(ctkDirectoryButton);
-  this->setIcon(this->style()->standardIcon(QStyle::SP_DirIcon));
-  ctk_d()->init();
+  CTK_D(ctkDirectoryButton);
+  d->init();
+  d->PushButton->setIcon(this->style()->standardIcon(QStyle::SP_DirIcon));
 }
     
 //-----------------------------------------------------------------------------
-ctkDirectoryButton::ctkDirectoryButton(const QString & text, QWidget * parentWidget)
-  :QPushButton(text, parentWidget)
+ctkDirectoryButton::ctkDirectoryButton(const QString& dir, 
+                                       QWidget * parentWidget)
+  :QWidget(parentWidget)
 {
   CTK_INIT_PRIVATE(ctkDirectoryButton);
-  this->setIcon(this->style()->standardIcon(QStyle::SP_DirIcon));
-  ctk_d()->init();
+  CTK_D(ctkDirectoryButton);
+  d->init();
+  d->Directory = QDir(dir);
+  d->PushButton->setText(d->Directory.path());
+  d->PushButton->setIcon(this->style()->standardIcon(QStyle::SP_DirIcon));
 }
 
 //-----------------------------------------------------------------------------
 ctkDirectoryButton::ctkDirectoryButton(
-  const QIcon & icon, const QString & text, QWidget * parentWidget)
-  :QPushButton(icon, text, parentWidget)
+  const QIcon & icon, const QString& dir, QWidget * parentWidget)
+  :QWidget(parentWidget)
 {
   CTK_INIT_PRIVATE(ctkDirectoryButton);
-  ctk_d()->init();
+  CTK_D(ctkDirectoryButton);
+  d->init();
+  d->Directory = QDir(dir);
+  d->PushButton->setText(d->Directory.path());
+  d->PushButton->setIcon(icon);
+}
+
+//-----------------------------------------------------------------------------
+void ctkDirectoryButton::setDirectory(const QString& dir)
+{
+  CTK_D(ctkDirectoryButton);
+  QDir newDirectory(dir);
+  if (d->Directory == newDirectory )
+    {
+    return;
+    }
+  d->Directory = newDirectory;
+  d->PushButton->setText(d->Directory.path());
+  emit directoryChanged(d->Directory.path());
+}
+
+//-----------------------------------------------------------------------------
+QString ctkDirectoryButton::directory()const
+{
+  CTK_D(const ctkDirectoryButton);
+  return d->Directory.path();
 }
 
 //-----------------------------------------------------------------------------
-void ctkDirectoryButton::setCaption(const QString& captionTitle)
+void ctkDirectoryButton::setCaption(const QString& caption)
 {
   CTK_D(ctkDirectoryButton);
-  d->Caption = captionTitle;
+  d->DialogCaption = caption;
 }
 
 //-----------------------------------------------------------------------------
 const QString& ctkDirectoryButton::caption()const
 {
   CTK_D(const ctkDirectoryButton);
-  return d->Caption;
+  return d->DialogCaption;
 }
 
 //-----------------------------------------------------------------------------
 void ctkDirectoryButton::ctkDirectoryButton::setOptions(const Options& dialogOptions)
 {
   CTK_D(ctkDirectoryButton);
-  d->_Options = dialogOptions;
+  d->DialogOptions = dialogOptions;
 }
 
 //-----------------------------------------------------------------------------
 const ctkDirectoryButton::Options& ctkDirectoryButton::options()const
 {
   CTK_D(const ctkDirectoryButton);
-  return d->_Options;
+  return d->DialogOptions;
 }
 
 //-----------------------------------------------------------------------------
 void ctkDirectoryButton::browse()
 {
   CTK_D(ctkDirectoryButton);
-  QString directory = 
+  QString dir = 
     QFileDialog::getExistingDirectory(
       this, 
-      d->Caption.isEmpty() ? this->toolTip() : d->Caption, 
-      this->text(), 
-      QFlags<QFileDialog::Option>(int(d->_Options)));
-  if (directory.isEmpty())
+      d->DialogCaption.isEmpty() ? this->toolTip() : d->DialogCaption, 
+      d->Directory.path(), 
+      QFlags<QFileDialog::Option>(int(d->DialogOptions)));
+  // An empty directory means that the user cancelled the dialog.
+  if (dir.isEmpty())
     {
     return;
     }
-  this->setText(directory);
-  emit directoryChanged(directory);
+  this->setDirectory(dir);
 }

+ 14 - 4
Libs/Widgets/ctkDirectoryButton.h

@@ -22,7 +22,7 @@
 #define __ctkDirectoryButton_h
 
 // Qt includes
-#include <QPushButton>
+#include <QDir>
 #include <QFileDialog>
 
 // CTK includes
@@ -30,9 +30,10 @@
 #include "CTKWidgetsExport.h"
 class ctkDirectoryButtonPrivate;
 
-class CTK_WIDGETS_EXPORT ctkDirectoryButton: public QPushButton
+class CTK_WIDGETS_EXPORT ctkDirectoryButton: public QWidget
 {
   Q_OBJECT
+  Q_PROPERTY(QString directory READ directory WRITE setDirectory)
   Q_PROPERTY(QString caption READ caption WRITE setCaption)
   Q_PROPERTY(Options options READ options WRITE setOptions)
   // QFileDialog::Options is not a meta-type, we need to create our own.
@@ -53,9 +54,15 @@ public:
   Q_DECLARE_FLAGS(Options, Option)
     
   ctkDirectoryButton(QWidget * parent = 0);
-  ctkDirectoryButton(const QString & text, QWidget * parent = 0);
-  ctkDirectoryButton(const QIcon & icon, const QString & text, QWidget * parent = 0);
+  ctkDirectoryButton(const QString& directory, QWidget * parent = 0);
+  ctkDirectoryButton(const QIcon& icon, const QString& directory, QWidget * parent = 0);
 
+  void setDirectory(const QString& directory);
+  QString directory()const;
+  
+  ///
+  /// The title of the file dialog used to select a new directory
+  /// If caption is not set, internally use QWidget::tooltip()
   void setCaption(const QString& caption);
   const QString& caption()const;
   
@@ -66,6 +73,9 @@ public slots:
   void browse();
 
 signals:
+  ///
+  /// directoryChanged is emitted when the current directory changes
+  ///if you want a directoryChanged signal as a utility. Feel free to add it
   void directoryChanged(const QString&);
 
 private:

+ 6 - 14
SuperBuild.cmake

@@ -44,14 +44,6 @@ ENDIF()
 # Use this value where semi-colons are needed in ep_add args:
 set(sep "^^")
 
-# Find the git executable, used for custom git commands for external projects
-# (e.g. for QtMobility)
-find_program(Git_EXECUTABLE git DOC "git command line client")
-mark_as_advanced(Git_EXECUTABLE)
-if(NOT Git_EXECUTABLE)
-  message(SEND_ERROR "Set Git_EXECUTABLE to the path of your git executable")
-endif()
-
 #-----------------------------------------------------------------------------
 # Update CMake module path
 #
@@ -197,9 +189,9 @@ IF(${add_project})
   SET(qtmobility_patch_dir ${CTK_SOURCE_DIR}/Utilities/QtMobility/)
   SET(qtmobility_configured_patch_dir ${CTK_BINARY_DIR}/Utilities/QtMobility/)
   SET(qtmobility_patchscript
-    ${CTK_BINARY_DIR}/Utilities/QtMobility/QtMobilityGitBranch1.0-patch.cmake)
+    ${CTK_BINARY_DIR}/Utilities/QtMobility/QtMobility-1.0.0-patch.cmake)
   CONFIGURE_FILE(
-    ${CTK_SOURCE_DIR}/Utilities/QtMobility/QtMobilityGitBranch1.0-patch.cmake.in
+    ${CTK_SOURCE_DIR}/Utilities/QtMobility/QtMobility-1.0.0-patch.cmake.in
     ${qtmobility_patchscript} @ONLY)
 
   # Define configure options
@@ -221,13 +213,12 @@ IF(${add_project})
   ENDIF()
 
   ExternalProject_Add(${proj}
-    GIT_REPOSITORY git://gitorious.org/qt-mobility/qt-mobility.git
-    # the patch command is also used to checkout the 1.0 branch    
+    URL ${CTK_BINARY_DIR}/Utilities/QtMobility/qt-mobility-servicefw-opensource-src-1.0.0.tar.gz
     PATCH_COMMAND ${CMAKE_COMMAND} -P ${qtmobility_patchscript}
     CONFIGURE_COMMAND <SOURCE_DIR>/configure -${qtmobility_build_type} -libdir ${CMAKE_BINARY_DIR}/CTK-build/bin -no-docs -modules ${qtmobility_modules}
     BUILD_COMMAND ${qtmobility_make_cmd}
     INSTALL_COMMAND ${qtmobility_make_cmd} install
-	  BUILD_IN_SOURCE 1
+    BUILD_IN_SOURCE 1
     )
 ENDIF()
 
@@ -312,8 +303,9 @@ ExternalProject_Add(${proj}
   INSTALL_COMMAND ""
   DEPENDS
     # Mandatory dependencies
-    ${QtMobility_DEPENDS}
+    #  - none
     # Optionnal dependencies
+    ${QtMobility_DEPENDS}
     ${kwstyle_DEPENDS}
     ${DCMTK_DEPENDS}
     ${PythonQt_DEPENDS}

+ 44 - 0
Utilities/QtMobility/QtMobility-1.0.0-apple.patch

@@ -0,0 +1,44 @@
+*** ../qt-mobility-src-1.0.0-beta1/configure	2010-02-12 03:54:12.000000000 -0500
+--- configure	2010-03-24 18:51:06.000000000 -0400
+***************
+*** 413,423 ****
+  }
+  
+  #compile tests
+! compileTest QMF qmf
+! compileTest NetworkManager networkmanager
+! compileTest "CoreWLAN (MacOS 10.6)" corewlan
+! compileTest "Maemo ICD" maemo-icd
+! compileTest "Maemo ICD WLAN" maemo-icd-network-wlan
+  
+  # Now module selection
+  # using 'expr match ....' should help a bit
+--- 413,423 ----
+  }
+  
+  #compile tests
+! #compileTest QMF qmf
+! #compileTest NetworkManager networkmanager
+! #compileTest "CoreWLAN (MacOS 10.6)" corewlan
+! #compileTest "Maemo ICD" maemo-icd
+! #compileTest "Maemo ICD WLAN" maemo-icd-network-wlan
+  
+  # Now module selection
+  # using 'expr match ....' should help a bit
+***************
+*** 493,499 ****
+  fi
+  
+  echo "Running qmake..."
+! if qmake -recursive "$relpath/qtmobility.pro"; then
+      echo ""
+      echo "configure has finished. You may run make or gmake to build the project now."
+  else
+--- 493,499 ----
+  fi
+  
+  echo "Running qmake..."
+! if qmake -spec macx-g++ -recursive "$relpath/qtmobility.pro"; then
+      echo ""
+      echo "configure has finished. You may run make or gmake to build the project now."
+  else

+ 62 - 0
Utilities/QtMobility/QtMobility-1.0.0-patch.cmake.in

@@ -0,0 +1,62 @@
+# the patch step is run before the update step
+# so we need to checkout the 1.0 branch here
+
+set(work_dir @ep_source_dir@)
+set(proj_dir ${work_dir}/@proj@)
+
+
+INCLUDE(@CTK_SOURCE_DIR@/CMake/ctkMacroApplyPatches.cmake)
+
+SET(patch_dir @qtmobility_patch_dir@)
+SET(configured_patch_dir @qtmobility_configured_patch_dir@)
+
+# Variable required to properly configured the patch files
+SET(QT_BINARY_DIR @QT_BINARY_DIR@)
+
+SET(patch_files
+  QtMobility-1.0.0.patch
+)
+
+IF(WIN32)
+  CONFIGURE_FILE(${patch_dir}/QtMobility-1.0.0-win32.patch.in
+    ${configured_patch_dir}/QtMobility-1.0.0-win32.patch @ONLY)
+  LIST(APPEND patch_files
+    ${configured_patch_dir}/QtMobility-1.0.0-win32.patch
+    )
+ENDIF()
+
+IF(UNIX)
+  IF(APPLE)
+    LIST(APPEND patch_files ${patch_dir}/QtMobility-1.0.0-apple.patch)
+  ENDIF()
+ENDIF()
+
+# Apply patches
+ctkMacroApplyPatches("@CTK_PATCH_EXECUTABLE@" "@qtmobility_src_dir@" "${patch_files}")
+
+IF(UNIX)
+
+  # replace all occurences of 'qmake' with the aboslute path to the
+  # qmake executable found by CMake.
+  # This is neccessary for custom Qt builds and for Unix/Linux systems
+  # which use another name for the Qt4 qmake program (e.g. qmake-qt4)
+
+  EXECUTE_PROCESS(
+    COMMAND sed -i "s+qmake +@QT_QMAKE_EXECUTABLE@ +g" configure
+    WORKING_DIRECTORY ${proj_dir}
+    RESULT_VARIABLE error_code
+  )
+
+  IF(error_code)
+    MESSAGE(FATAL_ERROR "Patching ${proj_dir}/configure file failed.")
+  ENDIF()
+ENDIF()
+
+# Let's add the updated files to the local repository. That way, 'git pull'
+# will try to merge the branch changes with the local ones
+execute_process(
+  COMMAND @Git_EXECUTABLE@ add --all
+  WORKING_DIRECTORY ${proj_dir}
+  ERROR_VARIABLE error_output
+  RESULT_VARIABLE error_code
+  )

+ 31 - 0
Utilities/QtMobility/QtMobility-1.0.0-win32.patch.in

@@ -0,0 +1,31 @@
+--- C:/development/CTK-master-vc9/CMakeExternals/Source/QtMobility/configure_orig.bat	Sun Apr 11 18:17:43 2010
++++ C:/development/CTK-master-vc9/CMakeExternals/Source/QtMobility/configure.bat	Sun Apr 11 21:19:33 2010
+@@ -60,7 +60,7 @@
+ set MOBILITY_MODULES=bearer location contacts multimedia publishsubscribe versit messaging systeminfo serviceframework sensors
+ set MOBILITY_MODULES_UNPARSED=
+ set VC_TEMPLATE_OPTION=
+-set QT_PATH=
++set QT_PATH=@QT_BINARY_DIR@\
+ set QMAKE_CACHE=%BUILD_PATH%\.qmake.cache
+ 
+ if exist "%QMAKE_CACHE%" del %QMAKE_CACHE%
+@@ -457,10 +457,15 @@
+ echo.
+ echo Start of compile tests
+ REM compile tests go here.
+-call :compileTest LBT lbt
+-call :compileTest SNAP snap
+-call :compileTest OCC occ
+-call :compileTest SymbianContactSIM symbiancntsim
++REM for CTK the compile tests generate errors in Visual Studio -> just disabling them
++REM call :compileTest LBT lbt
++echo lbt_enabled = no >> %PROJECT_CONFIG%
++REM call :compileTest SNAP snap
++echo snap_enabled = no >> %PROJECT_CONFIG%
++REM call :compileTest OCC occ
++echo occ_enabled = no >> %PROJECT_CONFIG%
++REM call :compileTest SymbianContactSIM symbiancntsim
++echo symbiancntsim_enabled = no >> %PROJECT_CONFIG%
+ echo End of compile tests
+ echo.
+ echo.

+ 10 - 0
Utilities/QtMobility/QtMobility-1.0.0.patch

@@ -0,0 +1,10 @@
+--- /home/sascha/Downloads/qt-mobility-opensource-src-1.0.0/qtmobility.pro	2010-04-21 16:17:35.000000000 +0200
++++ qtmobility.pro	2010-05-04 00:42:06.776482243 +0200
+@@ -100,7 +100,6 @@
+     SUBDIRS += tools
+ }
+ 
+-SUBDIRS += plugins
+ 
+ #built documentation snippets, if enabled
+ contains(build_docs, yes) {

BIN
Utilities/QtMobility/qt-mobility-servicefw-opensource-src-1.0.0.tar.gz