2016-08-19 17:26:31 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2017-01-11 18:31:31 +00:00
|
|
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
2016-08-19 17:26:31 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "settings/settings_block_widget.h"
|
2017-09-13 16:57:44 +00:00
|
|
|
#include "ui/rp_widget.h"
|
2016-08-22 17:16:21 +00:00
|
|
|
|
2016-08-19 17:26:31 +00:00
|
|
|
namespace Settings {
|
|
|
|
|
2016-08-27 17:52:05 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
2017-09-13 16:57:44 +00:00
|
|
|
class UpdateStateRow : public Ui::RpWidget {
|
2016-08-27 17:52:05 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
UpdateStateRow(QWidget *parent);
|
|
|
|
|
|
|
|
bool isUpdateReady() const {
|
|
|
|
return (_state == State::Ready);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int resizeGetHeight(int newWidth) override;
|
|
|
|
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void restart();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onCheck();
|
|
|
|
|
|
|
|
void onChecking();
|
|
|
|
void onLatest();
|
|
|
|
void onDownloading(qint64 ready, qint64 total);
|
|
|
|
void onReady();
|
|
|
|
void onFailed();
|
|
|
|
|
|
|
|
private:
|
|
|
|
enum class State {
|
|
|
|
None,
|
|
|
|
Check,
|
|
|
|
Latest,
|
|
|
|
Download,
|
|
|
|
Fail,
|
|
|
|
Ready
|
|
|
|
};
|
|
|
|
void setState(State state, bool force = false);
|
|
|
|
void setDownloadProgress(qint64 ready, qint64 total);
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::LinkButton> _check;
|
|
|
|
object_ptr<Ui::LinkButton> _restart;
|
2016-08-27 17:52:05 +00:00
|
|
|
|
|
|
|
State _state = State::None;
|
|
|
|
QString _downloadText;
|
2016-12-26 22:46:36 +00:00
|
|
|
QString _versionText;
|
2016-08-27 17:52:05 +00:00
|
|
|
|
|
|
|
};
|
2016-10-18 07:56:38 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
2016-08-27 17:52:05 +00:00
|
|
|
|
2016-08-19 17:26:31 +00:00
|
|
|
class GeneralWidget : public BlockWidget {
|
2016-08-22 17:16:21 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2016-08-19 17:26:31 +00:00
|
|
|
public:
|
|
|
|
GeneralWidget(QWidget *parent, UserData *self);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int resizeGetHeight(int newWidth) override;
|
|
|
|
|
2016-08-22 17:16:21 +00:00
|
|
|
private slots:
|
|
|
|
void onChangeLanguage();
|
|
|
|
|
|
|
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
void onUpdateAutomatically();
|
2016-10-18 07:56:38 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
2016-08-22 17:16:21 +00:00
|
|
|
|
|
|
|
void onEnableTrayIcon();
|
|
|
|
void onEnableTaskbarIcon();
|
|
|
|
|
2017-02-03 20:07:26 +00:00
|
|
|
#ifndef OS_WIN_STORE
|
2016-08-22 17:16:21 +00:00
|
|
|
void onAutoStart();
|
|
|
|
void onStartMinimized();
|
|
|
|
void onAddInSendTo();
|
2017-02-03 20:07:26 +00:00
|
|
|
#endif // !OS_WIN_STORE
|
2016-08-22 17:16:21 +00:00
|
|
|
|
2016-08-27 17:52:05 +00:00
|
|
|
void onRestart();
|
|
|
|
|
2016-08-19 17:26:31 +00:00
|
|
|
private:
|
|
|
|
void refreshControls();
|
2016-08-22 17:16:21 +00:00
|
|
|
void updateWorkmode();
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::LinkButton> _changeLanguage;
|
2016-08-22 17:16:21 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
2017-09-13 16:57:44 +00:00
|
|
|
Ui::Checkbox *_updateAutomatically = nullptr;
|
|
|
|
Ui::SlideWrap<UpdateStateRow> *_updateRow = nullptr;
|
2016-10-18 07:56:38 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
2017-09-13 16:57:44 +00:00
|
|
|
Ui::Checkbox *_enableTrayIcon = nullptr;
|
|
|
|
Ui::Checkbox *_enableTaskbarIcon = nullptr;
|
|
|
|
Ui::Checkbox *_autoStart = nullptr;
|
|
|
|
Ui::SlideWrap<Ui::Checkbox> *_startMinimized = nullptr;
|
|
|
|
Ui::Checkbox *_addInSendTo = nullptr;
|
2016-08-22 17:16:21 +00:00
|
|
|
|
2017-04-18 15:21:03 +00:00
|
|
|
int _languagesLoadedSubscription = 0;
|
|
|
|
|
2016-08-19 17:26:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Settings
|