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

marble

  • kde-4.x
  • 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 <[email protected]>
9 //
10 
11 #ifndef MARBLE_NEWSTUFFMODEL_H
12 #define MARBLE_NEWSTUFFMODEL_H
13 
14 #include "marble_export.h"
15 
16 #include <QAbstractListModel>
17 
18 class QNetworkReply;
19 
20 namespace Marble
21 {
22 
23 class NewstuffModelPrivate;
24 
25 class MARBLE_EXPORT NewstuffModel : public QAbstractListModel
26 {
27  Q_OBJECT
28 
29  Q_PROPERTY(int count READ count NOTIFY countChanged)
30  Q_PROPERTY(QString provider READ provider WRITE setProvider NOTIFY providerChanged)
31  Q_PROPERTY(QString targetDirectory READ targetDirectory WRITE setTargetDirectory NOTIFY targetDirectoryChanged)
32  Q_PROPERTY(QString registryFile READ registryFile WRITE setRegistryFile NOTIFY registryFileChanged)
33 
34 public:
35  enum NewstuffRoles {
36  Name = Qt::UserRole + 1,
37  Author,
38  License,
39  Summary,
40  Version,
41  ReleaseDate,
42  Preview,
43  Payload,
44  InstalledVersion,
45  InstalledReleaseDate,
46  InstalledFiles,
47  IsInstalled,
48  IsUpgradable,
49  Category,
50  IsTransitioning,
51  PayloadSize,
52  DownloadedSize
53  };
54 
55  enum IdTag {
56  PayloadTag,
57  NameTag
58  };
59 
61  explicit NewstuffModel( QObject *parent = nullptr );
62 
64  ~NewstuffModel() override;
65 
67  int rowCount ( const QModelIndex &parent = QModelIndex() ) const override;
68 
70  QVariant data ( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
71 
73  QHash<int, QByteArray> roleNames() const override;
74 
76  int count() const;
77 
81  void setProvider( const QString &downloadUrl );
82 
83  QString provider() const;
84 
85  void setTargetDirectory( const QString &targetDirectory );
86 
87  QString targetDirectory() const;
88 
89  void setRegistryFile( const QString &registryFile, IdTag idTag = PayloadTag );
90 
91  QString registryFile() const;
92 
93 public Q_SLOTS:
94  void install( int index );
95 
96  void uninstall( int index );
97 
98  void cancel( int index );
99 
100 Q_SIGNALS:
101  void countChanged();
102 
103  void providerChanged();
104 
105  void targetDirectoryChanged();
106 
107  void registryFileChanged();
108 
109  void installationProgressed( int newstuffindex, qreal progress );
110 
111  void installationFinished( int newstuffindex );
112 
113  void installationFailed( int newstuffindex, const QString &error );
114 
115  void uninstallationFinished( int newstuffindex );
116 
117 private Q_SLOTS:
118  void updateProgress( qint64 bytesReceived, qint64 bytesTotal );
119 
120  void retrieveData();
121 
122  void mapInstalled( int exitStatus );
123 
124  void mapUninstalled();
125 
126  void contentsListed( int exitStatus );
127 
128 private:
129  NewstuffModelPrivate* const d;
130  friend class NewstuffModelPrivate;
131 
132  Q_PRIVATE_SLOT( d, void handleProviderData( QNetworkReply* ) )
133 };
134 
135 }
136 
137 #endif // MARBLE_NEWSTUFFMODEL_H
Marble::NewstuffModel::IsTransitioning
Definition: NewstuffModel.h:50
QModelIndex
Marble::NewstuffModel::IsInstalled
Definition: NewstuffModel.h:47
Marble::NewstuffModel::NewstuffRoles
NewstuffRoles
Definition: NewstuffModel.h:35
QNetworkReply
Marble::NewstuffModel
Definition: NewstuffModel.h:25
Marble::NewstuffModel::InstalledReleaseDate
Definition: NewstuffModel.h:45
Marble::NewstuffModel::InstalledFiles
Definition: NewstuffModel.h:46
Marble::NewstuffModel::ReleaseDate
Definition: NewstuffModel.h:41
Marble::NewstuffModel::PayloadSize
Definition: NewstuffModel.h:51
QHash< int, QByteArray >
Marble::NewstuffModel::License
Definition: NewstuffModel.h:38
QObject
QAbstractListModel
QString
Marble::NewstuffModel::Preview
Definition: NewstuffModel.h:42
Marble::NewstuffModel::Author
Definition: NewstuffModel.h:37
Marble::NewstuffModel::Summary
Definition: NewstuffModel.h:39
Marble::NewstuffModel::Category
Definition: NewstuffModel.h:49
Marble::NewstuffModel::PayloadTag
Definition: NewstuffModel.h:56
Marble::NewstuffModel::InstalledVersion
Definition: NewstuffModel.h:44
Marble::NewstuffModel::Payload
Definition: NewstuffModel.h:43
Marble::NewstuffModel::Version
Definition: NewstuffModel.h:40
Marble::Name
Definition: OsmRelationManagerWidget.h:29
Marble::NewstuffModel::IsUpgradable
Definition: NewstuffModel.h:48
Marble::NewstuffModel::IdTag
IdTag
Definition: NewstuffModel.h:55
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Wed Dec 11 2019 06:11:09 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
  •   KmPlot
  • libkeduvocdocument
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   src
  •   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