LeechCraft
0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
vkcaptchadialog.cpp
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#include "
vkcaptchadialog.h
"
10
#include <QNetworkAccessManager>
11
#include <QNetworkRequest>
12
#include <QNetworkReply>
13
#include "ui_vkcaptchadialog.h"
14
15
namespace
LC::Util::SvcAuth
16
{
17
VkCaptchaDialog::VkCaptchaDialog
(
const
QVariantMap
&
errorMap
,
18
QNetworkAccessManager
*
nam
, QWidget *
w
)
19
:
VkCaptchaDialog
20
{
21
errorMap
[
QStringLiteral
(
"captcha_img"
)].toString (),
22
errorMap
[
QStringLiteral
(
"captcha_sid"
)].toString (),
23
nam
,
24
w
25
}
26
{
27
}
28
29
VkCaptchaDialog::VkCaptchaDialog
(
const
QUrl
&
url
,
30
const
QString
&
cid
,
QNetworkAccessManager
*
manager
, QWidget *parent)
31
: QDialog (parent)
32
, Ui_ (
std
::
make_unique
<
Ui
::
VkCaptchaDialog
> ())
33
, Cid_ (
cid
)
34
{
35
Ui_->setupUi (
this
);
36
37
auto
reply
=
manager
->get (
QNetworkRequest
(
url
));
38
connect
(
reply
,
39
&QNetworkReply::finished,
40
this
,
41
[
this
,
reply
]
42
{
43
reply
->deleteLater ();
44
45
QPixmap
px
;
46
px
.loadFromData (
reply
->readAll ());
47
Ui_->ImageLabel_->setPixmap (
px
);
48
});
49
}
50
51
VkCaptchaDialog::~VkCaptchaDialog
() =
default
;
52
53
void
VkCaptchaDialog::SetContextName
(
const
QString
&
context
)
54
{
55
setWindowTitle
(
tr
(
"CAPTCHA required for %1"
).
arg
(
context
));
56
}
57
58
void
VkCaptchaDialog::done
(
int
r
)
59
{
60
QDialog::done (
r
);
61
62
if
(
r
== DialogCode::Rejected)
63
emit
gotCaptcha
(Cid_, {});
64
else
65
emit
gotCaptcha
(Cid_, Ui_->Text_->text ());
66
67
deleteLater
();
68
}
69
}
LC::Util::SvcAuth::VkCaptchaDialog
Definition
vkcaptchadialog.h:27
LC::Util::SvcAuth::VkCaptchaDialog::~VkCaptchaDialog
~VkCaptchaDialog() override
LC::Util::SvcAuth::VkCaptchaDialog::done
void done(int) override
Definition
vkcaptchadialog.cpp:58
LC::Util::SvcAuth::VkCaptchaDialog::SetContextName
void SetContextName(const QString &)
Definition
vkcaptchadialog.cpp:53
LC::Util::SvcAuth::VkCaptchaDialog::VkCaptchaDialog
VkCaptchaDialog(const QVariantMap &errorMap, QNetworkAccessManager *, QWidget *=nullptr)
Definition
vkcaptchadialog.cpp:17
LC::Util::SvcAuth::VkCaptchaDialog::gotCaptcha
void gotCaptcha(const QString &cid, const QString &value)
LC::Util::SvcAuth
Definition
vkauthmanager.cpp:31
LC::Util::Filter
Container< T > Filter(const Container< T > &c, F f)
Definition
prelude.h:118
Ui
Definition
backendselector.h:16
std
STL namespace.
vkcaptchadialog.h
src
util
svcauth
vkcaptchadialog.cpp
Generated by
1.10.0