2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-04-06 14:38:10 +00:00
|
|
|
#include "boxes/abstract_box.h"
|
|
|
|
#include "base/observer.h"
|
2016-08-17 15:14:08 +00:00
|
|
|
|
2016-10-28 09:20:24 +00:00
|
|
|
namespace Ui {
|
2017-03-18 21:06:10 +00:00
|
|
|
template <typename Enum>
|
|
|
|
class RadioenumGroup;
|
|
|
|
template <typename Enum>
|
|
|
|
class Radioenum;
|
2016-11-11 13:46:04 +00:00
|
|
|
class LinkButton;
|
2016-10-28 09:20:24 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2020-06-09 16:57:05 +00:00
|
|
|
namespace Window {
|
|
|
|
class SessionController;
|
|
|
|
} // namespace Window
|
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
class DownloadPathBox : public Ui::BoxContent {
|
2014-05-30 08:53:19 +00:00
|
|
|
public:
|
2020-06-09 16:57:05 +00:00
|
|
|
DownloadPathBox(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Window::SessionController*> controller);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
protected:
|
2016-12-13 17:07:56 +00:00
|
|
|
void prepare() override;
|
|
|
|
|
2016-08-16 16:53:10 +00:00
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
private:
|
2017-03-18 21:06:10 +00:00
|
|
|
enum class Directory {
|
|
|
|
Downloads,
|
|
|
|
Temp,
|
|
|
|
Custom,
|
|
|
|
};
|
|
|
|
void radioChanged(Directory value);
|
|
|
|
Directory typeFromPath(const QString &path) {
|
|
|
|
if (path.isEmpty()) {
|
|
|
|
return Directory::Downloads;
|
|
|
|
} else if (path == qsl("tmp")) {
|
|
|
|
return Directory::Temp;
|
|
|
|
}
|
|
|
|
return Directory::Custom;
|
|
|
|
}
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
void save();
|
2016-11-18 13:34:58 +00:00
|
|
|
void updateControlsVisibility();
|
2015-10-06 19:49:23 +00:00
|
|
|
void setPathText(const QString &text);
|
2018-10-31 07:12:04 +00:00
|
|
|
void editPath();
|
2015-10-06 19:49:23 +00:00
|
|
|
|
2020-06-09 16:57:05 +00:00
|
|
|
const not_null<Window::SessionController*> _controller;
|
2014-05-30 08:53:19 +00:00
|
|
|
QString _path;
|
2015-11-26 17:34:52 +00:00
|
|
|
QByteArray _pathBookmark;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2017-03-18 21:06:10 +00:00
|
|
|
std::shared_ptr<Ui::RadioenumGroup<Directory>> _group;
|
|
|
|
object_ptr<Ui::Radioenum<Directory>> _default;
|
|
|
|
object_ptr<Ui::Radioenum<Directory>> _temp;
|
|
|
|
object_ptr<Ui::Radioenum<Directory>> _dir;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::LinkButton> _pathLink;
|
2016-08-16 16:53:10 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
};
|