Add QThread.

parent c562ebd9
......@@ -88,6 +88,7 @@ executable qtah-generator
, Graphics.UI.Qtah.Generator.Interface.Core.QStringList
, Graphics.UI.Qtah.Generator.Interface.Core.QStringListModel
, Graphics.UI.Qtah.Generator.Interface.Core.QTextCodec
, Graphics.UI.Qtah.Generator.Interface.Core.QThread
, Graphics.UI.Qtah.Generator.Interface.Core.QTimer
, Graphics.UI.Qtah.Generator.Interface.Core.QTimerEvent
, Graphics.UI.Qtah.Generator.Interface.Core.QVariant
......
......@@ -53,6 +53,7 @@ import qualified Graphics.UI.Qtah.Generator.Interface.Core.QString as QString
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QStringList as QStringList
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QStringListModel as QStringListModel
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QTextCodec as QTextCodec
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QThread as QThread
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QTimer as QTimer
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QTimerEvent as QTimerEvent
import qualified Graphics.UI.Qtah.Generator.Interface.Core.QVariant as QVariant
......@@ -100,6 +101,7 @@ modules =
, QStringList.aModule
, QStringListModel.aModule
, QTextCodec.aModule
, QThread.aModule
, QTimer.aModule
, QTimerEvent.aModule
, QVariant.aModule
......
......@@ -40,10 +40,6 @@ import Foreign.Hoppy.Generator.Spec (
import Foreign.Hoppy.Generator.Types (boolT, constT, intT, objT, ptrT, refT, voidT)
import Foreign.Hoppy.Generator.Version (collect, just, test)
import Graphics.UI.Qtah.Generator.Flags (qtVersion)
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Internal.Listener (
c_ListenerPtrQObject,
c_ListenerQString,
)
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Core.QList (
c_QListQByteArray,
c_QListQObject,
......@@ -51,7 +47,12 @@ import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Core.QList (
import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent)
import Graphics.UI.Qtah.Generator.Interface.Core.QMetaObject (c_QMetaObject)
import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Core.QThread (c_QThread)
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Core.QVariant (c_QVariant)
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Internal.Listener (
c_ListenerPtrQObject,
c_ListenerQString,
)
import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)
import Graphics.UI.Qtah.Generator.Types
......@@ -92,7 +93,7 @@ c_QObject =
test (qtVersion >= [5, 0]) $ mkConstMethod "isWindowType" [] boolT
, just $ mkMethod "killTimer" [intT] voidT
, just $ mkConstMethod "metaObject" [] $ ptrT $ constT $ objT c_QMetaObject
-- TODO moveToThread
, just $ mkMethod "moveToThread" [ptrT $ objT c_QThread] voidT
, just $ mkProp "objectName" $ objT c_QString
, just $ mkProp "parent" $ ptrT $ objT c_QObject
, just $ makeFnMethod (ident2 "qtah" "qobject" "property") "property" MConst Nonpure
......@@ -102,7 +103,7 @@ c_QObject =
[refT $ objT c_QObject, objT c_QString, objT c_QVariant] voidT
, just $ mkConstMethod "signalsBlocked" [] boolT
, just $ mkMethod "startTimer" [intT] intT
-- TODO thread
, just $ mkConstMethod "thread" [] $ ptrT $ objT c_QThread
]
signals =
......
-- This file is part of Qtah.
--
-- Copyright 2015-2018 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
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
module Graphics.UI.Qtah.Generator.Interface.Core.QThread (
aModule,
c_QThread,
) where
import Foreign.Hoppy.Generator.Spec (
Export (ExportClass, ExportEnum),
addReqIncludes,
classSetEntityPrefix,
ident,
ident1,
includeStd,
makeClass,
mkConstMethod,
mkCtor,
mkMethod,
mkMethod',
mkProp,
mkStaticMethod,
)
import Foreign.Hoppy.Generator.Types (boolT, enumT, intT, objT, ptrT, uintT, ulongT, voidT)
import Foreign.Hoppy.Generator.Version (collect, just, test)
import Graphics.UI.Qtah.Generator.Flags (qtVersion)
import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject)
import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_Listener)
import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)
import Graphics.UI.Qtah.Generator.Types
{-# ANN module "HLint: ignore Use camelCase" #-}
aModule =
AQtModule $
makeQtModule ["Core", "QThread"] $
QtExport (ExportClass c_QThread) :
map QtExportSignal signals ++
[ QtExport $ ExportEnum e_Priority
]
c_QThread =
addReqIncludes [includeStd "QThread"] $
classSetEntityPrefix "" $
makeClass (ident "QThread") Nothing [c_QObject] $
collect
[ just $ mkCtor "new" []
, just $ mkCtor "newWithParent" [ptrT $ objT c_QObject]
-- TODO eventDispatcher property
, just $ mkMethod' "exit" "exit" [] voidT
, just $ mkMethod' "exit" "exitWithCode" [intT] voidT
, just $ mkConstMethod "isFinished" [] boolT
, test (qtVersion >= [5, 2]) $ mkConstMethod "isInterruptionRequested" [] boolT
, just $ mkConstMethod "isRunning" [] boolT
, test (qtVersion >= [5, 5]) $ mkConstMethod "loopLevel" [] intT
, just $ mkProp "priority" $ enumT e_Priority
, just $ mkMethod "quit" [] voidT
, test (qtVersion >= [5, 2]) $ mkMethod "requestInterruption" [] voidT
, just $ mkProp "stackSize" uintT
, just $ mkMethod' "start" "start" [] voidT
, just $ mkMethod' "start" "startWithPriority" [enumT e_Priority] voidT
, just $ mkMethod "terminate" [] voidT
, just $ mkMethod' "wait" "wait" [] voidT
, just $ mkMethod' "wait" "waitWithMillis" [ulongT] voidT
-- Static methods.
, just $ mkStaticMethod "currentThread" [] $ ptrT $ objT c_QThread
-- TODO currentThreadId
, just $ mkStaticMethod "idealThreadCount" [] intT
, just $ mkStaticMethod "msleep" [ulongT] voidT
, just $ mkStaticMethod "sleep" [ulongT] voidT
, just $ mkStaticMethod "usleep" [ulongT] voidT
, just $ mkStaticMethod "yieldCurrentThread" [] voidT
]
signals =
[ makeSignal c_QThread "finished" c_Listener
, makeSignal c_QThread "started" c_Listener
]
e_Priority =
makeQtEnum (ident1 "QThread" "Priority") [includeStd "QThread"]
[ (0, ["idle", "priority"])
, (1, ["lowest", "priority"])
, (2, ["low", "priority"])
, (3, ["normal", "priority"])
, (4, ["high", "priority"])
, (5, ["highest", "priority"])
, (6, ["time", "critical", "priority"])
, (7, ["inherit", "priority"])
]
-- This file is part of Qtah.
--
-- Copyright 2015-2018 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
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
module Graphics.UI.Qtah.Generator.Interface.Core.QThread (
c_QThread,
) where
import Foreign.Hoppy.Generator.Spec (Class)
{-# ANN module "HLint: ignore Use camelCase" #-}
c_QThread :: Class
......@@ -75,6 +75,7 @@ library
, Graphics.UI.Qtah.Core.QStringList
, Graphics.UI.Qtah.Core.QStringListModel
, Graphics.UI.Qtah.Core.QTextCodec
, Graphics.UI.Qtah.Core.QThread
, Graphics.UI.Qtah.Core.QTimer
, Graphics.UI.Qtah.Core.QTimerEvent
, Graphics.UI.Qtah.Core.QVariant
......@@ -250,6 +251,7 @@ library
, Graphics.UI.Qtah.Generated.Core.QStringList
, Graphics.UI.Qtah.Generated.Core.QStringListModel
, Graphics.UI.Qtah.Generated.Core.QTextCodec
, Graphics.UI.Qtah.Generated.Core.QThread
, Graphics.UI.Qtah.Generated.Core.QTimer
, Graphics.UI.Qtah.Generated.Core.QTimerEvent
, Graphics.UI.Qtah.Generated.Core.QVariant
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment