~ubuntu-branches/ubuntu/trusty/digikam/trusty

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/imgurexport/imgurtalker_common.h

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-11-26 18:24:20 UTC
  • mfrom: (1.9.1) (3.1.23 experimental)
  • Revision ID: package-import@ubuntu.com-20121126182420-qoy6z0nx4ai0wzcl
Tags: 4:3.0.0~beta3-0ubuntu1
* New upstream release
  - Add build-deps :  libhupnp-dev, libqtgstreamer-dev, libmagickcore-dev
* Merge from debian, remaining changes:
  - Make sure libqt4-opengl-dev, libgl1-mesa-dev and libglu1-mesa-dev only
    install on i386,amd64 and powerpc
  - Depend on libtiff-dev instead of libtiff4-dev
  - Drop digikam breaks/replaces kipi-plugins-common since we're past the
    LTS release now
  - digikam to recommend mplayerthumbs | ffmpegthumbs. We currently only
    have latter in the archives, even though former is also supposed to
    be part of kdemultimedia. (LP: #890059)
  - kipi-plugins to recommend www-browser rather than konqueror directly
    since 2.8 no direct usage of konqueror is present in the flickr
    plugin anymore (LP: #1011211)
  - Keep kubuntu_mysqld_executable_name.diff
  - Don't install libkipi translations
  - Keep deps on libcv-dev, libcvaux-dev
  - Keep split packaging of libraries
  - Replace icons from KDE 3 time in debian/xpm.d/*.xpm with the new
    versions (LP: #658047)
* Update debian/not-installed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of kipi-plugins project
 
4
 * http://www.kipi-plugins.org
 
5
 *
 
6
 * Date        : 2010-02-04
 
7
 * Description : a tool to export images to imgur.com
 
8
 *
 
9
 * Copyright (C) 2010-2012 by Marius Orcsik <marius at habarnam dot ro>
 
10
 *
 
11
 * This program is free software; you can redistribute it
 
12
 * and/or modify it under the terms of the GNU General
 
13
 * Public License as published by the Free Software Foundation;
 
14
 * either version 2, or (at your option) any later version.
 
15
 *
 
16
 * This program is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
 * GNU General Public License for more details.
 
20
 *
 
21
 * ============================================================ */
 
22
 
 
23
#ifndef IMGURTALKER_COMMON_H
 
24
#define IMGURTALKER_COMMON_H
 
25
 
 
26
// API key from imgur
 
27
#define _IMGUR_API_ANONYMOUS_KEY "2da1cc4923f33dc72885aa32adede5c3";
 
28
 
 
29
#ifdef OAUTH_ENABLED
 
30
    #define _IMGUR_API_CONSUMER_KEY "9ad9d48124b7137d9cc9e0397219f52004fcba12a";
 
31
    #define _IMGUR_API_CONSUMER_SECRET "26b83f19f6d045006d769869b9c623e0";
 
32
#endif //OAUTH_ENABLED
 
33
 
 
34
// Qt includes
 
35
 
 
36
#include <QDateTime>
 
37
#include <QString>
 
38
 
 
39
// KDE includes
 
40
 
 
41
#include <kurl.h>
 
42
 
 
43
namespace KIPIImgurExportPlugin
 
44
{
 
45
 
 
46
class ImgurConnection
 
47
{
 
48
public:
 
49
    static QString APIuploadURL() {return QString ("https://api.imgur.com/2/upload.json");}
 
50
    static QString APIdeleteURL() {return QString ("https://api.imgur.com/2/delete.json");}
 
51
    static QString OAuthTokenEndPoint() {return QString ("https://api.imgur.com/oauth/request_token");}
 
52
    static QString OAuthAccessEndPoint() {return QString ("https://api.imgur.com/oauth/access_token");}
 
53
    static QString OAuthAuthorizationEndPoint() {return QString ("https://api.imgur.com/oauth/authorize");}
 
54
 
 
55
    static KUrl originalURL(QString imageHash) { return KUrl ("http://i.imgur.com/" + imageHash + ".jpg"); } // this is wrong
 
56
    static KUrl pageURL(QString imageHash) { return KUrl ("http://imgur.com/" + imageHash);}
 
57
    static KUrl deleteURL(QString deleteHash) { return KUrl ("http://imgur.com/delete/" + deleteHash);}
 
58
};
 
59
/*
 
60
QString ImgurConnection::uploadURL = QString ("https://api.imgur.com/2/upload.json");
 
61
QString ImgurConnection::deleteURL = QString ("https://api.imgur.com/2/delete.json");
 
62
QString ImgurConnection::OAuthTokenEndPoint = QString ("https://api.imgur.com/oauth/request_token");
 
63
QString ImgurConnection::OAuthAccessEndPoint = QString ("https://api.imgur.com/oauth/access_token");
 
64
QString ImgurConnection::OAuthAuthorizationEndPoint = QString ("https://api.imgur.com/oauth/authorize");
 
65
*/
 
66
 
 
67
struct ImgurError
 
68
{
 
69
    enum ImgurMethod
 
70
    {
 
71
        POST = 0,
 
72
        GET,
 
73
        HEAD
 
74
    } method;
 
75
 
 
76
    enum ImgurFormat
 
77
    {
 
78
        XML = 0,
 
79
        JSON
 
80
    } format;
 
81
 
 
82
    QString  message;
 
83
    QString  request;
 
84
    QVariant parameters;
 
85
};
 
86
 
 
87
// -----------------------------------------------------------------------------
 
88
 
 
89
struct ImgurUploadData
 
90
{
 
91
    QString title;
 
92
    QString caption;
 
93
    KUrl    fileUrl;
 
94
};
 
95
 
 
96
// -----------------------------------------------------------------------------
 
97
 
 
98
struct ImgurSuccess
 
99
{
 
100
    struct ImgurImage
 
101
    {
 
102
        QString    name;
 
103
        QString    title;
 
104
        QString    caption;
 
105
        QString    hash;
 
106
        QString    deletehash;
 
107
        QDateTime  datetime;
 
108
        QString    type; // maybe enum
 
109
        bool       animated;
 
110
        uint       width;
 
111
        uint       height;
 
112
        uint       size;
 
113
        uint       views;
 
114
        qulonglong bandwidth;
 
115
    } image;
 
116
 
 
117
    struct ImgurLinks
 
118
    {
 
119
        KUrl original;
 
120
        KUrl imgur_page;
 
121
        KUrl delete_page;
 
122
        KUrl small_square;
 
123
        KUrl large_thumbnail;
 
124
    } links;
 
125
};
 
126
 
 
127
} // namespace KIPIImgurExportPlugin
 
128
 
 
129
#endif // IMGURTALKER_COMMON_H