~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to libs/ksysguard/processcore/processes_remote_p.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  This file is part of the KDE project
 
2
 
 
3
    Copyright (C) 2007 John Tapsell <tapsell@kde.org>
 
4
 
 
5
    This library is free software; you can redistribute it and/or
 
6
    modify it under the terms of the GNU Library General Public
 
7
    License as published by the Free Software Foundation; either
 
8
    version 2 of the License, or (at your option) any later version.
 
9
 
 
10
    This library is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
    Library General Public License for more details.
 
14
 
 
15
    You should have received a copy of the GNU Library General Public License
 
16
    along with this library; see the file COPYING.LIB.  If not, write to
 
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
    Boston, MA 02110-1301, USA.
 
19
*/
 
20
 
 
21
#ifndef PROCESSES_REMOTE_P_H_
 
22
#define PROCESSES_REMOTE_P_H_
 
23
 
 
24
#include "processes_base_p.h"
 
25
#include <QSet>
 
26
class Process;
 
27
namespace KSysGuard
 
28
{
 
29
    /**
 
30
     * This is used to connect to a remote host
 
31
     */
 
32
    class ProcessesRemote : public AbstractProcesses {
 
33
      Q_OBJECT
 
34
      public:
 
35
        ProcessesRemote(const QString &hostname);
 
36
        virtual ~ProcessesRemote();
 
37
        virtual QSet<long> getAllPids();
 
38
        virtual long getParentPid(long pid);
 
39
        virtual bool updateProcessInfo(long pid, Process *process);
 
40
        virtual bool sendSignal(long pid, int sig);
 
41
        virtual bool setNiceness(long pid, int priority);
 
42
        virtual bool setScheduler(long pid, int priorityClass, int priority);
 
43
        virtual long long totalPhysicalMemory();
 
44
        virtual bool setIoNiceness(long pid, int priorityClass, int priority);
 
45
        virtual bool supportsIoNiceness();
 
46
        virtual long numberProcessorCores();
 
47
    virtual void updateAllProcesses( Processes::UpdateFlags updateFlags );
 
48
 
 
49
 
 
50
      Q_SIGNALS:
 
51
        /** For a remote machine, we rely on being able to communicate with ksysguardd.
 
52
         *  This must be dealt with by the program including this widget.  It must listen to our
 
53
         *  'runCommand' signal, and run the given command, with the given id. */
 
54
        void runCommand(const QString &command, int id);
 
55
 
 
56
      public Q_SLOTS:
 
57
        /** For a remote machine, we rely on being able to communicate with ksysguardd.
 
58
         *  The programming using this must call this slot when an answer is received from ksysguardd,
 
59
         *  in response to a runCommand request.  The id identifies the answer */
 
60
        void answerReceived( int id, const QList<QByteArray>& answer );
 
61
        /** Called soon after */
 
62
        void setup();
 
63
 
 
64
      protected:
 
65
        enum { PsInfo, Ps, UsedMemory, FreeMemory, Kill, Renice, Ionice };
 
66
 
 
67
      private:
 
68
        /**
 
69
         * You can use this for whatever data you want.  Be careful about preserving state in between getParentPid and updateProcessInfo calls
 
70
         * if you chose to do that. getParentPid may be called several times for different pids before the relevant updateProcessInfo calls are made.
 
71
         * This is because the tree structure has to be sorted out first.
 
72
         */
 
73
        class Private;
 
74
        Private *d;
 
75
 
 
76
    };
 
77
}
 
78
#endif