• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

kremotecontrol

  • sources
  • kde-4.12
  • kdeutils
  • kremotecontrol
  • libkremotecontrol
profile.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 Michael Zanetti <michael_zanetti@gmx.net>
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 
18 */
19 
20 #include "profile.h"
21 
22 #include <kdebug.h>
23 
24 Profile::Profile() {
25 
26 }
27 
28 Profile::Profile(const QString &profileId, const QString &name, const QString &version, const QString &author, const QString &description)
29  :m_profileId(profileId), m_name(name), m_version(ProfileVersion(version)), m_author(author), m_description(description){
30 }
31 
32 void Profile::setProfileId(const QString& profileId) {
33  m_profileId = profileId;
34 }
35 
36 void Profile::setName(const QString& name) {
37  m_name = name;
38 }
39 
40 void Profile::setVersion(const QString& version) {
41  m_version = ProfileVersion(version);
42 }
43 
44 void Profile::setAuthor(const QString& author) {
45  m_author = author;
46 }
47 
48 void Profile::setDescription(const QString& description) {
49  m_description = description;
50 }
51 
52 void Profile::setActionTemplates(const QList< ProfileActionTemplate >& actionTemplates) {
53  m_actionTemplates = actionTemplates;
54 }
55 
56 QString Profile::name() const {
57  return m_name;
58 }
59 
60 QString Profile::author() const {
61  return m_author;
62 }
63 
64 QString Profile::description() const {
65  return m_description;
66 }
67 
68 QString Profile::profileId() const {
69  return m_profileId;
70 }
71 
72 void Profile::addTemplate(const ProfileActionTemplate &applicationTemplate) {
73  m_actionTemplates.append(applicationTemplate);
74 }
75 
76 QList< ProfileActionTemplate > Profile::actionTemplates() const {
77  return m_actionTemplates;
78 }
79 
80 ProfileActionTemplate Profile::actionTemplateByButton(const QString &buttonName) const {
81  foreach(const ProfileActionTemplate &actionTemplate, m_actionTemplates){
82  if(actionTemplate.buttonName() == buttonName){
83  return actionTemplate;
84  }
85  }
86  return ProfileActionTemplate();
87 }
88 
89 ProfileActionTemplate Profile::actionTemplate(const QString& actionTemplateId) {
90  foreach(const ProfileActionTemplate &actionTemplate, m_actionTemplates){
91  if(actionTemplate.actionTemplateId() == actionTemplateId){
92  return actionTemplate;
93  }
94  }
95  return ProfileActionTemplate();
96 }
97 
98 QString Profile::version() const {
99  return m_version.toString();
100 }
101 
102 int Profile::compareVersion(Profile* other) const {
103  return m_version == other->version();
104 }
105 
106 int Profile::ProfileVersion::operator==(const Profile::ProfileVersion& other) const {
107  if(m_major == other.m_major){
108  if(m_minor > other.m_minor){
109  return 1;
110  } else if(m_minor < other.m_minor) {
111  return -1;
112  }
113  } else {
114  if(m_major > other.m_major){
115  return 1;
116  } else if(m_major < other.m_major) {
117  return -1;
118  }
119  }
120  return 0;
121 }
122 
123 Profile::ProfileVersion::ProfileVersion(const QString& version) {
124  QStringList split= version.split(QLatin1Char( '.' ));
125  m_major = split.at(0).toInt();
126  m_minor = split.at(1).toInt();
127 }
128 
129 QString Profile::ProfileVersion::toString() const {
130  return QString().setNum(m_major) + QLatin1Char( '.' ) + QString().setNum(m_minor);
131 }
ProfileActionTemplate
Definition: profileactiontemplate.h:31
Profile::actionTemplateByButton
ProfileActionTemplate actionTemplateByButton(const QString &buttonName) const
Definition: profile.cpp:80
Profile::addTemplate
void addTemplate(const ProfileActionTemplate &actionTemplate)
Definition: profile.cpp:72
Profile::setName
void setName(const QString &name)
Definition: profile.cpp:36
ProfileActionTemplate::actionTemplateId
QString actionTemplateId() const
Definition: profileactiontemplate.cpp:62
Profile::setProfileId
void setProfileId(const QString &profileId)
Definition: profile.cpp:32
Profile::Profile
Profile()
Definition: profile.cpp:24
Profile::setAuthor
void setAuthor(const QString &author)
Definition: profile.cpp:44
Profile::setActionTemplates
void setActionTemplates(const QList< ProfileActionTemplate > &actionTemplates)
Definition: profile.cpp:52
Profile::compareVersion
int compareVersion(Profile *other) const
Definition: profile.cpp:102
ProfileActionTemplate::buttonName
QString buttonName() const
Definition: profileactiontemplate.cpp:103
Profile::setDescription
void setDescription(const QString &description)
Definition: profile.cpp:48
Profile::author
QString author() const
Definition: profile.cpp:60
Profile::actionTemplates
QList< ProfileActionTemplate > actionTemplates() const
Definition: profile.cpp:76
Profile::profileId
QString profileId() const
Definition: profile.cpp:68
Profile::version
QString version() const
Definition: profile.cpp:98
profile.h
Profile::setVersion
void setVersion(const QString &version)
Definition: profile.cpp:40
Profile
Definition: profile.h:26
Profile::name
QString name() const
Definition: profile.cpp:56
Profile::description
QString description() const
Definition: profile.cpp:64
Profile::actionTemplate
ProfileActionTemplate actionTemplate(const QString &actionTemplateId)
Definition: profile.cpp:89
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kremotecontrol

Skip menu "kremotecontrol"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • kremotecontrol
  • ktimer
  • kwallet
  • superkaramba
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal