~ubuntu-branches/ubuntu/gutsy/kde4libs/gutsy

« back to all changes in this revision

Viewing changes to solid/examples/tutorial3/tutorial3.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-02-21 11:00:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070221110012-6kw8khr9knv6lmg1
Tags: 3.80.3-0ubuntu1
New upstream unstable release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  This file is part of the KDE project
 
2
    Copyright (C) 2007 Christopher Blauvelt <cblauvelt@gmail.com>
 
3
 
 
4
    This library is free software; you can redistribute it and/or
 
5
    modify it under the terms of the GNU Library General Public
 
6
    License version 2 as published by the Free Software Foundation.
 
7
 
 
8
    This library is distributed in the hope that it will be useful,
 
9
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
    Library General Public License for more details.
 
12
 
 
13
    You should have received a copy of the GNU Library General Public License
 
14
    along with this library; see the file COPYING.LIB.  If not, write to
 
15
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
16
    Boston, MA 02110-1301, USA.
 
17
 
 
18
*/
 
19
 
 
20
//QT specific includes
 
21
#include <QList>
 
22
 
 
23
//solid specific includes
 
24
#include <solid/devicemanager.h>
 
25
#include <solid/device.h>
 
26
#include <solid/capability.h>
 
27
#include <solid/processor.h>
 
28
 
 
29
//kde specific includes
 
30
#include <kcomponentdata.h>
 
31
#include <kcmdlineargs.h>
 
32
#include <klocale.h>
 
33
#include <kdebug.h>
 
34
 
 
35
#include <iostream>
 
36
 
 
37
using namespace std;
 
38
 
 
39
int main(int args, char **argv)
 
40
{
 
41
    KComponentData componentData("tutorial3");
 
42
    
 
43
    Solid::DeviceManager &manager = Solid::DeviceManager::self();
 
44
    
 
45
    //get a Processor
 
46
    Solid::DeviceList list = manager.findDevicesFromQuery("",Solid::Capability::Processor);
 
47
 
 
48
    //take the first processor
 
49
    Solid::Device device = list[0];
 
50
    if(device.is<Solid::Processor>() ) kDebug() << "We've got a processor!" << endl;
 
51
    else kDebug() << "Device is not a processor." << endl;
 
52
 
 
53
    Solid::Processor *processor = device.as<Solid::Processor>();
 
54
    kDebug() << "This processors maximum speed is: " << processor->maxSpeed() << endl;
 
55
    
 
56
    return 0;
 
57
}
 
58
 
 
59
#include "tutorial3.moc"