KNewStuff

uploaddialog.h
1 /*
2  knewstuff3/ui/uploaddialog.h.
3  SPDX-FileCopyrightText: 2002 Cornelius Schumacher <[email protected]>
4  SPDX-FileCopyrightText: 2007 Josef Spillner <[email protected]>
5  SPDX-FileCopyrightText: 2009 Jeremy Whiting <[email protected]>
6  SPDX-FileCopyrightText: 2009-2010 Frederik Gladhorn <[email protected]>
7 
8  SPDX-License-Identifier: LGPL-2.1-or-later
9 */
10 #ifndef KNEWSTUFF3_UI_UPLOADDIALOG_H
11 #define KNEWSTUFF3_UI_UPLOADDIALOG_H
12 
13 #include <QDialog>
14 #include <QUrl>
15 
16 #include "knewstuff_export.h"
17 
18 namespace Attica
19 {
20 class BaseJob;
21 class Provider;
22 }
23 
24 // KDE5: this class should inherit from the wizard class - KAssistantDialog
25 
26 namespace KNS3
27 {
28 class UploadDialogPrivate;
29 /**
30  * @short KNewStuff file upload dialog.
31  *
32  * Using this dialog, data can easily be uploaded to the Hotstuff servers.
33  *
34  * \par Maintainer:
35  * Jeremy Whiting ([email protected])
36  *
37  * @since 4.4
38  */
39 class KNEWSTUFF_EXPORT UploadDialog : public QDialog
40 {
41  Q_OBJECT
42 public:
43  /**
44  Create a new upload dialog.
45 
46  @param parent the parent window
47  */
48  explicit UploadDialog(QWidget *parent = nullptr);
49 
50  /**
51  Create a new upload dialog.
52 
53  @param parent the parent window
54  */
55  explicit UploadDialog(const QString &configFile, QWidget *parent = nullptr);
56 
57  /**
58  Destructor.
59  */
60  ~UploadDialog() override;
61 
62  /**
63  Set the file to be uploaded.
64  This has to be set for the dialog to work, before displaying the dialog.
65 
66  @param payloadFile the payload data file
67  */
68  void setUploadFile(const QUrl &payloadFile);
69 
70  /**
71  Set the suggested title for the upload.
72  The application can suggest a title which can then be edited by the user before uploading.
73  The name field will be left empty if no title was set.
74 
75  @param name the suggested name for the upload
76  */
77  void setUploadName(const QString &name);
78 
79  /**
80  Set the suggested version displayed in the upload dialog.
81  The user can still change this.
82  @param version
83  */
84  void setVersion(const QString &version);
85 
86  /**
87  Set the suggested description displayed in the upload dialog.
88  The user can still change this.
89  @param description
90  */
91  void setDescription(const QString &description);
92 
93  /**
94  Set the suggested changelog displayed in the upload dialog.
95  The user can still change this.
96  @param version version
97  */
98  void setChangelog(const QString &changelog);
99 
100  /**
101  Set one of the three preview images displayed in the upload dialog.
102  The user can still change this.
103  @param number The number of the preview image to set, either 1, 2, or 3.
104  @param file A URL to the file to be used as preview image
105  @since 4.6
106  */
107  void setPreviewImageFile(uint number, const QUrl &file);
108 
109  /**
110  Enable the UI to let the user to set a price for the uploaded item.
111  @param enabled enable the price option - it is enabled by default
112  @since 4.5
113  */
114  void setPriceEnabled(bool enabled);
115 
116  /**
117  Set the suggested price displayed in the upload dialog.
118  The user can still change this.
119  @param version version
120  */
121  void setPrice(double price);
122 
123  /**
124  Set the suggested rationale why this item costs something to download.
125  The user can still change this.
126  @param version version
127  */
128  void setPriceReason(const QString &reason);
129 
130  /**
131  Set the suggested category for the upload.
132  The .knsrc file may contain multiple upload categories, this sets which one is pre-selected.
133  It does not add any new category to the list of available categories.
134 
135  @param category the suggested category for the upload
136  */
137  void selectCategory(const QString &category);
138 
139 public Q_SLOTS:
140  void accept() override;
141 
142 private:
143  bool init(const QString &configfile);
144 
145  UploadDialogPrivate *const d;
146 
147  Q_PRIVATE_SLOT(d, void _k_nextPage())
148  Q_PRIVATE_SLOT(d, void _k_backPage())
149  Q_PRIVATE_SLOT(d, void _k_updatePage())
150 
151  Q_PRIVATE_SLOT(d, void _k_providerChanged(QString))
152  Q_PRIVATE_SLOT(d, void _k_checkCredentialsFinished(bool))
153  Q_PRIVATE_SLOT(d, void _k_contentByCurrentUserLoaded(Attica::Content::List))
154  Q_PRIVATE_SLOT(d, void _k_providersLoaded(QStringList))
155  Q_PRIVATE_SLOT(d, void _k_categoriesLoaded(Attica::Category::List))
156  Q_PRIVATE_SLOT(d, void _k_licensesLoaded(Attica::License::List))
157  Q_PRIVATE_SLOT(d, void _k_currencyLoaded(QString))
158  Q_PRIVATE_SLOT(d, void _k_previewLoaded(int, QImage))
159 
160  Q_PRIVATE_SLOT(d, void _k_changePreview1())
161  Q_PRIVATE_SLOT(d, void _k_changePreview2())
162  Q_PRIVATE_SLOT(d, void _k_changePreview3())
163  Q_PRIVATE_SLOT(d, void _k_priceToggled(bool))
164  Q_PRIVATE_SLOT(d, void _k_updateContentsToggled(bool update))
165 
166  Q_PRIVATE_SLOT(d, void _k_startUpload())
167  Q_PRIVATE_SLOT(d, void _k_contentAdded(Attica::BaseJob *))
168  Q_PRIVATE_SLOT(d, void _k_fileUploadFinished(Attica::BaseJob *))
169  Q_PRIVATE_SLOT(d, void _k_preview1UploadFinished(Attica::BaseJob *))
170  Q_PRIVATE_SLOT(d, void _k_preview2UploadFinished(Attica::BaseJob *))
171  Q_PRIVATE_SLOT(d, void _k_preview3UploadFinished(Attica::BaseJob *))
172 
173  Q_PRIVATE_SLOT(d, void _k_updatedContentFetched(Attica::Content))
174  Q_PRIVATE_SLOT(d, void _k_detailsLinkLoaded(QUrl))
175 
176  Q_PRIVATE_SLOT(d, void _k_openRegisterAccountWebpage(QString))
177 
178  Q_DISABLE_COPY(UploadDialog)
179 };
180 
181 }
182 
183 #endif
KNewStuff file upload dialog.
Definition: uploaddialog.h:39
QCA_EXPORT void init()
The namespace for the KNewStuff classes.
Definition: button.cpp:19
Definition: engine.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed May 12 2021 22:41:40 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.