~ubuntu-branches/debian/stretch/knewstuff/stretch

« back to all changes in this revision

Viewing changes to src/uploaddialog_p.h

  • Committer: Package Import Robot
  • Author(s): Scarlett Clark
  • Date: 2014-07-15 16:22:19 UTC
  • Revision ID: package-import@ubuntu.com-20140715162219-y23ejdtgskj0wwzq
Tags: upstream-5.0.0
ImportĀ upstreamĀ versionĀ 5.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (C) 2010 Frederik Gladhorn <gladhorn@kde.org>
 
3
 
 
4
    This library is free software; you can redistribute it and/or
 
5
    modify it under the terms of the GNU Lesser General Public
 
6
    License as published by the Free Software Foundation; either
 
7
    version 2.1 of the License, or (at your option) any later version.
 
8
 
 
9
    This library 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 GNU
 
12
    Lesser General Public License for more details.
 
13
 
 
14
    You should have received a copy of the GNU Lesser General Public
 
15
    License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
16
*/
 
17
 
 
18
#ifndef KNEWSTUFF3_UI_UPLOADDIALOG_P_H
 
19
#define KNEWSTUFF3_UI_UPLOADDIALOG_P_H
 
20
 
 
21
#include "upload/atticahelper_p.h"
 
22
#include "ui_uploaddialog.h"
 
23
 
 
24
#include <attica/providermanager.h>
 
25
#include <attica/provider.h>
 
26
#include <attica/category.h>
 
27
#include <attica/content.h>
 
28
#include <attica/listjob.h>
 
29
#include <attica/license.h>
 
30
#include <attica/postjob.h>
 
31
 
 
32
#include <QUrl>
 
33
 
 
34
class QDialogButtonBox;
 
35
class QPushButton;
 
36
class KPixmapSequenceWidget;
 
37
 
 
38
namespace KNS3
 
39
{
 
40
class UploadDialog::Private
 
41
{
 
42
public:
 
43
    Private(UploadDialog *q)
 
44
        : q(q)
 
45
        , currentPage(UserPasswordPage)
 
46
        , finished(false)
 
47
        , finishedPreview1(false)
 
48
        , finishedPreview2(false)
 
49
        , finishedPreview3(false)
 
50
        , finishedContents(false)
 
51
    {
 
52
    }
 
53
 
 
54
    UploadDialog *q;
 
55
 
 
56
    enum WizardPage {
 
57
        UserPasswordPage,
 
58
        FileNewUpdatePage,
 
59
        Details1Page,
 
60
        Details2Page,
 
61
        UploadFinalPage
 
62
    };
 
63
    WizardPage currentPage;
 
64
 
 
65
    Attica::Provider currentProvider()
 
66
    {
 
67
        return atticaHelper->provider();
 
68
    }
 
69
 
 
70
    Ui::UploadDialog ui;
 
71
    QDialogButtonBox *buttonBox;
 
72
    QPushButton *finishButton;
 
73
    QPushButton *nextButton;
 
74
    QPushButton *backButton;
 
75
    KPixmapSequenceWidget *busyWidget;
 
76
 
 
77
    AtticaHelper *atticaHelper;
 
78
 
 
79
    QUrl uploadFile;
 
80
    QUrl previewFile1;
 
81
    QUrl previewFile2;
 
82
    QUrl previewFile3;
 
83
    QStringList categoryNames;
 
84
    Attica::Category::List categories;
 
85
    QString contentId;
 
86
    bool finished;
 
87
    bool finishedPreview1;
 
88
    bool finishedPreview2;
 
89
    bool finishedPreview3;
 
90
    bool finishedContents;
 
91
 
 
92
    bool init(const QString &configfile);
 
93
    void setBusy(const QString &message);
 
94
    void setIdle(const QString &message);
 
95
 
 
96
    // change to page, set the focus also calls updatePage()
 
97
    void _k_showPage(int page);
 
98
 
 
99
    // check after user input - for example enable the next button
 
100
    void _k_updatePage();
 
101
 
 
102
    // next wizard page (next button clicked)
 
103
    void _k_nextPage();
 
104
    // go back one page
 
105
    void _k_backPage();
 
106
 
 
107
    // after all has been done and said, do the uploading
 
108
    void _k_startUpload();
 
109
 
 
110
    void _k_providersLoaded(const QStringList &providerNames);
 
111
    void _k_providerChanged(const QString &providerName);
 
112
 
 
113
    // validation of login is done, go to next page if successful, otherwise ask again
 
114
    void _k_checkCredentialsFinished(bool);
 
115
    void _k_categoriesLoaded(const Attica::Category::List &loadedCategories);
 
116
    void _k_licensesLoaded(const Attica::License::List &licenses);
 
117
    void _k_currencyLoaded(const QString &currency);
 
118
    void _k_contentByCurrentUserLoaded(const Attica::Content::List &contentList);
 
119
    void _k_updatedContentFetched(const Attica::Content &content);
 
120
    void _k_previewLoaded(int index, const QImage &image);
 
121
 
 
122
    void _k_changePreview1();
 
123
    void _k_changePreview2();
 
124
    void _k_changePreview3();
 
125
    void _k_preview1UploadFinished(Attica::BaseJob *);
 
126
    void _k_preview2UploadFinished(Attica::BaseJob *);
 
127
    void _k_preview3UploadFinished(Attica::BaseJob *);
 
128
 
 
129
    void _k_contentAdded(Attica::BaseJob *);
 
130
    void _k_fileUploadFinished(Attica::BaseJob *);
 
131
 
 
132
    void uploadFileFinished();
 
133
    void doUpload(const QString &index, const QUrl &filePath);
 
134
 
 
135
    void _k_priceToggled(bool);
 
136
    void _k_updateContentsToggled(bool update);
 
137
    void _k_detailsLinkLoaded(const QUrl &url);
 
138
 
 
139
    void getAccountBalance();
 
140
    void _k_accountBalanceFetched(Attica::BaseJob *baseJob);
 
141
 
 
142
    void _k_openRegisterAccountWebpage(QString);
 
143
 
 
144
    QStringList _supportedMimeTypes() const;
 
145
};
 
146
}
 
147
 
 
148
#endif