packages feed

qtah-cpp-qt5 0.2.0 → 0.3.0

raw patch · 17 files changed

+105/−74 lines, 17 filesdep ~qtah-generatorsetup-changed

Dependency ranges changed: qtah-generator

Files

Setup.hs view
@@ -1,6 +1,6 @@ -- This file is part of Qtah. ----- Copyright 2016 Bryan Gardiner <bog@khumba.net>+-- Copyright 2015-2017 The Qtah Authors. -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU Lesser General Public License as published by@@ -18,7 +18,7 @@ {-# OPTIONS_GHC -W -fwarn-incomplete-patterns -fwarn-unused-do-bind #-}  import Control.Applicative ((<|>))-import Control.Monad (forM_, unless, when)+import Control.Monad (unless, when) import Data.Char (isDigit) import Data.List (isPrefixOf, isSuffixOf) import Data.Maybe (fromMaybe)@@ -46,6 +46,7 @@   CleanFlags,   ConfigFlags,   CopyDest (CopyTo, NoCopyDest),+  buildNumJobs,   buildVerbosity,   cleanVerbosity,   configConfigurationsFlags,@@ -70,10 +71,8 @@ import Distribution.Simple.Utils (   die,   info,-  installExecutableFile,   installOrdinaryFile,   notice,-  warn,   ) import Distribution.Verbosity (Verbosity, normal) import System.Directory (@@ -84,10 +83,8 @@   setCurrentDirectory,   removeFile,   )-import System.IO.Error (catchIOError, isDoesNotExistError) import System.Environment (lookupEnv, setEnv) import System.FilePath ((</>), takeDirectory)-import System.Posix (createSymbolicLink, getSymbolicLinkStatus) import System.Process (callProcess)  packageName :: String@@ -100,7 +97,8 @@ qtahHooks :: UserHooks qtahHooks = simpleUserHooks   { hookedPrograms = [generatorProgram, listenerGenProgram, makeProgram]-  , postConf = \_ cf _ lbi -> do generateSources cf lbi+  , postConf = \args cf pd lbi -> do generateSources cf lbi+                                     postConf simpleUserHooks args cf pd lbi   , buildHook = \pd lbi uh bf -> do doBuild lbi bf                                     buildHook simpleUserHooks pd lbi uh bf   , copyHook = \pd lbi uh cf -> do let verbosity = fromFlagOrDefault normal $ copyVerbosity cf@@ -167,50 +165,26 @@       verbosity = fromFlagOrDefault normal $ buildVerbosity buildFlags    -- Determine how many parallel build jobs to use.-  ---  -- TODO Eventually require Cabal >=1.20 and use BuildFlags.numBuildJobs-  -- instead.-  numJobsStr <- lookupEnv "QTAH_BUILD_JOBS"-  (makeArgs, jobMsg) <- case numJobsStr of-    Nothing -> return ([], "")-    Just "" -> return ([], "")-    Just s ->-      if all isDigit s-      then do let n = read s :: Int-              return (["-j" ++ show n],-                      concat [" with ", show n, if n == 1 then " job" else " jobs"])-      else do warn verbosity $ concat-                [packageName, ": Unknown QTAH_BUILD_JOBS=", show s,-                 ", expected a positive integer."]-              return ([], "")+  let (makeArgs, jobMsg) = case flagToMaybe $ buildNumJobs buildFlags of+        Nothing -> ([], "")+        Just Nothing -> (["-j"], " with unlimited jobs")+        Just (Just n) -> (["-j" ++ show n],+                          " with " ++ show n ++ if n == 1 then " job" else " jobs") -  setCurrentDirectory cppSourceDir   notice verbosity $ concat ["Building the Qtah C++ library", jobMsg, "..."]-  runDbProgram verbosity makeProgram programDb makeArgs--  setCurrentDirectory startDir+  runDbProgram verbosity makeProgram programDb $ "-C" : cppSourceDir : makeArgs  doInstall :: Verbosity -> PackageDescription -> LocalBuildInfo -> CopyDest -> IO () doInstall verbosity packageDesc localBuildInfo copyDest = do   startDir <- getCurrentDirectory   let cppSourceDir = startDir </> "cpp"       libDir = libdir $ absoluteInstallDirs packageDesc localBuildInfo copyDest+      programDb = withPrograms localBuildInfo -  -- Install the built library into the package's libdir.-  createDirectoryIfMissing True libDir-  forM_ ["libqtah.so", "libqtah.so.0", "libqtah.so.0.2", "libqtah.so.0.2.0"] $ \p -> do-    let path = libDir </> p-    shouldDelete <--      catchIOError (do _ <- getSymbolicLinkStatus path-                       return True)-      (\e -> if isDoesNotExistError e then return False else ioError e)-    when shouldDelete $ removeFile path-  installExecutableFile verbosity-                        (cppSourceDir </> "libqtah.so.0.2.0")-                        (libDir </> "libqtah.so.0.2.0")-  createSymbolicLink "libqtah.so.0.2.0" (libDir </> "libqtah.so.0.2")-  createSymbolicLink "libqtah.so.0.2" (libDir </> "libqtah.so.0")-  createSymbolicLink "libqtah.so.0" (libDir </> "libqtah.so")+  -- Call the makefile to install the C++ shared library into the package's+  -- libdir.+  runDbProgram verbosity makeProgram programDb+    ["-C", cppSourceDir, "install", "INSTALL_ROOT=" ++ libDir]    -- Also record what version of Qt we are using, so that qtah can check that   -- it's using the same version.@@ -230,7 +204,7 @@     filter (\file ->               "b_" `isPrefixOf` file ||               "moc_" `isPrefixOf` file ||-              "libqtah.so" `isPrefixOf` file ||+              "libqtah" `isPrefixOf` file ||               ".o" `isSuffixOf` file ||               file `elem` ["Makefile",                            "callback.cpp", "callback.hpp",
cpp/encode.cpp view
@@ -1,6 +1,6 @@ // This file is part of Qtah. //-// Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by
cpp/encode.hpp view
@@ -3,7 +3,7 @@  // This file is part of Qtah. //-// Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by
cpp/event.hpp view
@@ -3,7 +3,7 @@  // This file is part of Qtah. //-// Copyright 2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by@@ -19,6 +19,11 @@ // along with this program.  If not, see <http://www.gnu.org/licenses/>.  #include <QEvent>+#include <QGraphicsItem>+#include <QObject>+#include <QPainter>+#include <QStyleOptionGraphicsItem>+#include <QWidget> #include "b_callback.hpp"  namespace qtah {@@ -28,22 +33,74 @@     Q_OBJECT  public:-    EventListener(CallbackPtrQObjectPtrQEventBool callback, int* deletedPtr) :-        callback_(callback), deleted_(deletedPtr) {}+    EventListener(+        QObject *parent,+        CallbackPtrQObjectPtrQEventBool eventCallback,+        CallbackVoid deletedCallback) :+        QObject(parent),+        eventCallback_(eventCallback),+        deletedCallback_(deletedCallback),+        notifyDeleted_(true) {+        parent->installEventFilter(this);+    }      ~EventListener() {-        if (deleted_) {-            *deleted_ = 1;+        parent()->removeEventFilter(this);+        if (notifyDeleted_) {+            deletedCallback_();         }     }      virtual bool eventFilter(QObject* receiver, QEvent* event) {-        return callback_(receiver, event);+        return eventCallback_(receiver, event);     } +    void doNotNotifyOnDelete() {+        notifyDeleted_ = false;+    }+ private:-    CallbackPtrQObjectPtrQEventBool callback_;-    int* deleted_;+    CallbackPtrQObjectPtrQEventBool eventCallback_;+    CallbackVoid deletedCallback_;+    bool notifyDeleted_;+};++class SceneEventListener : public QGraphicsItem {++public:+    SceneEventListener(+        QGraphicsItem *parent,+        CallbackPtrQGraphicsItemPtrQEventBool eventCallback,+        CallbackVoid deletedCallback) :+        QGraphicsItem(parent),+        eventCallback_(eventCallback),+        deletedCallback_(deletedCallback),+        notifyDeleted_(true) {+        parent->installSceneEventFilter(this);+    }++    ~SceneEventListener() {+        parentItem()->removeSceneEventFilter(this);+        if (notifyDeleted_) {+            deletedCallback_();+        }+    }++    virtual bool sceneEventFilter(QGraphicsItem* receiver, QEvent* event) {+        return eventCallback_(receiver, event);+    }++    void doNotNotifyOnDelete() {+        notifyDeleted_ = false;+    }++    virtual QRectF boundingRect() const { return QRectF(); }+    virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget* = 0) { return; }++private:+    CallbackPtrQGraphicsItemPtrQEventBool eventCallback_;+    CallbackVoid deletedCallback_;+    bool notifyDeleted_; };  }  // namespace event
cpp/qtah.pro view
@@ -1,6 +1,6 @@ # This file is part of Qtah. #-# Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+# Copyright 2015-2017 The Qtah Authors. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by@@ -21,10 +21,12 @@  TARGET = qtah TEMPLATE = lib-VERSION = 0.2.0+VERSION = 0.3.0 # Doesn't seem to work here: CONFIG += c++11 QMAKE_CXXFLAGS += -std=c++11 +mac:QMAKE_SONAME_PREFIX = @rpath+ SOURCES += \     $$files(b_*.cpp) \     $$files(wrap_*.cpp) \@@ -38,8 +40,5 @@     event.hpp \     listener.hpp -isEmpty( PREFIX ) {-  PREFIX=/usr/local-}-target.path = $${PREFIX}/lib+target.path = / INSTALLS += target
cpp/wrap_qapplication.cpp view
@@ -1,6 +1,6 @@ // This file is part of Qtah. //-// Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by
cpp/wrap_qapplication.hpp view
@@ -3,7 +3,7 @@  // This file is part of Qtah. //-// Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by
cpp/wrap_qcoreapplication.cpp view
@@ -1,6 +1,6 @@ // This file is part of Qtah. //-// Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by
cpp/wrap_qcoreapplication.hpp view
@@ -3,7 +3,7 @@  // This file is part of Qtah. //-// Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by
cpp/wrap_qformlayout.cpp view
@@ -1,6 +1,6 @@ // This file is part of Qtah. //-// Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by
cpp/wrap_qformlayout.hpp view
@@ -3,7 +3,7 @@  // This file is part of Qtah. //-// Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by
cpp/wrap_qgridlayout.cpp view
@@ -1,6 +1,6 @@ // This file is part of Qtah. //-// Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by
cpp/wrap_qgridlayout.hpp view
@@ -3,7 +3,7 @@  // This file is part of Qtah. //-// Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by
cpp/wrap_qstring.cpp view
@@ -1,6 +1,6 @@ // This file is part of Qtah. //-// Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by
cpp/wrap_qstring.hpp view
@@ -3,7 +3,7 @@  // This file is part of Qtah. //-// Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+// Copyright 2015-2017 The Qtah Authors. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by
qtah-cpp-qt5.cabal view
@@ -1,15 +1,16 @@ name: qtah-cpp-qt5-version: 0.2.0+version: 0.3.0 synopsis: Qt bindings for Haskell - C++ library homepage: http://khumba.net/projects/qtah license: LGPL-3 license-files: LICENSE.GPL, LICENSE.LGPL author: Bryan Gardiner <bog@khumba.net> maintainer: Bryan Gardiner <bog@khumba.net>-copyright: Copyright 2015-2016 Bryan Gardiner+copyright: Copyright 2015-2017 The Qtah Authors. category: Graphics build-type: Custom-cabal-version: >=1.10+-- Cabal 1.20 is needed for BuildFlags.buildNumJobs.+cabal-version: >=1.20 description:   Qtah is a set of Qt bindings for Haskell.  This package contains the C++ side   of the bindings.@@ -37,5 +38,5 @@   build-depends:       base >=4 && <5     , process >=1.2 && <1.5-    , qtah-generator >=0.2 && <0.3+    , qtah-generator >=0.3 && <0.4   ghc-options: -W -fwarn-incomplete-patterns -fwarn-unused-do-bind
src/Graphics/UI/Qtah/NothingToSeeHere.hs view
@@ -1,6 +1,6 @@ -- This file is part of Qtah. ----- Copyright 2016 Bryan Gardiner <bog@khumba.net>+-- Copyright 2015-2017 The Qtah Authors. -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU Lesser General Public License as published by