• 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
  • kcmremotecontrol
model.h
Go to the documentation of this file.
1 
2 /*************************************************************************
3  * Copyright (C) 2009 by Frank Scheffold <fscheffold@googlemail.com> *
4  * Copyright (C) 2009 by Michael Zanetti <michael_zanetti@gmx.net> *
5  * *
6  * This program is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU General Public License as *
8  * published by the Free Software Foundation; either version 2 of *
9  * the License or (at your option) version 3 or any later version *
10  * accepted by the membership of KDE e.V. (or its successor approved *
11  * by the membership of KDE e.V.), which shall act as a proxy *
12  * defined in Section 14 of version 3 of the license. *
13  * *
14  * This program is distributed in the hope that it will be useful, *
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17  * GNU General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU General Public License *
20  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
21  *************************************************************************/
22 
29 #ifndef MODEL_H
30 #define MODEL_H
31 
32 
33 #include "prototype.h"
34 #include "profileaction.h"
35 #include "profile.h"
36 #include "remotelist.h"
37 
38 #include "remotecontrol.h"
39 
40 #include <QtGui/QItemDelegate>
41 #include <QtGui/QStandardItem>
42 #include <QtGui/QStringListModel>
43 
44 Q_DECLARE_METATYPE(ProfileActionTemplate*)
45 Q_DECLARE_METATYPE(RemoteControlButton*)
46 
47 class DBusServiceModel: public QStandardItemModel
48 {
49  public:
50  DBusServiceModel(QObject* parent = 0);
51  QString application(const QModelIndex &index) const;
52  QString node(const QModelIndex &index) const;
53 
54  QModelIndex findOrInsert(const DBusAction *action, bool insert = false);
55 };
56 
57 class DBusServiceItem : public QStandardItem
58 {
59 
60  private:
61  static QString trimAppname(const QString &appName);
62 
63  public:
64  DBusServiceItem(const QString &item);
65  DBusServiceItem(const QString &item, const QStringList &objects);
66 
67  virtual QVariant data(int role) const;
68 };
69 
70 class DBusFunctionModel: public QStandardItemModel
71 {
72  public:
73  DBusFunctionModel(QObject *parent);
74 
75  void refresh(const QString &app, const QString &node);
76 
77  Prototype getPrototype( int index ) const;
78  QString getInterface( int index ) const;
79  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
80 
81  QModelIndex findOrInsert(const DBusAction *action, bool insert = false);
82 
83  private:
84  void appendRow(const QString &interface, Prototype item);
85 
86 };
87 
88 class ArgumentsModel: public QStandardItemModel
89 {
90  public:
91  ArgumentsModel(QObject *parent = 0);
92 
93  void refresh(const Prototype &prototype);
94  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
95 
96  QList<Argument> arguments() const;
97 };
98 
99 class ArgumentsModelItem: public QStandardItem
100 {
101  public:
102  ArgumentsModelItem(const QString &text);
103  ArgumentsModelItem(const Argument &arg);
104  virtual QVariant data(int role = Qt::UserRole + 1) const;
105 };
106 
107 class ArgumentDelegate : public QItemDelegate
108 {
109  Q_OBJECT
110 
111  public:
112  ArgumentDelegate(QObject *parent = 0);
113 
114  QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
115 
116  void setEditorData(QWidget *editor, const QModelIndex &index) const;
117  void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
118 
119  void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
120 
121 };
122 
123 class ProfileModel: public QStandardItemModel
124 {
125  public:
126  ProfileModel(QObject *parent = 0);
127 
128  Profile *profile(const QModelIndex &index) const;
129  QModelIndex find(const ProfileAction *action) const;
130 };
131 
132 class ActionTemplateModel: public QStandardItemModel
133 {
134  public:
135  ActionTemplateModel(QObject *parent=0);
136  explicit ActionTemplateModel(const Profile *profile, QObject *parent=0);
137 
138  void refresh(const Profile *profile);
139  ProfileActionTemplate actionTemplate(const QModelIndex &index) const;
140  QModelIndex find(const ProfileAction *action) const;
141  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
142  void appendRow(ProfileActionTemplate actionTemplate);
143  Qt::ItemFlags flags(const QModelIndex& index) const;
144 };
145 
146 class RemoteModel: public QStandardItemModel
147 {
148  Q_OBJECT
149  public:
150  explicit RemoteModel(const RemoteList &remoteList, QObject *parent = 0);
151  RemoteModel(QObject *parent=0);
152  void refresh(const RemoteList &remoteList);
153 
154  Remote *remote(const QModelIndex &index) const;
155  Mode *mode(const QModelIndex &index) const;
156  QModelIndex find(Mode *mode) const;
157 
158  virtual QVariant data(const QModelIndex &index, int role) const;
159  Qt::ItemFlags flags(const QModelIndex &index) const;
160  bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
161  QStringList mimeTypes() const;
162  Qt::DropActions supportedDropActions() const;
163 
164  Q_SIGNALS:
165  void modeChanged(Mode *mode);
166 };
167 
168 class RemoteItem: public QStandardItem
169 {
170  public:
171  RemoteItem(Remote *remote);
172  virtual QVariant data(int role) const;
173 };
174 
175 class ActionModel: public QStandardItemModel
176 {
177  public:
178  ActionModel(QObject *parent = 0);
179  void refresh(Mode *mode);
180 
181  QVariant data(const QModelIndex &index, int role) const;
182 
183  Action *action(const QModelIndex &index) const;
184  QModelIndex find(Action *action) const;
185  Qt::ItemFlags flags(const QModelIndex &index) const;
186  QMimeData *mimeData(const QModelIndexList &indexes) const;
187  Qt::DropActions supportedDragActions() const;
188 
189  private:
190  Mode *m_mode;
191 };
192 
193 #endif /* MODEL_H_ */
194 
ActionModel::action
Action * action(const QModelIndex &index) const
Definition: model.cpp:816
RemoteModel::supportedDropActions
Qt::DropActions supportedDropActions() const
Definition: model.cpp:741
Argument
Definition: argument.h:27
ActionModel::ActionModel
ActionModel(QObject *parent=0)
Definition: model.cpp:787
DBusFunctionModel::findOrInsert
QModelIndex findOrInsert(const DBusAction *action, bool insert=false)
Definition: model.cpp:205
ProfileActionTemplate
Definition: profileactiontemplate.h:31
ArgumentDelegate::createEditor
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: model.cpp:304
ActionTemplateModel::refresh
void refresh(const Profile *profile)
Definition: model.cpp:541
DBusFunctionModel::DBusFunctionModel
DBusFunctionModel(QObject *parent)
Definition: model.cpp:155
RemoteModel::remote
Remote * remote(const QModelIndex &index) const
Definition: model.cpp:636
RemoteModel::modeChanged
void modeChanged(Mode *mode)
ActionTemplateModel::ActionTemplateModel
ActionTemplateModel(QObject *parent=0)
Definition: model.cpp:534
ArgumentDelegate::setEditorData
void setEditorData(QWidget *editor, const QModelIndex &index) const
Definition: model.cpp:367
DBusServiceItem
Definition: model.h:57
ActionModel
Definition: model.h:175
QWidget
Mode
Definition: mode.h:31
ActionModel::data
QVariant data(const QModelIndex &index, int role) const
Definition: model.cpp:801
RemoteItem::RemoteItem
RemoteItem(Remote *remote)
Definition: model.cpp:745
RemoteModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: model.cpp:702
ArgumentsModelItem::data
virtual QVariant data(int role=Qt::UserRole+1) const
Definition: model.cpp:462
ActionTemplateModel
Definition: model.h:132
QStandardItemModel
ProfileModel::find
QModelIndex find(const ProfileAction *action) const
Definition: model.cpp:515
RemoteModel::refresh
void refresh(const RemoteList &remoteList)
Definition: model.cpp:622
RemoteModel::RemoteModel
RemoteModel(const RemoteList &remoteList, QObject *parent=0)
Definition: model.cpp:616
ActionTemplateModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: model.cpp:600
QObject
ProfileModel::profile
Profile * profile(const QModelIndex &index) const
Definition: model.cpp:508
RemoteModel::mimeTypes
QStringList mimeTypes() const
Definition: model.cpp:735
RemoteModel::data
virtual QVariant data(const QModelIndex &index, int role) const
Definition: model.cpp:673
ArgumentsModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role) const
Definition: model.cpp:272
Action
Definition: action.h:30
remotelist.h
RemoteModel::mode
Mode * mode(const QModelIndex &index) const
Definition: model.cpp:646
DBusAction
Definition: dbusaction.h:32
DBusFunctionModel::refresh
void refresh(const QString &app, const QString &node)
Definition: model.cpp:159
Prototype
Definition: prototype.h:28
ArgumentDelegate
Definition: model.h:107
DBusServiceModel
Created on: 01.02.2009.
Definition: model.h:47
RemoteModel
Definition: model.h:146
RemoteItem::data
virtual QVariant data(int role) const
Definition: model.cpp:767
prototype.h
RemoteModel::dropMimeData
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Definition: model.cpp:710
ArgumentsModelItem
Definition: model.h:99
ActionModel::supportedDragActions
Qt::DropActions supportedDragActions() const
Definition: model.cpp:861
ArgumentsModel
Definition: model.h:88
profileaction.h
RemoteModel::find
QModelIndex find(Mode *mode) const
Definition: model.cpp:656
ProfileModel
Definition: model.h:123
ProfileModel::ProfileModel
ProfileModel(QObject *parent=0)
Definition: model.cpp:491
ArgumentsModel::arguments
QList< Argument > arguments() const
Definition: model.cpp:286
ActionModel::find
QModelIndex find(Action *action) const
Definition: model.cpp:823
DBusFunctionModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role) const
Definition: model.cpp:238
QItemDelegate
DBusFunctionModel
Definition: model.h:70
ArgumentsModel::ArgumentsModel
ArgumentsModel(QObject *parent=0)
Definition: model.cpp:258
ArgumentDelegate::ArgumentDelegate
ArgumentDelegate(QObject *parent=0)
Definition: model.cpp:301
remotecontrol.h
ActionTemplateModel::find
QModelIndex find(const ProfileAction *action) const
Definition: model.cpp:567
ArgumentDelegate::updateEditorGeometry
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: model.cpp:439
ArgumentsModelItem::ArgumentsModelItem
ArgumentsModelItem(const QString &text)
Definition: model.cpp:450
ActionModel::mimeData
QMimeData * mimeData(const QModelIndexList &indexes) const
Definition: model.cpp:843
profile.h
ProfileServer::profile
Profile * profile(const QString &profileId)
Definition: profileserver.cpp:93
ActionModel::refresh
void refresh(Mode *mode)
Definition: model.cpp:791
DBusServiceItem::DBusServiceItem
DBusServiceItem(const QString &item)
Definition: model.cpp:118
ActionModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: model.cpp:835
ArgumentsModel::refresh
void refresh(const Prototype &prototype)
Definition: model.cpp:261
Profile
Definition: profile.h:26
QStandardItem
DBusServiceItem::data
virtual QVariant data(int role) const
Definition: model.cpp:130
RemoteItem
Definition: model.h:168
DBusFunctionModel::getPrototype
Prototype getPrototype(int index) const
Definition: model.cpp:196
DBusFunctionModel::getInterface
QString getInterface(int index) const
Definition: model.cpp:200
ActionTemplateModel::actionTemplate
ProfileActionTemplate actionTemplate(const QModelIndex &index) const
Definition: model.cpp:563
ProfileAction
Definition: profileaction.h:26
RemoteList
Definition: remotelist.h:28
RemoteControlButton
Definition: remotecontrolbutton.h:30
ActionTemplateModel::appendRow
void appendRow(ProfileActionTemplate actionTemplate)
Definition: model.cpp:578
ActionTemplateModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role) const
Definition: model.cpp:549
ArgumentDelegate::setModelData
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Definition: model.cpp:410
Remote
Definition: remote.h:32
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