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

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • lib
  • marble
NewstuffModel.h
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2012 Dennis Nienhüser <earthwings@gentoo.org>
9 //
10 
11 #ifndef MARBLE_NEWSTUFFMODEL_H
12 #define MARBLE_NEWSTUFFMODEL_H
13 
14 #include "marble_export.h"
15 
16 #include <QAbstractListModel>
17 #include <QFileInfo>
18 
19 class QNetworkReply;
20 
21 namespace Marble
22 {
23 
24 class NewstuffModelPrivate;
25 
26 class MARBLE_EXPORT NewstuffModel : public QAbstractListModel
27 {
28  Q_OBJECT
29 
30  Q_PROPERTY(int count READ count NOTIFY countChanged)
31  Q_PROPERTY(QString provider READ provider WRITE setProvider NOTIFY providerChanged)
32  Q_PROPERTY(QString targetDirectory READ targetDirectory WRITE setTargetDirectory NOTIFY targetDirectoryChanged)
33  Q_PROPERTY(QString registryFile READ registryFile WRITE setRegistryFile NOTIFY registryFileChanged)
34 
35 public:
36  enum NewstuffRoles {
37  Name = Qt::UserRole + 1,
38  Author,
39  License,
40  Summary,
41  Version,
42  ReleaseDate,
43  Preview,
44  Payload,
45  InstalledVersion,
46  InstalledReleaseDate,
47  InstalledFiles,
48  IsInstalled,
49  IsUpgradable,
50  Category,
51  IsTransitioning,
52  PayloadSize,
53  DownloadedSize
54  };
55 
56  enum IdTag {
57  PayloadTag,
58  NameTag
59  };
60 
62  explicit NewstuffModel( QObject *parent = 0 );
63 
65  ~NewstuffModel();
66 
68  int rowCount ( const QModelIndex &parent = QModelIndex() ) const;
69 
71  QVariant data ( const QModelIndex &index, int role = Qt::DisplayRole ) const;
72 
73 #if QT_VERSION >= 0x050000
74 
75  QHash<int, QByteArray> roleNames() const;
76 #endif
77 
79  int count();
80 
84  void setProvider( const QString &downloadUrl );
85 
86  QString provider() const;
87 
88  void setTargetDirectory( const QString &targetDirectory );
89 
90  QString targetDirectory() const;
91 
92  void setRegistryFile( const QString &registryFile, IdTag idTag = PayloadTag );
93 
94  QString registryFile() const;
95 
96 public Q_SLOTS:
97  void install( int index );
98 
99  void uninstall( int index );
100 
101  void cancel( int index );
102 
103 Q_SIGNALS:
104  void countChanged();
105 
106  void providerChanged();
107 
108  void targetDirectoryChanged();
109 
110  void registryFileChanged();
111 
112  void installationProgressed( int newstuffindex, qreal progress );
113 
114  void installationFinished( int newstuffindex );
115 
116  void installationFailed( int newstuffindex, const QString &error );
117 
118  void uninstallationFinished( int newstuffindex );
119 
120 private Q_SLOTS:
121  void updateProgress( qint64 bytesReceived, qint64 bytesTotal );
122 
123  void retrieveData();
124 
125  void mapInstalled( int exitStatus );
126 
127  void mapUninstalled();
128 
129  void contentsListed( int exitStatus );
130 
131 private:
132  NewstuffModelPrivate* const d;
133  friend class NewstuffModelPrivate;
134 
135  Q_PRIVATE_SLOT( d, void handleProviderData( QNetworkReply* ) )
136 };
137 
138 }
139 
140 #endif // MARBLE_NEWSTUFFMODEL_H
Marble::NewstuffModel::IsTransitioning
Definition: NewstuffModel.h:51
Marble::NewstuffModel::IsInstalled
Definition: NewstuffModel.h:48
Marble::NewstuffModel::NewstuffRoles
NewstuffRoles
Definition: NewstuffModel.h:36
Marble::NewstuffModel
Definition: NewstuffModel.h:26
Marble::NewstuffModel::InstalledReleaseDate
Definition: NewstuffModel.h:46
QObject
Marble::NewstuffModel::InstalledFiles
Definition: NewstuffModel.h:47
Marble::NewstuffModel::ReleaseDate
Definition: NewstuffModel.h:42
Marble::NewstuffModel::PayloadSize
Definition: NewstuffModel.h:52
Marble::NewstuffModel::License
Definition: NewstuffModel.h:39
MARBLE_EXPORT
#define MARBLE_EXPORT
Definition: marble_export.h:20
Marble::NewstuffModel::Preview
Definition: NewstuffModel.h:43
Marble::NewstuffModel::Author
Definition: NewstuffModel.h:38
Marble::NewstuffModel::Summary
Definition: NewstuffModel.h:40
Marble::NewstuffModel::Category
Definition: NewstuffModel.h:50
Marble::NewstuffModel::PayloadTag
Definition: NewstuffModel.h:57
marble_export.h
Marble::NewstuffModel::InstalledVersion
Definition: NewstuffModel.h:45
Marble::NewstuffModel::Payload
Definition: NewstuffModel.h:44
Marble::NewstuffModel::Version
Definition: NewstuffModel.h:41
Marble::NewstuffModel::IsUpgradable
Definition: NewstuffModel.h:49
Marble::NewstuffModel::IdTag
IdTag
Definition: NewstuffModel.h:56
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

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