| Job.h | | Job.h | |
| /* -*- C++ -*- | | /* -*- C++ -*- | |
| | | | |
| This file declares the Job class. | | This file declares the Job class. | |
| | | | |
| $ Author: Mirko Boehm $ | | $ Author: Mirko Boehm $ | |
|
| $ Copyright: (C) 2004, 2005, 2006 Mirko Boehm $ | | $ Copyright: (C) 2004-2013 Mirko Boehm $ | |
| $ Contact: mirko@kde.org | | $ Contact: mirko@kde.org | |
| http://www.kde.org | | http://www.kde.org | |
|
| http://www.hackerbuero.org $ | | http://creative-destruction.me $ | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 134 | | skipping to change at line 134 | |
| method to abort a processing Job. Not even a default boolean fl
ag | | method to abort a processing Job. Not even a default boolean fl
ag | |
| makes sense, as Job could, for example, be in an event loop and | | makes sense, as Job could, for example, be in an event loop and | |
| will need to create an exit event. | | will need to create an exit event. | |
| You have to reimplement the method to actually initiate an abor
t | | You have to reimplement the method to actually initiate an abor
t | |
| action. | | action. | |
| The method is not pure virtual because users are not supposed t
o | | The method is not pure virtual because users are not supposed t
o | |
| be forced to always implement requestAbort(). | | be forced to always implement requestAbort(). | |
| Also, this method is supposed to return immediately, not after
the | | Also, this method is supposed to return immediately, not after
the | |
| abort has completed. It requests the abort, the Job has to act
on | | abort has completed. It requests the abort, the Job has to act
on | |
| the request. */ | | the request. */ | |
|
| // FIXME (Mirko) this should be private, I guess? | | | |
| virtual void requestAbort () {} | | virtual void requestAbort () {} | |
| | | | |
| /** The job is about to be added to the weaver's job queue. | | /** The job is about to be added to the weaver's job queue. | |
| The job will be added right after this method finished. The | | The job will be added right after this method finished. The | |
| default implementation does nothing. | | default implementation does nothing. | |
| Use this method to, for example, queue sub-operations as jobs | | Use this method to, for example, queue sub-operations as jobs | |
| before the job itself is queued. | | before the job itself is queued. | |
| | | | |
| Note: When this method is called, the associated Weaver object'
s | | Note: When this method is called, the associated Weaver object'
s | |
| thread holds a lock on the weaver's queue. Therefore, it is sav
e | | thread holds a lock on the weaver's queue. Therefore, it is sav
e | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 2 lines changed or added | |
|
| Thread.h | | Thread.h | |
| /* -*- C++ -*- | | /* -*- C++ -*- | |
| | | | |
| This file declares the Thread class. | | This file declares the Thread class. | |
| | | | |
| Thread is not a part of the public interface of the ThreadWeaver library
. | | Thread is not a part of the public interface of the ThreadWeaver library
. | |
| | | | |
| $ Author: Mirko Boehm $ | | $ Author: Mirko Boehm $ | |
|
| $ Copyright: (C) 2004, 2005, 2006 Mirko Boehm $ | | $ Copyright: (C) 2004-2013 Mirko Boehm $ | |
| $ Contact: mirko@kde.org | | $ Contact: mirko@kde.org | |
| http://www.kde.org | | http://www.kde.org | |
|
| http://www.hackerbuero.org $ | | http://creative-destruction.me $ | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 43 | |
| | | | |
| #include <QtCore/QMutex> | | #include <QtCore/QMutex> | |
| #include <QtCore/QThread> | | #include <QtCore/QThread> | |
| | | | |
| #include <threadweaver/threadweaver_export.h> | | #include <threadweaver/threadweaver_export.h> | |
| | | | |
| namespace ThreadWeaver { | | namespace ThreadWeaver { | |
| | | | |
| class Job; | | class Job; | |
| class WeaverImpl; | | class WeaverImpl; | |
|
| class ThreadRunHelper; | | | |
| | | | |
| /** The class Thread is used to represent the worker threads in | | /** The class Thread is used to represent the worker threads in | |
| the weaver's inventory. It is not meant to be overloaded. */ | | the weaver's inventory. It is not meant to be overloaded. */ | |
| class THREADWEAVER_EXPORT Thread : public QThread | | class THREADWEAVER_EXPORT Thread : public QThread | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
| public: | | public: | |
| /** Create a thread. | | /** Create a thread. | |
| These thread objects are only used inside the Weaver parent | | These thread objects are only used inside the Weaver parent | |
| | | | |
| skipping to change at line 71 | | skipping to change at line 70 | |
| ~Thread(); | | ~Thread(); | |
| | | | |
| /** Overload to execute the assigned jobs. | | /** Overload to execute the assigned jobs. | |
| Whenever the thread is idle, it will ask its Weaver parent for a | | Whenever the thread is idle, it will ask its Weaver parent for a | |
| Job to do. The Weaver will either return a Job or a Nil | | Job to do. The Weaver will either return a Job or a Nil | |
| pointer. When a Nil pointer is returned, it tells the thread to | | pointer. When a Nil pointer is returned, it tells the thread to | |
| exit. | | exit. | |
| */ | | */ | |
| void run(); | | void run(); | |
| | | | |
|
| // FIXME (0.7) provide usleep and sleep, too | | | |
| /** Provide the msleep() method (protected in QThread) to be | | /** Provide the msleep() method (protected in QThread) to be | |
| available for executed jobs. | | available for executed jobs. | |
| @param msec amount of milliseconds | | @param msec amount of milliseconds | |
| */ | | */ | |
| void msleep ( unsigned long msec ); | | void msleep ( unsigned long msec ); | |
| | | | |
| /** Returns the thread id. | | /** Returns the thread id. | |
| This id marks the respective Thread object, and must | | This id marks the respective Thread object, and must | |
| therefore not be confused with, e.g., the pthread thread | | therefore not be confused with, e.g., the pthread thread | |
| ID. | | ID. | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 2 lines changed or added | |
|
| ThreadWeaver.h | | ThreadWeaver.h | |
| /* -*- C++ -*- | | /* -*- C++ -*- | |
| | | | |
| This file implements the public interfaces of the Weaver and the Job cla
ss. | | This file implements the public interfaces of the Weaver and the Job cla
ss. | |
| It should be the only include file necessary to use the ThreadWeaver | | It should be the only include file necessary to use the ThreadWeaver | |
| library. | | library. | |
| | | | |
| $ Author: Mirko Boehm $ | | $ Author: Mirko Boehm $ | |
|
| $ Copyright: (C) 2005, Mirko Boehm $ | | $ Copyright: (C) 2005-2013 Mirko Boehm $ | |
| $ Contact: mirko@kde.org | | $ Contact: mirko@kde.org | |
| http://www.kde.org | | http://www.kde.org | |
|
| http://www.hackerbuero.org $ | | http://creative-destruction.me $ | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| $Id: ThreadWeaver.h 32 2005-08-17 08:38:01Z mirko $ | | $Id: ThreadWeaver.h 32 2005-08-17 08:38:01Z mirko $ | |
| */ | | */ | |
| #ifndef THREADWEAVER_H | | #ifndef THREADWEAVER_H | |
| #define THREADWEAVER_H | | #define THREADWEAVER_H | |
| | | | |
| #include <QtCore/QObject> | | #include <QtCore/QObject> | |
| #include "WeaverInterface.h" | | #include "WeaverInterface.h" | |
| | | | |
| namespace ThreadWeaver { | | namespace ThreadWeaver { | |
| | | | |
|
| class Job; | | class Job; | |
| class State; | | class State; | |
| class WeaverObserver; | | class WeaverObserver; | |
| | | | |
|
| /** The Weaver class provides the public implementation of the WeaverIn
terface. | | /** The Weaver class provides the public implementation of the WeaverInterf
ace. | |
| | | | |
| Weaver provides a static instance that can be used to perform jobs
in | | Weaver provides a static instance that can be used to perform jobs
in | |
| threads without managing a weaver object. The static instance will | | threads without managing a weaver object. The static instance will | |
| only be created when it is first accessed. Also, Weaver objects wil
l | | only be created when it is first accessed. Also, Weaver objects wil
l | |
| create the threads only when the first jobs are queued. Therefore,
the | | create the threads only when the first jobs are queued. Therefore,
the | |
| creation of a Weaver object is a rather cheap operation. | | creation of a Weaver object is a rather cheap operation. | |
| | | | |
| The WeaverImpl class provides two parts of API - one for the thread
s | | The WeaverImpl class provides two parts of API - one for the thread
s | |
| that are handled by it, and one for the ThreadWeaver users | | that are handled by it, and one for the ThreadWeaver users | |
| (application developers). To separate those two different API parts
, | | (application developers). To separate those two different API parts
, | |
| | | | |
| skipping to change at line 64 | | skipping to change at line 64 | |
| of multithreaded applications. | | of multithreaded applications. | |
| | | | |
| Weaver creates and destroys WeaverImpl objects. It hides the | | Weaver creates and destroys WeaverImpl objects. It hides the | |
| implementation details of the WeaverImpl class. It is strongly | | implementation details of the WeaverImpl class. It is strongly | |
| discouraged to use the WeaverImpl class in programs, as its API wil
l | | discouraged to use the WeaverImpl class in programs, as its API wil
l | |
| be changed without notice. | | be changed without notice. | |
| Also, Weaver provides a factory method for this purpose that can be
overloaded to create | | Also, Weaver provides a factory method for this purpose that can be
overloaded to create | |
| derived WeaverImpl objects. | | derived WeaverImpl objects. | |
| | | | |
| */ | | */ | |
|
| // Note: All member documentation is in the WeaverInterface class. | | // Note: All member documentation is in the WeaverInterface class. | |
| class THREADWEAVER_EXPORT Weaver : public WeaverInterface | | class THREADWEAVER_EXPORT Weaver : public WeaverInterface | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| public: | | public: | |
| /** Construct a Weaver object. */ | | /** Construct a Weaver object. */ | |
| Weaver ( QObject* parent=0 ); | | explicit Weaver ( QObject* parent=0 ); | |
| | | | |
| /** Destruct a Weaver object. */ | | /** Destruct a Weaver object. */ | |
| virtual ~Weaver (); | | virtual ~Weaver (); | |
| | | | |
| const State& state() const; | | const State& state() const; | |
| | | | |
| void setMaximumNumberOfThreads( int cap ); | | void setMaximumNumberOfThreads( int cap ); | |
| int maximumNumberOfThreads() const; | | int maximumNumberOfThreads() const; | |
| int currentNumberOfThreads () const; | | int currentNumberOfThreads () const; | |
| | | | |
| void registerObserver ( WeaverObserver* ); | | void registerObserver ( WeaverObserver* ); | |
| | | | |
| /** Return the global Weaver instance. | | /** Return the global Weaver instance. | |
| In some cases, a global Weaver object per application is | | In some cases, a global Weaver object per application is | |
| sufficient for the applications purpose. If this is the case, | | sufficient for the applications purpose. If this is the case, | |
| query instance() to a pointer to a global instance. | | query instance() to get a pointer to a global instance. | |
| If instance is never called, a global Weaver object will not be | | If instance is never called, a global Weaver object will not be | |
| created. | | created. | |
| */ | | */ | |
| // FIXME (0.7) this should be a WeaverInterface pointer | | // FIXME (0.7) this should be a WeaverInterface pointer | |
| static ThreadWeaver::Weaver* instance(); | | static ThreadWeaver::Weaver* instance(); | |
| virtual void enqueue (Job*); | | virtual void enqueue (Job*); | |
| virtual bool dequeue (Job*); | | virtual bool dequeue (Job*); | |
| virtual void dequeue (); | | virtual void dequeue (); | |
| virtual void finish(); | | virtual void finish(); | |
| virtual void suspend( ); | | virtual void suspend( ); | |
| virtual void resume(); | | virtual void resume(); | |
| bool isEmpty () const; | | bool isEmpty () const; | |
| bool isIdle () const; | | bool isIdle () const; | |
| int queueLength () const; | | int queueLength () const; | |
| void requestAbort(); | | void requestAbort(); | |
| | | | |
| protected: | | protected: | |
| | | /** The factory method to create the actual Weaver implementation. | |
| /** The factory method to create the actual Weaver implementation. | | Overload this method to use a different or adapted implementation. | |
| Overload this method to use a different or adapted implementati | | */ | |
| on. | | virtual WeaverInterface* makeWeaverImpl (); | |
| */ | | | |
| virtual WeaverInterface* makeWeaverImpl (); | | private: | |
| | | | |
| private: | | class Private; | |
| | | Private* const d; | |
| class Private; | | }; | |
| Private* const d; | | | |
| }; | | | |
| } | | } | |
| | | | |
| #endif // THREADWEAVER_H | | #endif // THREADWEAVER_H | |
| | | | |
End of changes. 5 change blocks. |
| 58 lines changed or deleted | | 56 lines changed or added | |
|
| WeaverInterface.h | | WeaverInterface.h | |
| /* -*- C++ -*- | | /* -*- C++ -*- | |
| | | | |
| This file declares the WeaverInterface class. | | This file declares the WeaverInterface class. | |
| | | | |
| $ Author: Mirko Boehm $ | | $ Author: Mirko Boehm $ | |
|
| $ Copyright: (C) 2005, 2006 Mirko Boehm $ | | $ Copyright: (C) 2005-2013 Mirko Boehm $ | |
| $ Contact: mirko@kde.org | | $ Contact: mirko@kde.org | |
| http://www.kde.org | | http://www.kde.org | |
|
| http://www.hackerbuero.org $ | | http://creative-destruction.me $ | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| | | | |
| #ifndef WeaverInterface_H | | #ifndef WeaverInterface_H | |
| #define WeaverInterface_H | | #define WeaverInterface_H | |
| | | | |
| #include <QtCore/QObject> | | #include <QtCore/QObject> | |
| | | | |
| #include <threadweaver/threadweaver_export.h> | | #include <threadweaver/threadweaver_export.h> | |
| | | | |
| namespace ThreadWeaver { | | namespace ThreadWeaver { | |
| | | | |
|
| class Job; | | class Job; | |
| class State; | | class State; | |
| class WeaverObserver; | | class WeaverObserver; | |
| | | | |
| /** WeaverInterface provides a common interface for weaver implementati | | /** WeaverInterface provides a common interface for weaver implementations. | |
| ons. | | | |
| | | In most cases, it is sufficient for an application to hold exactly one | |
| In most cases, it is sufficient for an application to hold exactly | | ThreadWeaver job queue. To execute jobs in a specific order, use job | |
| one | | dependencies. To limit the number of jobs of a certain type that can | |
| ThreadWeaver job queue. To execute jobs in a specific order, use jo | | be executed at the same time, use resource restrictions. To handle | |
| b | | special requirements of the application when it comes to the order of | |
| dependencies. To limit the number of jobs of a certain type that ca | | execution of jobs, implement a special queue policy and apply it to | |
| n | | the jobs. | |
| be executed at the same time, use resource restrictions. To handle | | | |
| special requirements of the application when it comes to the order | | Users of the ThreadWeaver API are encouraged to program to this | |
| of | | interface, instead of the implementation. This way, implementation | |
| execution of jobs, implement a special queue policy and apply it to | | changes will not affect user programs. | |
| the jobs. | | | |
| | | This interface can be used for example to implement adapters and | |
| Users of the ThreadWeaver API are encouraged to program to this | | decorators. The member documentation is provided in the Weaver and | |
| interface, instead of the implementation. This way, implementation | | WeaverImpl classes. | |
| changes will not affect user programs. | | */ | |
| | | | |
| This interface can be used for example to implement adapters and | | class THREADWEAVER_EXPORT WeaverInterface : public QObject { | |
| decorators. The member documentation is provided in the Weaver and | | Q_OBJECT | |
| WeaverImpl classes. | | | |
| */ | | public: | |
| | | /** A ThreadWeaver object manages a queue of Jobs. | |
| class THREADWEAVER_EXPORT WeaverInterface : public QObject { | | It inherits QObject. | |
| Q_OBJECT | | */ | |
| | | explicit WeaverInterface ( QObject* parent = 0 ); | |
| public: | | virtual ~WeaverInterface() {} | |
| /** A ThreadWeaver object manages a queue of Jobs. | | /** Return the state of the weaver object. */ | |
| It inherits QObject. | | virtual const State& state() const = 0; | |
| */ | | | |
| explicit WeaverInterface ( QObject* parent = 0 ); | | /** Set the maximum number of threads this Weaver object may start. */ | |
| virtual ~WeaverInterface() {} | | virtual void setMaximumNumberOfThreads( int cap ) = 0; | |
| /** Return the state of the weaver object. */ | | | |
| virtual const State& state() const = 0; | | /** Get the maximum number of threads this Weaver may start. */ | |
| | | virtual int maximumNumberOfThreads() const = 0; | |
| /** Set the maximum number of threads this Weaver object may start. * | | | |
| / | | /** Returns the current number of threads in the inventory. */ | |
| virtual void setMaximumNumberOfThreads( int cap ) = 0; | | virtual int currentNumberOfThreads () const = 0; | |
| | | | |
| /** Get the maximum number of threads this Weaver may start. */ | | /** Register an observer. | |
| virtual int maximumNumberOfThreads() const = 0; | | | |
| | | Observers provides signals on different weaver events that are | |
| /** Returns the current number of threads in the inventory. */ | | otherwise only available through objects of different classes | |
| virtual int currentNumberOfThreads () const = 0; | | (threads, jobs). Usually, access to the signals of those objects | |
| | | is not provided through the weaver API. Use an observer to reveice | |
| /** Register an observer. | | notice, for example, on thread activity. | |
| | | | |
| Observers provides signals on different weaver events that are | | To unregister, simply delete the observer. | |
| otherwise only available through objects of different classes | | */ | |
| (threads, jobs). Usually, access to the signals of those object | | virtual void registerObserver ( WeaverObserver* ) = 0; | |
| s | | /** Add a job to be executed. | |
| is not provided through the weaver API. Use an observer to reve | | | |
| ice | | It depends on the state if execution of the job will be attempted | |
| notice, for example, on thread activity. | | immediately. In suspended state, jobs can be added to the queue, | |
| | | but the threads remain suspended. In WorkongHard state, an idle | |
| To unregister, simply delete the observer. | | thread may immediately execute the job, or it might be queued if | |
| */ | | all threads are busy. | |
| virtual void registerObserver ( WeaverObserver* ) = 0; | | */ | |
| /** Add a job to be executed. | | virtual void enqueue ( Job* ) = 0; | |
| | | /** Remove a job from the queue. | |
| It depends on the state if execution of the job will be attempt | | If the job was queued but not started so far, it is simply | |
| ed | | removed from the queue. For now, it is unsupported to | |
| immediately. In suspended state, jobs can be added to the queue | | dequeue a job once its execution has started. | |
| , | | | |
| but the threads remain suspended. In WorkongHard state, an idle | | For that case, you will have to provide a method to interrupt your | |
| thread may immediately execute the job, or it might be queued i | | job's execution (and receive the done signal). | |
| f | | Returns true if the job has been dequeued, false if the | |
| all threads are busy. | | job has already been started or is not found in the | |
| */ | | queue. */ | |
| virtual void enqueue ( Job* ) = 0; | | virtual bool dequeue ( Job* ) = 0; | |
| /** Remove a job from the queue. | | /** Remove all queued jobs. | |
| If the job was queued but not started so far, it is simply | | Please note that this will not kill the threads, therefore | |
| removed from the queue. For now, it is unsupported to | | all jobs that are being processed will be continued. */ | |
| dequeue a job once its execution has started. | | virtual void dequeue () = 0; | |
| For that case, you will have to provide a method to interrupt yo | | /** Finish all queued operations, then return. | |
| ur | | | |
| job's execution (and receive the done signal). | | This method is used in imperative (not event driven) programs that | |
| Returns true if the job has been dequeued, false if the | | cannot react on events to have the controlling (main) thread wait | |
| job has already been started or is not found in the | | wait for the jobs to finish. The call will block the calling | |
| queue. */ | | thread and return when all queued jobs have been processed. | |
| virtual bool dequeue ( Job* ) = 0; | | | |
| /** Remove all queued jobs. | | Warning: This will suspend your thread! | |
| Please note that this will not kill the threads, therefore | | Warning: If one of your jobs enters an infinite loop, this | |
| all jobs that are being processed will be continued. */ | | will never return! */ | |
| virtual void dequeue () = 0; | | virtual void finish () = 0; | |
| /** Finish all queued operations, then return. | | /** Suspend job execution. | |
| | | When suspending, all threads are allowed to finish the | |
| This method is used in imperative (not event driven) programs th | | currently assigned job but will not receive a new | |
| at | | assignment. | |
| cannot react on events to have the controlling (main) thread wai | | When all threads are done processing the assigned job, the | |
| t | | signal suspended will() be emitted. | |
| wait for the jobs to finish. The call will block the calling | | If you call suspend() and there are no jobs left to | |
| thread and return when all queued jobs have been processed. | | be done, you will immediately receive the suspended() | |
| | | signal. */ | |
| Warning: This will suspend your thread! | | virtual void suspend () = 0; | |
| Warning: If one of your jobs enters an infinite loop, this | | /** Resume job queueing. | |
| will never return! */ | | @see suspend | |
| virtual void finish () = 0; | | */ | |
| /** Suspend job execution. | | virtual void resume () = 0; | |
| When suspending, all threads are allowed to finish the | | /** Is the queue empty? | |
| currently assigned job but will not receive a new | | The queue is empty if no more jobs are queued. */ | |
| assignment. | | virtual bool isEmpty () const = 0; | |
| When all threads are done processing the assigned job, the | | /** Is the weaver idle? | |
| signal suspended will() be emitted. | | The weaver is idle if no jobs are queued and no jobs are processed | |
| If you call suspend() and there are no jobs left to | | by the threads. */ | |
| be done, you will immediately receive the suspended() | | virtual bool isIdle () const = 0; | |
| signal. */ | | /** Returns the number of pending jobs. | |
| virtual void suspend () = 0; | | This will return the number of queued jobs. Jobs that are | |
| /** Resume job queueing. | | currently being executed are not part of the queue. All jobs in | |
| @see suspend | | the queue are waiting to be executed. | |
| */ | | */ | |
| virtual void resume () = 0; | | virtual int queueLength () const = 0; | |
| /** Is the queue empty? | | | |
| The queue is empty if no more jobs are queued. */ | | /** Request aborts of the currently executed jobs. | |
| virtual bool isEmpty () const = 0; | | It is important to understand that aborts are requested, but | |
| /** Is the weaver idle? | | cannot be guaranteed, as not all Job classes support it. It is up | |
| The weaver is idle if no jobs are queued and no jobs are process | | to the application to decide if and how job aborts are | |
| ed | | necessary. */ | |
| by the threads. */ | | virtual void requestAbort() = 0; | |
| virtual bool isIdle () const = 0; | | | |
| /** Returns the number of pending jobs. | | Q_SIGNALS: | |
| This will return the number of queued jobs. Jobs that are | | /** This signal is emitted when the Weaver has finished ALL currently | |
| currently being executed are not part of the queue. All jobs in | | queued jobs. | |
| the queue are waiting to be executed. | | If a number of jobs is enqueued sequentially, this signal might be | |
| */ | | emitted a couple of times (what happens is that all already queued | |
| virtual int queueLength () const = 0; | | jobs have been processed while you still add new ones). This is | |
| | | not a bug, but the intended behaviour. */ | |
| /** Request aborts of the currently executed jobs. | | void finished (); | |
| It is important to understand that aborts are requested, but | | | |
| cannot be guaranteed, as not all Job classes support it. It is u | | /** Thread queueing has been suspended. | |
| p | | When suspend is called with, all threads are | |
| to the application to decide if and how job aborts are | | allowed to finish their job. When the last thread | |
| necessary. */ | | finished, this signal is emitted. */ | |
| virtual void requestAbort() = 0; | | void suspended (); | |
| | | | |
| Q_SIGNALS: | | /** This signal is emitted when a job is finished. In addition, | |
| /** This signal is emitted when the Weaver has finished ALL currentl | | the Job itself emits a done() signal just before the jobDone() signal | |
| y | | is emitted. | |
| queued jobs. | | */ | |
| If a number of jobs is enqueued sequentially, this signal might | | void jobDone ( ThreadWeaver::Job* ); | |
| be | | // FIXME (0.7) test if signal is emitted properly | |
| emitted a couple of times (what happens is that all already queu | | // FIXME (0.7) provide jobStarted and jobFailed signals | |
| ed | | // FIXME (0.7) or remove all these, and add them to WeaverObserver | |
| jobs have been processed while you still add new ones). This is | | | |
| not a bug, but the intended behaviour. */ | | /** The Weaver's state has changed. */ | |
| void finished (); | | void stateChanged ( ThreadWeaver::State* ); | |
| | | }; | |
| /** Thread queueing has been suspended. | | | |
| When suspend is called with state = true, all threads are | | | |
| allowed to finish their job. When the last thread | | | |
| finished, this signal is emitted. */ | | | |
| void suspended (); | | | |
| | | | |
| /** This signal is emitted when a job is finished. In addition, | | | |
| the Job itself emits a done() signal just before the jobDone() s | | | |
| ignal | | | |
| is emitted. | | | |
| */ | | | |
| | | | |
| void jobDone ( ThreadWeaver::Job* ); | | | |
| // FIXME (0.7) test if signal is emitted properly | | | |
| // FIXME (0.7) provide jobStarted and jobFailed signals | | | |
| // FIXME (0.7) or remove all these, and add them to WeaverObserver | | | |
| | | | |
| /** The Weaver's state has changed. */ | | | |
| void stateChanged ( ThreadWeaver::State* ); | | | |
| }; | | | |
| | | | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 174 lines changed or deleted | | 154 lines changed or added | |
|
| battery.h | | battery.h | |
| | | | |
| skipping to change at line 41 | | skipping to change at line 41 | |
| class Device; | | class Device; | |
| | | | |
| /** | | /** | |
| * This device interface is available on batteries. | | * This device interface is available on batteries. | |
| */ | | */ | |
| class SOLID_EXPORT Battery : public DeviceInterface | | class SOLID_EXPORT Battery : public DeviceInterface | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| Q_ENUMS(BatteryType ChargeState) | | Q_ENUMS(BatteryType ChargeState) | |
| Q_PROPERTY(bool plugged READ isPlugged) | | Q_PROPERTY(bool plugged READ isPlugged) | |
|
| | | Q_PROPERTY(bool powerSupply READ isPowerSupply) | |
| Q_PROPERTY(BatteryType type READ type) | | Q_PROPERTY(BatteryType type READ type) | |
| Q_PROPERTY(int chargePercent READ chargePercent) | | Q_PROPERTY(int chargePercent READ chargePercent) | |
|
| | | Q_PROPERTY(int capacity READ capacity) | |
| Q_PROPERTY(bool rechargeable READ isRechargeable) | | Q_PROPERTY(bool rechargeable READ isRechargeable) | |
| Q_PROPERTY(ChargeState chargeState READ chargeState) | | Q_PROPERTY(ChargeState chargeState READ chargeState) | |
| Q_DECLARE_PRIVATE(Battery) | | Q_DECLARE_PRIVATE(Battery) | |
| friend class Device; | | friend class Device; | |
| | | | |
| public: | | public: | |
| /** | | /** | |
| * This enum type defines the type of the device holding the batter
y | | * This enum type defines the type of the device holding the batter
y | |
| * | | * | |
| * - PdaBattery : A battery in a Personal Digital Assistant | | * - PdaBattery : A battery in a Personal Digital Assistant | |
| | | | |
| skipping to change at line 111 | | skipping to change at line 113 | |
| static Type deviceInterfaceType() { return DeviceInterface::Battery
; } | | static Type deviceInterfaceType() { return DeviceInterface::Battery
; } | |
| | | | |
| /** | | /** | |
| * Indicates if this battery is plugged. | | * Indicates if this battery is plugged. | |
| * | | * | |
| * @return true if the battery is plugged, false otherwise | | * @return true if the battery is plugged, false otherwise | |
| */ | | */ | |
| bool isPlugged() const; | | bool isPlugged() const; | |
| | | | |
| /** | | /** | |
|
| | | * Indicates if this battery is powering the machine or from an att | |
| | | ached deviced. | |
| | | * | |
| | | * @since 4.11 | |
| | | * @return true the battery is a powersupply, false otherwise | |
| | | */ | |
| | | bool isPowerSupply() const; | |
| | | | |
| | | /** | |
| * Retrieves the type of device holding this battery. | | * Retrieves the type of device holding this battery. | |
| * | | * | |
| * @return the type of device holding this battery | | * @return the type of device holding this battery | |
| * @see Solid::Battery::BatteryType | | * @see Solid::Battery::BatteryType | |
| */ | | */ | |
| BatteryType type() const; | | BatteryType type() const; | |
| | | | |
| /** | | /** | |
| * Retrieves the current charge level of the battery normalised | | * Retrieves the current charge level of the battery normalised | |
| * to percent. | | * to percent. | |
| * | | * | |
| * @return the current charge level normalised to percent | | * @return the current charge level normalised to percent | |
| */ | | */ | |
| int chargePercent() const; | | int chargePercent() const; | |
| | | | |
| /** | | /** | |
|
| | | * Retrieves the battery capacity normalised to percent, | |
| | | * meaning how much energy can it hold compared to what it is desig | |
| | | ned to. | |
| | | * The capacity of the battery will reduce with age. | |
| | | * A capacity value less than 75% is usually a sign that you should | |
| | | renew your battery. | |
| | | * | |
| | | * @since 4.11 | |
| | | * @return the battery capacity normalised to percent | |
| | | */ | |
| | | int capacity() const; | |
| | | | |
| | | /** | |
| * Indicates if the battery is rechargeable. | | * Indicates if the battery is rechargeable. | |
| * | | * | |
| * @return true if the battery is rechargeable, false otherwise (on
e time usage) | | * @return true if the battery is rechargeable, false otherwise (on
e time usage) | |
| */ | | */ | |
| bool isRechargeable() const; | | bool isRechargeable() const; | |
| | | | |
| /** | | /** | |
| * Retrieves the current charge state of the battery. It can be in
a stable | | * Retrieves the current charge state of the battery. It can be in
a stable | |
| * state (no charge), charging or discharging. | | * state (no charge), charging or discharging. | |
| * | | * | |
| | | | |
| skipping to change at line 153 | | skipping to change at line 174 | |
| /** | | /** | |
| * This signal is emitted when the charge percent value of this | | * This signal is emitted when the charge percent value of this | |
| * battery has changed. | | * battery has changed. | |
| * | | * | |
| * @param value the new charge percent value of the battery | | * @param value the new charge percent value of the battery | |
| * @param udi the UDI of the battery with the new charge percent | | * @param udi the UDI of the battery with the new charge percent | |
| */ | | */ | |
| void chargePercentChanged(int value, const QString &udi); | | void chargePercentChanged(int value, const QString &udi); | |
| | | | |
| /** | | /** | |
|
| | | * This signal is emitted when the capacity of this battery has cha | |
| | | nged. | |
| | | * | |
| | | * @param value the new capacity of the battery | |
| | | * @param udi the UDI of the battery with the new capacity | |
| | | * @since 4.11 | |
| | | */ | |
| | | void capacityChanged(int value, const QString &udi); | |
| | | | |
| | | /** | |
| * This signal is emitted when the charge state of this battery | | * This signal is emitted when the charge state of this battery | |
| * has changed. | | * has changed. | |
| * | | * | |
| * @param newState the new charge state of the battery, it's one of | | * @param newState the new charge state of the battery, it's one of | |
| * the type Solid::Battery::ChargeState | | * the type Solid::Battery::ChargeState | |
| * @see Solid::Battery::ChargeState | | * @see Solid::Battery::ChargeState | |
| * @param udi the UDI of the battery with the new charge state | | * @param udi the UDI of the battery with the new charge state | |
| */ | | */ | |
| void chargeStateChanged(int newState, const QString &udi); | | void chargeStateChanged(int newState, const QString &udi); | |
| | | | |
| /** | | /** | |
| * This signal is emitted if the battery get plugged in/out of the | | * This signal is emitted if the battery get plugged in/out of the | |
| * battery bay. | | * battery bay. | |
| * | | * | |
| * @param newState the new plugging state of the battery, type is b
oolean | | * @param newState the new plugging state of the battery, type is b
oolean | |
| * @param udi the UDI of the battery with the new plugging state | | * @param udi the UDI of the battery with the new plugging state | |
| */ | | */ | |
| void plugStateChanged(bool newState, const QString &udi); | | void plugStateChanged(bool newState, const QString &udi); | |
|
| | | | |
| | | /** | |
| | | * This signal is emitted when the power supply state of the batter | |
| | | y | |
| | | * changes. | |
| | | * | |
| | | * @param newState the new power supply state, type is boolean | |
| | | * @param udi the UDI of the battery with the new power supply stat | |
| | | e | |
| | | * @since 4.11 | |
| | | */ | |
| | | void powerSupplyStateChanged(bool newState, const QString &udi); | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 6 change blocks. |
| 0 lines changed or deleted | | 46 lines changed or added | |
|
| dialog.h | | dialog.h | |
|
| | | // -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*- | |
| /* | | /* | |
|
| * Copyright 2008 by Alessandro Diaferia <alediaferia@gmail.com> | | * dialog.h | |
| * Copyright 2007 by Alexis Ménard <darktears31@gmail.com> | | * | |
| * Copyright 2007 Sebastian Kuegler <sebas@kde.org> | | * Copyright (C) 2003 Zack Rusin <zack@kde.org> | |
| * Copyright 2006 Aaron Seigo <aseigo@kde.org> | | * Copyright (C) 2009-2010 Michel Ludwig <michel.ludwig@kdemail.net> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * version 2.1 of the License, or (at your option) any later version. | |
| * | | * | |
| * This library is distributed in the hope that it will be useful, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Lesser General Public License for more details. | | * Lesser General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
|
| * Foundation, Inc., 51 Franklin St, Fifth Floor, | | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | |
| * Boston, MA 02110-1301 USA | | * 02110-1301 USA | |
| */ | | */ | |
|
| | | #ifndef SONNET_DIALOG_H | |
| | | #define SONNET_DIALOG_H | |
| | | | |
|
| #ifndef PLASMA_DIALOG_H | | #include <kdialog.h> | |
| #define PLASMA_DIALOG_H | | | |
| | | | |
| #include <QtGui/QWidget> | | | |
| #include <QtGui/QGraphicsSceneEvent> | | | |
| #include <QtGui/QGraphicsView> | | | |
| | | | |
|
| #include <plasma/plasma_export.h> | | class QListWidgetItem; | |
| #include <plasma/plasma.h> | | class QModelIndex; | |
| | | | |
|
| namespace Plasma | | namespace Sonnet | |
| { | | { | |
|
| | | class BackgroundChecker; | |
| | | | |
|
| class DialogPrivate; | | /** | |
| | | * @short Spellcheck dialog | |
| /** | | * | |
| * @class Dialog plasma/dialog.h <Plasma/Dialog> | | * \code | |
| * | | * Sonnet::Dialog dlg = new Sonnet::Dialog( | |
| * @short A dialog that uses the Plasma style | | * new Sonnet::BackgroundChecker(this), this); | |
| * | | * //connect signals | |
| * Dialog provides a dialog-like widget that can be used to display additio | | * ... | |
| nal | | * dlg->setBuffer( someText ); | |
| * information. | | * dlg->show(); | |
| * | | * \endcode | |
| * Dialog uses the plasma theme, and usually has no window decoration. It's | | * | |
| meant | | * You can change buffer inside a slot connected to done() signal | |
| * as an interim solution to display widgets as extension to plasma applets | | * and spellcheck will continue with new data automatically. | |
| , for | | */ | |
| * example when you click on an applet like the devicenotifier or the clock | | class KDEUI_EXPORT Dialog : public KDialog | |
| , the | | { | |
| * widget that is then displayed, is a Dialog. | | Q_OBJECT | |
| */ | | | |
| class PLASMA_EXPORT Dialog : public QWidget | | | |
| { | | | |
| Q_OBJECT | | | |
| public: | | public: | |
|
| /** | | Dialog(BackgroundChecker *checker, | |
| * Use these flags to choose the active resize corners. | | QWidget *parent); | |
| */ | | ~Dialog(); | |
| enum ResizeCorner { | | | |
| NoCorner = 0, | | QString originalBuffer() const; | |
| NorthEast = 1, | | QString buffer() const; | |
| SouthEast = 2, | | | |
| NorthWest = 4, | | void show(); | |
| SouthWest = 8, | | void activeAutoCorrect(bool _active); | |
| All = NorthEast | SouthEast | NorthWest | SouthWest | | | |
| }; | | // Hide warning about done(), which is a slot in QDialog and a sign | |
| Q_DECLARE_FLAGS(ResizeCorners, ResizeCorner) | | al here. | |
| | | using KDialog::done; | |
| /** | | | |
| * @param parent the parent widget, for plasmoids, this is usually | | /** | |
| 0. | | * Controls whether an (indefinite) progress dialog is shown when t | |
| * @param f the Qt::WindowFlags, default is to not show a windowbor | | he spell | |
| der. | | * checking takes longer than the given time to complete. By defaul | |
| */ | | t no | |
| explicit Dialog(QWidget * parent = 0, Qt::WindowFlags f = Qt::Wind | | * progress dialog is shown. If the progress dialog is set to be sh | |
| ow); | | own, no | |
| virtual ~Dialog(); | | * time consuming operation (for example, showing a notification me | |
| | | ssage) should | |
| /** | | * be performed in a slot connected to the 'done' signal as this mi | |
| * Sets a QGraphicsWidget to be shown as the content in this dialog | | ght trigger | |
| . | | * the progress dialog unnecessarily. | |
| * The dialog will then set up a QGraphicsView and coordinate geome | | | |
| try with | | | |
| * the widget automatically. | | | |
| * | | * | |
|
| * @param widget the QGraphicsWidget to display in this dialog | | * @param timeout time after which the progress dialog should appea | |
| */ | | r; a negative | |
| void setGraphicsWidget(QGraphicsWidget *widget); | | * value can be used to hide it | |
| | | * @since 4.4 | |
| /** | | | |
| * @return the graphics widget shown in this dialog | | | |
| */ | | | |
| QGraphicsWidget *graphicsWidget(); | | | |
| | | | |
| /** | | | |
| * @param corners the corners the resize handlers should be placed | | | |
| in. | | | |
| */ | | | |
| void setResizeHandleCorners(ResizeCorners corners); | | | |
| | | | |
| /** | | | |
| * Convenience method to get the enabled resize corners. | | | |
| * @return which resize corners are active. | | | |
| */ | | | |
| ResizeCorners resizeCorners() const; | | | |
| | | | |
| /** | | | |
| * @return true if currently being resized by the user | | | |
| */ | | */ | |
|
| bool isUserResizing() const; | | void showProgressDialog(int timeout = 500); | |
| | | | |
| /** | | /** | |
|
| * Sets the minimum values that each of four sides of the rect may | | * Controls whether a message box indicating the completion of the | |
| expand to or from | | spell checking | |
| | | * is shown or not. By default it is not shown. | |
| * | | * | |
|
| * @param left the screen coordinate that the left may not go beyon | | * @since 4.4 | |
| d; -1 for no limit | | | |
| * @param top the screen coordinate that the top may not go beyond; | | | |
| -1 for no limit | | | |
| * @param right the screen coordinate that the right may not go bey | | | |
| ond; -1 for no limit | | | |
| * @param bottom the screen coordinate that the bottom may not go b | | | |
| eyond; -1 for no limit | | | |
| */ | | */ | |
|
| void setMinimumResizeLimits(int left, int top, int right, int botto
m); | | void showSpellCheckCompletionMessage( bool b = true ); | |
| | | | |
| /** | | /** | |
|
| * Retrives the minimum resize limits for the dialog | | * Controls whether the spell checking is continued after the repla | |
| | | cement of a | |
| | | * misspelled word has been performed. By default it is continued. | |
| * | | * | |
|
| * @param left the screen coordinate that the left may not go beyon | | | |
| d; -1 for no limit | | | |
| * @param top the screen coordinate that the top may not go beyond; | | | |
| -1 for no limit | | | |
| * @param right the screen coordinate that the right may not go bey | | | |
| ond; -1 for no limit | | | |
| * @param bottom the screen coordinate that the bottom may not go b | | | |
| eyond; -1 for no limit | | | |
| */ | | | |
| void getMinimumResizeLimits(int *left, int *top, int *right, int *b | | | |
| ottom); | | | |
| | | | |
| /** | | | |
| * Causes an animated hide; requires compositing to work, otherwise | | | |
| * the dialog will simply hide. | | | |
| * @since 4.3 | | | |
| */ | | | |
| void animatedHide(Plasma::Direction direction); | | | |
| | | | |
| /** | | | |
| * Causes an animated show; requires compositing to work, otherwise | | | |
| * the dialog will simply show. | | | |
| * @since 4.3 | | | |
| */ | | | |
| void animatedShow(Plasma::Direction direction); | | | |
| | | | |
| /** | | | |
| * @return the preferred aspect ratio mode for placement and resizi | | | |
| ng | | | |
| * @since 4.4 | | * @since 4.4 | |
| */ | | */ | |
|
| Plasma::AspectRatioMode aspectRatioMode() const; | | void setSpellCheckContinuedAfterReplacement( bool b ); | |
| | | | |
|
| /** | | public Q_SLOTS: | |
| * Sets the preferred aspect ratio mode for placement and resizing | | void setBuffer(const QString &); | |
| * @since 4.4 | | | |
| */ | | | |
| void setAspectRatioMode(Plasma::AspectRatioMode mode); | | | |
| | | | |
| Q_SIGNALS: | | Q_SIGNALS: | |
| /** | | /** | |
|
| * Fires when the dialog automatically resizes. | | * The dialog won't be closed if you setBuffer() in slot connected | |
| | | to this signal | |
| | | * | |
| | | * Also emitted after stop() signal | |
| */ | | */ | |
|
| void dialogResized(); | | void done( const QString& newBuffer ); | |
| | | void misspelling( const QString& word, int start ); | |
| | | void replace( const QString& oldWord, int start, | |
| | | const QString& newWord ); | |
| | | | |
|
| /** | | void stop(); | |
| * Emit a signal when the dialog become visible/invisible | | void cancel(); | |
| */ | | void autoCorrect( const QString & currentWord, const QString & repl | |
| void dialogVisible(bool status); | | aceWord ); | |
| | | | |
|
| public Q_SLOTS: | | | |
| /** | | /** | |
|
| * Adjusts the dialog to the associated QGraphicsWidget's geometry | | * Signal sends when spell checking is finished/stopped/completed | |
| * Should not normally need to be called by users of Dialog as Dial | | * @since 4.1 | |
| og | | | |
| * does it automatically. Event compression may cause unwanted dela | | | |
| ys, | | | |
| * however, and so this method may be called to immediately cause a | | | |
| * synchronization. | | | |
| * @since 4.5 | | | |
| */ | | | |
| void syncToGraphicsWidget(); | | | |
| | | | |
| protected: | | | |
| /** | | | |
| * Reimplemented from QWidget | | | |
| */ | | | |
| void paintEvent(QPaintEvent *e); | | | |
| bool event(QEvent *event); | | | |
| void resizeEvent(QResizeEvent *e); | | | |
| bool eventFilter(QObject *watched, QEvent *event); | | | |
| void hideEvent(QHideEvent *event); | | | |
| void showEvent(QShowEvent *event); | | | |
| void focusInEvent(QFocusEvent *event); | | | |
| void mouseMoveEvent(QMouseEvent *event); | | | |
| void mousePressEvent(QMouseEvent *event); | | | |
| void mouseReleaseEvent(QMouseEvent *event); | | | |
| void keyPressEvent(QKeyEvent *event); | | | |
| void moveEvent(QMoveEvent *event); | | | |
| | | | |
| /** | | | |
| * Convenience method to know whether the point is in a control are | | | |
| a (e.g. resize area) | | | |
| * or not. | | | |
| * @return true if the point is in the control area. | | | |
| */ | | */ | |
|
| bool inControlArea(const QPoint &point); | | void spellCheckStatus(const QString &); | |
| | | | |
|
| private: | | | |
| DialogPrivate *const d; | | | |
| | | | |
| friend class DialogPrivate; | | | |
| /** | | /** | |
|
| * React to theme changes | | * Emitted when the user changes the language used for spellcheckin | |
| | | g, | |
| | | * which is shown in a combobox of this dialog. | |
| | | * | |
| | | * @param dictionary the new language the user selected | |
| | | * @since 4.1 | |
| */ | | */ | |
|
| Q_PRIVATE_SLOT(d, void themeChanged()) | | void languageChanged( const QString &language ); | |
| Q_PRIVATE_SLOT(d, void checkBorders()) | | | |
| Q_PRIVATE_SLOT(d, void delayedAdjustSize()) | | | |
| | | | |
|
| friend class PopupAppletPrivate; | | private Q_SLOTS: | |
| }; | | void slotMisspelling(const QString& word, int start ); | |
| | | void slotDone(); | |
| | | | |
| | | void slotFinished(); | |
| | | void slotCancel(); | |
| | | | |
| | | void slotAddWord(); | |
| | | void slotReplaceWord(); | |
| | | void slotReplaceAll(); | |
| | | void slotSkip(); | |
| | | void slotSkipAll(); | |
| | | void slotSuggest(); | |
| | | void slotChangeLanguage( const QString& ); | |
| | | void slotSelectionChanged(const QModelIndex &); | |
| | | void slotAutocorrect(); | |
| | | | |
|
| } // Plasma namespace | | void setGuiEnabled(bool b); | |
| | | void setProgressDialogVisible(bool b); | |
| | | | |
|
| Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Dialog::ResizeCorners) | | private: | |
| | | void updateDialog( const QString& word ); | |
| | | void fillDictionaryComboBox(); | |
| | | void updateDictionaryComboBox(); | |
| | | void fillSuggestions( const QStringList& suggs ); | |
| | | void initConnections(); | |
| | | void initGui(); | |
| | | void continueChecking(); | |
| | | | |
| | | private: | |
| | | class Private; | |
| | | Private* const d; | |
| | | Q_DISABLE_COPY( Dialog ) | |
| | | }; | |
| | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 31 change blocks. |
| 190 lines changed or deleted | | 129 lines changed or added | |
|
| jobuidelegate.h | | jobuidelegate.h | |
| /* This file is part of the KDE libraries | | /* This file is part of the KDE libraries | |
| Copyright (C) 2000 Stephan Kulow <coolo@kde.org> | | Copyright (C) 2000 Stephan Kulow <coolo@kde.org> | |
| David Faure <faure@kde.org> | | David Faure <faure@kde.org> | |
| Copyright (C) 2006 Kevin Ottens <ervin@kde.org> | | Copyright (C) 2006 Kevin Ottens <ervin@kde.org> | |
|
| | | Copyright (C) 2013 Dawit Alemayehu <adawit@kde.org> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 29 | |
| the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
| Boston, MA 02110-1301, USA. | | Boston, MA 02110-1301, USA. | |
| */ | | */ | |
| | | | |
| #ifndef KIO_JOBUIDELEGATE_H | | #ifndef KIO_JOBUIDELEGATE_H | |
| #define KIO_JOBUIDELEGATE_H | | #define KIO_JOBUIDELEGATE_H | |
| | | | |
| #include <kdialogjobuidelegate.h> | | #include <kdialogjobuidelegate.h> | |
| #include <kio/skipdialog.h> | | #include <kio/skipdialog.h> | |
| #include <kio/renamedialog.h> | | #include <kio/renamedialog.h> | |
|
| | | #include <kio/global.h> | |
| | | | |
| class KJob; | | class KJob; | |
| namespace KIO | | namespace KIO | |
| { | | { | |
| class Job; | | class Job; | |
| | | | |
| /** | | /** | |
| * A UI delegate tuned to be used with KIO Jobs. | | * A UI delegate tuned to be used with KIO Jobs. | |
| */ | | */ | |
| class KIO_EXPORT JobUiDelegate : public KDialogJobUiDelegate | | class KIO_EXPORT JobUiDelegate : public KDialogJobUiDelegate | |
| | | | |
| skipping to change at line 130 | | skipping to change at line 132 | |
| * | | * | |
| * @param urls the urls about to be deleted/trashed | | * @param urls the urls about to be deleted/trashed | |
| * @param method the type of deletion (Delete for real deletion, Trash
otherwise) | | * @param method the type of deletion (Delete for real deletion, Trash
otherwise) | |
| * @param confirmation see ConfirmationType. Normally set to DefaultCon
firmation. | | * @param confirmation see ConfirmationType. Normally set to DefaultCon
firmation. | |
| * Note: the window passed to setWindow is used as the parent for the m
essage box. | | * Note: the window passed to setWindow is used as the parent for the m
essage box. | |
| * @return true if confirmed | | * @return true if confirmed | |
| */ | | */ | |
| bool askDeleteConfirmation(const KUrl::List& urls, DeletionType deletio
nType, | | bool askDeleteConfirmation(const KUrl::List& urls, DeletionType deletio
nType, | |
| ConfirmationType confirmationType); | | ConfirmationType confirmationType); | |
| | | | |
|
| | | /** | |
| | | * Message box types. | |
| | | * | |
| | | * Should be kept in sync with SlaveBase::MessageBoxType. | |
| | | * | |
| | | * @since 4.11 | |
| | | * | |
| | | * @internal | |
| | | */ | |
| | | enum MessageBoxType { | |
| | | QuestionYesNo = 1, | |
| | | WarningYesNo = 2, | |
| | | WarningContinueCancel = 3, | |
| | | WarningYesNoCancel = 4, | |
| | | Information = 5, | |
| | | SSLMessageBox = 6 | |
| | | }; | |
| | | /** | |
| | | * This function allows for the delegation user prompts from the ioslave | |
| | | s. | |
| | | * | |
| | | * @param type the desired type of message box. | |
| | | * @param text the message shown to the user. | |
| | | * @param caption the caption of the message dialog box. | |
| | | * @param buttonYes the text for the YES button. | |
| | | * @param buttonNo the text for the NO button. | |
| | | * @param iconYes the icon shown on the YES button. | |
| | | * @param iconNo the icon shown on the NO button. | |
| | | * @param dontAskAgainName the name used to store result from 'Do not as | |
| | | k again' checkbox. | |
| | | * @param sslMetaData SSL information used by the SSLMessageBox. | |
| | | * | |
| | | * @since 4.11 | |
| | | * | |
| | | * @internal | |
| | | */ | |
| | | int requestMessageBox(MessageBoxType type, const QString& text, | |
| | | const QString& caption, | |
| | | const QString& buttonYes, | |
| | | const QString& buttonNo, | |
| | | const QString& iconYes = QString(), | |
| | | const QString& iconNo = QString(), | |
| | | const QString& dontAskAgainName = QString(), | |
| | | const KIO::MetaData& sslMetaData = KIO::MetaData( | |
| | | )); | |
| private: | | private: | |
| class Private; | | class Private; | |
| Private * const d; | | Private * const d; | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 0 lines changed or deleted | | 47 lines changed or added | |
|
| kmessagewidget.h | | kmessagewidget.h | |
| | | | |
| skipping to change at line 101 | | skipping to change at line 101 | |
| */ | | */ | |
| class KDEUI_EXPORT KMessageWidget : public QFrame | | class KDEUI_EXPORT KMessageWidget : public QFrame | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| Q_ENUMS(MessageType) | | Q_ENUMS(MessageType) | |
| | | | |
| Q_PROPERTY(QString text READ text WRITE setText) | | Q_PROPERTY(QString text READ text WRITE setText) | |
| Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap) | | Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap) | |
| Q_PROPERTY(bool closeButtonVisible READ isCloseButtonVisible WRITE setC
loseButtonVisible) | | Q_PROPERTY(bool closeButtonVisible READ isCloseButtonVisible WRITE setC
loseButtonVisible) | |
| Q_PROPERTY(MessageType messageType READ messageType WRITE setMessageTyp
e) | | Q_PROPERTY(MessageType messageType READ messageType WRITE setMessageTyp
e) | |
|
| | | Q_PROPERTY(QIcon icon READ icon WRITE setIcon) | |
| public: | | public: | |
| enum MessageType { | | enum MessageType { | |
| Positive, | | Positive, | |
| Information, | | Information, | |
| Warning, | | Warning, | |
| Error | | Error | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Constructs a KMessageWidget with the specified parent. | | * Constructs a KMessageWidget with the specified parent. | |
| | | | |
| skipping to change at line 136 | | skipping to change at line 137 | |
| void addAction(QAction *action); | | void addAction(QAction *action); | |
| | | | |
| void removeAction(QAction *action); | | void removeAction(QAction *action); | |
| | | | |
| QSize sizeHint() const; | | QSize sizeHint() const; | |
| | | | |
| QSize minimumSizeHint() const; | | QSize minimumSizeHint() const; | |
| | | | |
| int heightForWidth(int width) const; | | int heightForWidth(int width) const; | |
| | | | |
|
| | | /** | |
| | | * The icon shown on the left of the text. By default, no icon is shown | |
| | | . | |
| | | * @since 4.11 | |
| | | */ | |
| | | QIcon icon() const; | |
| | | | |
| public Q_SLOTS: | | public Q_SLOTS: | |
| void setText(const QString &text); | | void setText(const QString &text); | |
| | | | |
| void setWordWrap(bool wordWrap); | | void setWordWrap(bool wordWrap); | |
| | | | |
| void setCloseButtonVisible(bool visible); | | void setCloseButtonVisible(bool visible); | |
| | | | |
| void setMessageType(KMessageWidget::MessageType type); | | void setMessageType(KMessageWidget::MessageType type); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 157 | | skipping to change at line 164 | |
| * KGlobalSettings::graphicsEffectLevel() does not allow simple effects
. | | * KGlobalSettings::graphicsEffectLevel() does not allow simple effects
. | |
| */ | | */ | |
| void animatedShow(); | | void animatedShow(); | |
| | | | |
| /** | | /** | |
| * Hide the widget using an animation, unless | | * Hide the widget using an animation, unless | |
| * KGlobalSettings::graphicsEffectLevel() does not allow simple effects
. | | * KGlobalSettings::graphicsEffectLevel() does not allow simple effects
. | |
| */ | | */ | |
| void animatedHide(); | | void animatedHide(); | |
| | | | |
|
| | | /** | |
| | | * Define an icon to be shown on the left of the text | |
| | | * @since 4.11 | |
| | | */ | |
| | | void setIcon(const QIcon &icon); | |
| | | | |
| Q_SIGNALS: | | Q_SIGNALS: | |
| /** | | /** | |
| * This signal is emitted when the user clicks a link in the text label
. | | * This signal is emitted when the user clicks a link in the text label
. | |
| * The URL referred to by the href anchor is passed in contents. | | * The URL referred to by the href anchor is passed in contents. | |
| * @param contents text of the href anchor | | * @param contents text of the href anchor | |
| * @see QLabel::linkActivated() | | * @see QLabel::linkActivated() | |
| * @since 4.10 | | * @since 4.10 | |
| */ | | */ | |
| void linkActivated(const QString& contents); | | void linkActivated(const QString& contents); | |
| | | | |
|
| | | /** | |
| | | * This signal is emitted when the user hovers over a link in the text | |
| | | label. | |
| | | * The URL referred to by the href anchor is passed in contents. | |
| | | * @param contents text of the href anchor | |
| | | * @see QLabel::linkHovered() | |
| | | * @since 4.11 | |
| | | */ | |
| | | void linkHovered(const QString& contents); | |
| | | | |
| protected: | | protected: | |
| void paintEvent(QPaintEvent *event); | | void paintEvent(QPaintEvent *event); | |
| | | | |
| bool event(QEvent *event); | | bool event(QEvent *event); | |
| | | | |
| void resizeEvent(QResizeEvent *event); | | void resizeEvent(QResizeEvent *event); | |
| | | | |
| void showEvent(QShowEvent *event); | | void showEvent(QShowEvent *event); | |
| | | | |
| private: | | private: | |
| | | | |
End of changes. 4 change blocks. |
| 0 lines changed or deleted | | 24 lines changed or added | |
|
| kservice.h | | kservice.h | |
| | | | |
| skipping to change at line 312 | | skipping to change at line 312 | |
| * | | * | |
| * @return true if the mime type you specified is supported, otherwise
false. | | * @return true if the mime type you specified is supported, otherwise
false. | |
| * @deprecated, use hasMimeType(QString) | | * @deprecated, use hasMimeType(QString) | |
| */ | | */ | |
| #ifndef KDE_NO_DEPRECATED | | #ifndef KDE_NO_DEPRECATED | |
| KDE_DEPRECATED bool hasMimeType( const KServiceType* mimeTypePtr ) cons
t; | | KDE_DEPRECATED bool hasMimeType( const KServiceType* mimeTypePtr ) cons
t; | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * Checks whether the service supports this mime type | | * Checks whether the service supports this mime type | |
|
| * @param mimeTypePtr The name of the mime type you are | | * @param mimeType The name of the mime type you are | |
| * interested in determining whether this service supports. | | * interested in determining whether this service supports. | |
| * @since 4.6 | | * @since 4.6 | |
| */ | | */ | |
| bool hasMimeType( const QString& mimeType ) const; | | bool hasMimeType( const QString& mimeType ) const; | |
| | | | |
| /** | | /** | |
| * Set to true if it is allowed to use this service as the default (mai
n) | | * Set to true if it is allowed to use this service as the default (mai
n) | |
| * action for the files it supports (e.g. Left Click in a file manager,
or KRun in general). | | * action for the files it supports (e.g. Left Click in a file manager,
or KRun in general). | |
| * | | * | |
| * If not, then this service is only available in RMB popups, so it mus
t | | * If not, then this service is only available in RMB popups, so it mus
t | |
| | | | |
| skipping to change at line 429 | | skipping to change at line 429 | |
| * Sets whether to use a terminal or not | | * Sets whether to use a terminal or not | |
| */ | | */ | |
| void setTerminal(bool b); | | void setTerminal(bool b); | |
| /** | | /** | |
| * @internal | | * @internal | |
| * Sets the terminal options to use | | * Sets the terminal options to use | |
| */ | | */ | |
| void setTerminalOptions(const QString &options); | | void setTerminalOptions(const QString &options); | |
| | | | |
| /** | | /** | |
|
| | | * Overrides the "Exec=" line of the service. | |
| | | * | |
| | | * If @ref exec is not empty, its value will override the one | |
| | | * the one set when this service was created. | |
| | | * | |
| | | * Please note that @ref entryPath is also cleared so the service | |
| | | * will no longer be associated with a specific config file. | |
| | | * | |
| | | * @internal | |
| | | * @since 4.11 | |
| | | */ | |
| | | void setExec(const QString& exec); | |
| | | | |
| | | /** | |
| * Find a service by name, i.e. the translated Name field. Don't use th
is. | | * Find a service by name, i.e. the translated Name field. Don't use th
is. | |
| * Use serviceByDesktopPath or serviceByStorageId instead. | | * Use serviceByDesktopPath or serviceByStorageId instead. | |
| * | | * | |
| * @param _name the name to search | | * @param _name the name to search | |
| * @return a pointer to the requested service or 0 if the service is | | * @return a pointer to the requested service or 0 if the service is | |
| * unknown. | | * unknown. | |
| * @em Very @em important: Don't store the result in a KService* ! | | * @em Very @em important: Don't store the result in a KService* ! | |
| * @deprecated there is never a good reason to use this method. | | * @deprecated there is never a good reason to use this method. | |
| */ | | */ | |
| #ifndef KDE_NO_DEPRECATED | | #ifndef KDE_NO_DEPRECATED | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 15 lines changed or added | |
|
| recoveryinterface.h | | recoveryinterface.h | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| #ifndef KDELIBS_KTEXTEDITOR_RECOVERYINTERFACE_H | | #ifndef KDELIBS_KTEXTEDITOR_RECOVERYINTERFACE_H | |
| #define KDELIBS_KTEXTEDITOR_RECOVERYINTERFACE_H | | #define KDELIBS_KTEXTEDITOR_RECOVERYINTERFACE_H | |
| | | | |
| #include <ktexteditor/ktexteditor_export.h> | | #include <ktexteditor/ktexteditor_export.h> | |
| | | | |
| namespace KTextEditor | | namespace KTextEditor | |
| { | | { | |
| /** | | /** | |
| * \brief Document extension interface to control crash recovery. | | * \brief Document extension interface to control crash recovery. | |
| * | | * | |
|
| * \ingroup kte_group_document_extensions | | * \ingroup kte_group_doc_extensions | |
| * | | * | |
| * When the system or the application using the editor component crashed | | * When the system or the application using the editor component crashed | |
| * with unsaved changes in the Document, the View notifies the user about | | * with unsaved changes in the Document, the View notifies the user about | |
| * the lost data and asks, whether the data should be recovered. | | * the lost data and asks, whether the data should be recovered. | |
| * | | * | |
| * This interface gives you control over the data recovery process. Use | | * This interface gives you control over the data recovery process. Use | |
| * isDataRecoveryAvailable() to check for lost data. If you do not want the | | * isDataRecoveryAvailable() to check for lost data. If you do not want the | |
| * editor component to handle the data recovery process automatically, you
can | | * editor component to handle the data recovery process automatically, you
can | |
| * either trigger the data recovery by calling recoverData() or discard it | | * either trigger the data recovery by calling recoverData() or discard it | |
| * by discardDataRecovery(). | | * by discardDataRecovery(). | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 85 | |
| /** | | /** | |
| * If recover data is available, calling discardDataRecovery() will dis
card | | * If recover data is available, calling discardDataRecovery() will dis
card | |
| * the recover data and the recover data is lost. | | * the recover data and the recover data is lost. | |
| * If isDataRecoveryAvailable() returns \e false, calling this function | | * If isDataRecoveryAvailable() returns \e false, calling this function | |
| * does nothing. | | * does nothing. | |
| * | | * | |
| * \see isDataRecoveryAvailable(), recoverData() | | * \see isDataRecoveryAvailable(), recoverData() | |
| */ | | */ | |
| virtual void discardDataRecovery() = 0; | | virtual void discardDataRecovery() = 0; | |
| | | | |
|
| | | /** | |
| | | * TODO KDE5 (see SwapFile::setTrackingEnabled()) | |
| | | * Enables or disables the writing of swap files. | |
| | | * @note Enabling/disabling only works when the document is \e not modi | |
| | | fied! | |
| | | */ | |
| | | // void setDataRecoveryEnabled(bool enable); | |
| | | // bool dataRecoveryEnabled() const; | |
| | | | |
| private: | | private: | |
| class RecoveryInterfacePrivate* const d; | | class RecoveryInterfacePrivate* const d; | |
| }; | | }; | |
| | | | |
| } | | } | |
| | | | |
| Q_DECLARE_INTERFACE(KTextEditor::RecoveryInterface, "org.kde.KTextEditor.Re
coveryInterface") | | Q_DECLARE_INTERFACE(KTextEditor::RecoveryInterface, "org.kde.KTextEditor.Re
coveryInterface") | |
| | | | |
| #endif | | #endif | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 10 lines changed or added | |
|