2014-05-30 12:53:19 +04:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2014-12-01 13:47:38 +03:00
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
2014-05-30 12:53:19 +04:00
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
2015-10-03 16:16:42 +03:00
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2017-01-11 22:31:31 +04:00
|
|
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
2014-05-30 12:53:19 +04:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-04-06 17:38:10 +03:00
|
|
|
#include "boxes/abstract_box.h"
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2016-10-28 12:20:24 +03:00
|
|
|
namespace Ui {
|
2016-11-15 14:56:49 +03:00
|
|
|
class InputField;
|
|
|
|
class PortInput;
|
|
|
|
class PasswordInput;
|
2016-10-28 12:20:24 +03:00
|
|
|
class Checkbox;
|
2017-03-19 00:06:10 +03:00
|
|
|
template <typename Enum>
|
|
|
|
class RadioenumGroup;
|
|
|
|
template <typename Enum>
|
|
|
|
class Radioenum;
|
2016-10-28 12:20:24 +03:00
|
|
|
} // namespace Ui
|
|
|
|
|
2016-12-13 20:07:56 +03:00
|
|
|
class ConnectionBox : public BoxContent {
|
2014-05-30 12:53:19 +04:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-12-13 20:07:56 +03:00
|
|
|
ConnectionBox(QWidget *parent);
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2017-06-27 23:11:38 +03:00
|
|
|
static void ShowApplyProxyConfirmation(const QMap<QString, QString> &fields);
|
|
|
|
|
2015-04-02 13:33:19 +03:00
|
|
|
protected:
|
2016-12-13 20:07:56 +03:00
|
|
|
void prepare() override;
|
|
|
|
void setInnerFocus() override;
|
|
|
|
|
2016-08-16 19:53:10 +03:00
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2016-12-13 20:07:56 +03:00
|
|
|
private slots:
|
|
|
|
void onSubmit();
|
2017-06-28 01:03:37 +03:00
|
|
|
void onFieldFocus();
|
2016-12-13 20:07:56 +03:00
|
|
|
void onSave();
|
2015-04-02 13:33:19 +03:00
|
|
|
|
|
|
|
private:
|
2017-03-19 00:06:10 +03:00
|
|
|
void typeChanged(DBIConnectionType type);
|
2016-11-18 16:34:58 +03:00
|
|
|
void updateControlsVisibility();
|
2016-12-13 20:07:56 +03:00
|
|
|
void updateControlsPosition();
|
2017-06-28 01:03:37 +03:00
|
|
|
bool badProxyValue() const;
|
2016-11-18 16:34:58 +03:00
|
|
|
|
2016-12-13 20:07:56 +03:00
|
|
|
object_ptr<Ui::InputField> _hostInput;
|
|
|
|
object_ptr<Ui::PortInput> _portInput;
|
|
|
|
object_ptr<Ui::InputField> _userInput;
|
|
|
|
object_ptr<Ui::PasswordInput> _passwordInput;
|
2017-03-19 00:06:10 +03:00
|
|
|
std::shared_ptr<Ui::RadioenumGroup<DBIConnectionType>> _typeGroup;
|
|
|
|
object_ptr<Ui::Radioenum<DBIConnectionType>> _autoRadio;
|
|
|
|
object_ptr<Ui::Radioenum<DBIConnectionType>> _httpProxyRadio;
|
|
|
|
object_ptr<Ui::Radioenum<DBIConnectionType>> _tcpProxyRadio;
|
2016-12-13 20:07:56 +03:00
|
|
|
object_ptr<Ui::Checkbox> _tryIPv6;
|
2016-08-16 19:53:10 +03:00
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
};
|
2015-12-24 00:19:57 +03:00
|
|
|
|
2016-12-13 20:07:56 +03:00
|
|
|
class AutoDownloadBox : public BoxContent {
|
2015-12-24 00:19:57 +03:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-12-13 20:07:56 +03:00
|
|
|
AutoDownloadBox(QWidget *parent);
|
2015-12-24 00:19:57 +03:00
|
|
|
|
|
|
|
protected:
|
2016-12-13 20:07:56 +03:00
|
|
|
void prepare() override;
|
|
|
|
|
2016-08-16 19:53:10 +03:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2015-12-24 00:19:57 +03:00
|
|
|
|
2016-12-13 20:07:56 +03:00
|
|
|
private slots:
|
|
|
|
void onSave();
|
|
|
|
|
2015-12-24 00:19:57 +03:00
|
|
|
private:
|
2016-12-13 20:07:56 +03:00
|
|
|
object_ptr<Ui::Checkbox> _photoPrivate;
|
|
|
|
object_ptr<Ui::Checkbox> _photoGroups;
|
|
|
|
object_ptr<Ui::Checkbox> _audioPrivate;
|
|
|
|
object_ptr<Ui::Checkbox> _audioGroups;
|
|
|
|
object_ptr<Ui::Checkbox> _gifPrivate;
|
|
|
|
object_ptr<Ui::Checkbox> _gifGroups;
|
|
|
|
object_ptr<Ui::Checkbox> _gifPlay;
|
|
|
|
|
|
|
|
int _sectionHeight = 0;
|
2016-08-16 19:53:10 +03:00
|
|
|
|
2015-12-24 00:19:57 +03:00
|
|
|
};
|