mirror of https://github.com/procxx/kepka.git
Most of the new Settings are done.
Left: auto update, privacy and security, local storage box + some minor things, like design fixes, codes like loadlang and clearing of the local storage (box) and temp download folder.
This commit is contained in:
parent
993b91ac15
commit
fdab386178
|
@ -39,6 +39,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "numbers.h"
|
#include "numbers.h"
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
|
#include "window/chat_background.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
App::LaunchState _launchState = App::Launched;
|
App::LaunchState _launchState = App::Launched;
|
||||||
|
@ -501,7 +502,7 @@ namespace {
|
||||||
}
|
}
|
||||||
if (d.is_self() && ::self != data) {
|
if (d.is_self() && ::self != data) {
|
||||||
::self = data;
|
::self = data;
|
||||||
if (App::wnd()) App::wnd()->updateGlobalMenu();
|
Global::RefSelfChanged().notify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2034,8 +2035,8 @@ namespace {
|
||||||
::gifItems.clear();
|
::gifItems.clear();
|
||||||
lastPhotos.clear();
|
lastPhotos.clear();
|
||||||
lastPhotosMap.clear();
|
lastPhotosMap.clear();
|
||||||
::self = 0;
|
::self = nullptr;
|
||||||
if (App::wnd()) App::wnd()->updateGlobalMenu();
|
Global::RefSelfChanged().notify(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void historyRegDependency(HistoryItem *dependent, HistoryItem *dependency) {
|
void historyRegDependency(HistoryItem *dependent, HistoryItem *dependency) {
|
||||||
|
@ -2323,7 +2324,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
void playSound() {
|
void playSound() {
|
||||||
if (cSoundNotify() && !psSkipAudioNotify()) audioPlayNotify();
|
if (Global::SoundNotify() && !psSkipAudioNotify()) audioPlayNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkImageCacheSize() {
|
void checkImageCacheSize() {
|
||||||
|
@ -2584,11 +2585,11 @@ namespace {
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||||
QNetworkProxy getHttpProxySettings() {
|
QNetworkProxy getHttpProxySettings() {
|
||||||
const ConnectionProxy *proxy = 0;
|
const ProxyData *proxy = nullptr;
|
||||||
if (Global::started()) {
|
if (Global::started()) {
|
||||||
proxy = (cConnectionType() == dbictHttpProxy) ? (&cConnectionProxy()) : 0;
|
proxy = (Global::ConnectionType() == dbictHttpProxy) ? (&Global::ConnectionProxy()) : nullptr;
|
||||||
} else {
|
} else {
|
||||||
proxy = Sandbox::PreLaunchProxy().host.isEmpty() ? 0 : (&Sandbox::PreLaunchProxy());
|
proxy = Sandbox::PreLaunchProxy().host.isEmpty() ? nullptr : (&Sandbox::PreLaunchProxy());
|
||||||
}
|
}
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
return QNetworkProxy(QNetworkProxy::HttpProxy, proxy->host, proxy->port, proxy->user, proxy->password);
|
return QNetworkProxy(QNetworkProxy::HttpProxy, proxy->host, proxy->port, proxy->user, proxy->password);
|
||||||
|
@ -2599,8 +2600,8 @@ namespace {
|
||||||
|
|
||||||
void setProxySettings(QTcpSocket &socket) {
|
void setProxySettings(QTcpSocket &socket) {
|
||||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||||
if (cConnectionType() == dbictTcpProxy) {
|
if (Global::ConnectionType() == dbictTcpProxy) {
|
||||||
const ConnectionProxy &p(cConnectionProxy());
|
auto &p = Global::ConnectionProxy();
|
||||||
socket.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, p.host, p.port, p.user, p.password));
|
socket.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, p.host, p.port, p.user, p.password));
|
||||||
} else {
|
} else {
|
||||||
socket.setProxy(QNetworkProxy(QNetworkProxy::NoProxy));
|
socket.setProxy(QNetworkProxy(QNetworkProxy::NoProxy));
|
||||||
|
@ -2673,7 +2674,7 @@ namespace {
|
||||||
|
|
||||||
uint64 components[3] = { 0 }, componentsScroll[3] = { 0 }, componentsPoint[3] = { 0 };
|
uint64 components[3] = { 0 }, componentsScroll[3] = { 0 }, componentsPoint[3] = { 0 };
|
||||||
int size = 0;
|
int size = 0;
|
||||||
{
|
|
||||||
QImage img(p);
|
QImage img(p);
|
||||||
bool remove = false;
|
bool remove = false;
|
||||||
if (p.isNull()) {
|
if (p.isNull()) {
|
||||||
|
@ -2710,13 +2711,6 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete cChatBackground();
|
|
||||||
cSetChatBackground(new QPixmap(pixmapFromImageInPlace(std_::move(img))));
|
|
||||||
cSetChatBackgroundId(id);
|
|
||||||
|
|
||||||
if (App::main()) App::main()->clearCachedBackground();
|
|
||||||
|
|
||||||
}
|
|
||||||
if (size) {
|
if (size) {
|
||||||
for (int32 i = 0; i < 3; ++i) components[i] /= size;
|
for (int32 i = 0; i < 3; ++i) components[i] /= size;
|
||||||
}
|
}
|
||||||
|
@ -2733,7 +2727,6 @@ namespace {
|
||||||
|
|
||||||
uint64 max = qMax(1ULL, components[maxtomin[0]]), mid = qMax(1ULL, components[maxtomin[1]]), min = qMax(1ULL, components[maxtomin[2]]);
|
uint64 max = qMax(1ULL, components[maxtomin[0]]), mid = qMax(1ULL, components[maxtomin[1]]), min = qMax(1ULL, components[maxtomin[2]]);
|
||||||
|
|
||||||
{
|
|
||||||
QImage dog = App::sprite().toImage().copy(st::msgDogImg.rect());
|
QImage dog = App::sprite().toImage().copy(st::msgDogImg.rect());
|
||||||
QImage::Format f = dog.format();
|
QImage::Format f = dog.format();
|
||||||
if (f != QImage::Format_ARGB32 && f != QImage::Format_ARGB32_Premultiplied) {
|
if (f != QImage::Format_ARGB32 && f != QImage::Format_ARGB32_Premultiplied) {
|
||||||
|
@ -2767,9 +2760,8 @@ namespace {
|
||||||
dogBits[i] = dogBits[i + 1] = dogBits[i + 2] = (r + r + b + g + g + g) / 6;
|
dogBits[i] = dogBits[i + 1] = dogBits[i + 2] = (r + r + b + g + g + g) / 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete cChatDogImage();
|
|
||||||
cSetChatDogImage(new QPixmap(pixmapFromImageInPlace(std_::move(dog))));
|
Window::chatBackground()->init(id, pixmapFromImageInPlace(std_::move(img)), pixmapFromImageInPlace(std_::move(dog)));
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(componentsScroll, components, sizeof(components));
|
memcpy(componentsScroll, components, sizeof(components));
|
||||||
memcpy(componentsPoint, components, sizeof(components));
|
memcpy(componentsPoint, components, sizeof(components));
|
||||||
|
|
|
@ -34,6 +34,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "core/observer.h"
|
#include "core/observer.h"
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
#include "core/observer.h"
|
#include "core/observer.h"
|
||||||
|
#include "window/chat_background.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
void mtpStateChanged(int32 dc, int32 state) {
|
void mtpStateChanged(int32 dc, int32 state) {
|
||||||
|
@ -1090,11 +1091,7 @@ AppClass::~AppClass() {
|
||||||
deleteAndMark(_uploader);
|
deleteAndMark(_uploader);
|
||||||
deleteAndMark(_translator);
|
deleteAndMark(_translator);
|
||||||
|
|
||||||
delete cChatBackground();
|
Window::chatBackground()->reset();
|
||||||
cSetChatBackground(0);
|
|
||||||
|
|
||||||
delete cChatDogImage();
|
|
||||||
cSetChatDogImage(0);
|
|
||||||
|
|
||||||
style::stopManager();
|
style::stopManager();
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "settingswidget.h"
|
#include "settingswidget.h"
|
||||||
|
#include "window/chat_background.h"
|
||||||
#include "styles/style_overview.h"
|
#include "styles/style_overview.h"
|
||||||
|
|
||||||
BackgroundInner::BackgroundInner() :
|
BackgroundInner::BackgroundInner() :
|
||||||
|
@ -130,7 +131,7 @@ void BackgroundInner::paintEvent(QPaintEvent *e) {
|
||||||
const QPixmap &pix(paper.thumb->pix(st::backgroundSize.width(), st::backgroundSize.height()));
|
const QPixmap &pix(paper.thumb->pix(st::backgroundSize.width(), st::backgroundSize.height()));
|
||||||
p.drawPixmap(x, y, pix);
|
p.drawPixmap(x, y, pix);
|
||||||
|
|
||||||
if (paper.id == cChatBackgroundId()) {
|
if (paper.id == Window::chatBackground()->id()) {
|
||||||
int checkPosX = x + st::backgroundSize.width() - st::overviewPhotoChecked.width();
|
int checkPosX = x + st::backgroundSize.width() - st::overviewPhotoChecked.width();
|
||||||
int checkPosY = y + st::backgroundSize.height() - st::overviewPhotoChecked.height();
|
int checkPosY = y + st::backgroundSize.height() - st::overviewPhotoChecked.height();
|
||||||
st::overviewPhotoChecked.paint(p, QPoint(checkPosX, checkPosY), width());
|
st::overviewPhotoChecked.paint(p, QPoint(checkPosX, checkPosY), width());
|
||||||
|
@ -196,9 +197,9 @@ void BackgroundBox::onBackgroundChosen(int index) {
|
||||||
if (index >= 0 && index < App::cServerBackgrounds().size()) {
|
if (index >= 0 && index < App::cServerBackgrounds().size()) {
|
||||||
const App::WallPaper &paper(App::cServerBackgrounds().at(index));
|
const App::WallPaper &paper(App::cServerBackgrounds().at(index));
|
||||||
if (App::main()) App::main()->setChatBackground(paper);
|
if (App::main()) App::main()->setChatBackground(paper);
|
||||||
if (_updateCallback) {
|
|
||||||
_updateCallback(!paper.id);
|
using Update = Window::ChatBackgroundUpdate;
|
||||||
}
|
Window::chatBackground()->notify(Update(Update::Type::Start, !paper.id));
|
||||||
}
|
}
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,11 +54,6 @@ class BackgroundBox : public ItemListBox {
|
||||||
public:
|
public:
|
||||||
BackgroundBox();
|
BackgroundBox();
|
||||||
|
|
||||||
// When background is chosen this callback is called with "bool isTiled" arg.
|
|
||||||
void setUpdateCallback(base::lambda_unique<void(bool)> &&updateCallback) {
|
|
||||||
_updateCallback = std::move(updateCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onBackgroundChosen(int index);
|
void onBackgroundChosen(int index);
|
||||||
|
|
||||||
|
@ -67,6 +62,5 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BackgroundInner _inner;
|
BackgroundInner _inner;
|
||||||
base::lambda_unique<void(bool)> _updateCallback;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,14 +28,14 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
ConnectionBox::ConnectionBox() : AbstractBox(st::boxWidth)
|
ConnectionBox::ConnectionBox() : AbstractBox(st::boxWidth)
|
||||||
, _hostInput(this, st::connectionHostInputField, lang(lng_connection_host_ph), cConnectionProxy().host)
|
, _hostInput(this, st::connectionHostInputField, lang(lng_connection_host_ph), Global::ConnectionProxy().host)
|
||||||
, _portInput(this, st::connectionPortInputField, lang(lng_connection_port_ph), QString::number(cConnectionProxy().port))
|
, _portInput(this, st::connectionPortInputField, lang(lng_connection_port_ph), QString::number(Global::ConnectionProxy().port))
|
||||||
, _userInput(this, st::connectionUserInputField, lang(lng_connection_user_ph), cConnectionProxy().user)
|
, _userInput(this, st::connectionUserInputField, lang(lng_connection_user_ph), Global::ConnectionProxy().user)
|
||||||
, _passwordInput(this, st::connectionPasswordInputField, lang(lng_connection_password_ph), cConnectionProxy().password)
|
, _passwordInput(this, st::connectionPasswordInputField, lang(lng_connection_password_ph), Global::ConnectionProxy().password)
|
||||||
, _autoRadio(this, qsl("conn_type"), dbictAuto, lang(lng_connection_auto_rb), (cConnectionType() == dbictAuto))
|
, _autoRadio(this, qsl("conn_type"), dbictAuto, lang(lng_connection_auto_rb), (Global::ConnectionType() == dbictAuto))
|
||||||
, _httpProxyRadio(this, qsl("conn_type"), dbictHttpProxy, lang(lng_connection_http_proxy_rb), (cConnectionType() == dbictHttpProxy))
|
, _httpProxyRadio(this, qsl("conn_type"), dbictHttpProxy, lang(lng_connection_http_proxy_rb), (Global::ConnectionType() == dbictHttpProxy))
|
||||||
, _tcpProxyRadio(this, qsl("conn_type"), dbictTcpProxy, lang(lng_connection_tcp_proxy_rb), (cConnectionType() == dbictTcpProxy))
|
, _tcpProxyRadio(this, qsl("conn_type"), dbictTcpProxy, lang(lng_connection_tcp_proxy_rb), (Global::ConnectionType() == dbictTcpProxy))
|
||||||
, _tryIPv6(this, lang(lng_connection_try_ipv6), cTryIPv6(), st::defaultBoxCheckbox)
|
, _tryIPv6(this, lang(lng_connection_try_ipv6), Global::TryIPv6(), st::defaultBoxCheckbox)
|
||||||
, _save(this, lang(lng_connection_save), st::defaultBoxButton)
|
, _save(this, lang(lng_connection_save), st::defaultBoxButton)
|
||||||
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
|
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ void ConnectionBox::onSubmit() {
|
||||||
|
|
||||||
void ConnectionBox::onSave() {
|
void ConnectionBox::onSave() {
|
||||||
if (_httpProxyRadio.checked() || _tcpProxyRadio.checked()) {
|
if (_httpProxyRadio.checked() || _tcpProxyRadio.checked()) {
|
||||||
ConnectionProxy p;
|
ProxyData p;
|
||||||
p.host = _hostInput.getLastText().trimmed();
|
p.host = _hostInput.getLastText().trimmed();
|
||||||
p.user = _userInput.getLastText().trimmed();
|
p.user = _userInput.getLastText().trimmed();
|
||||||
p.password = _passwordInput.getLastText().trimmed();
|
p.password = _passwordInput.getLastText().trimmed();
|
||||||
|
@ -180,28 +180,32 @@ void ConnectionBox::onSave() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_httpProxyRadio.checked()) {
|
if (_httpProxyRadio.checked()) {
|
||||||
cSetConnectionType(dbictHttpProxy);
|
Global::SetConnectionType(dbictHttpProxy);
|
||||||
} else {
|
} else {
|
||||||
cSetConnectionType(dbictTcpProxy);
|
Global::SetConnectionType(dbictTcpProxy);
|
||||||
}
|
}
|
||||||
cSetConnectionProxy(p);
|
Global::SetConnectionProxy(p);
|
||||||
} else {
|
} else {
|
||||||
cSetConnectionType(dbictAuto);
|
Global::SetConnectionType(dbictAuto);
|
||||||
cSetConnectionProxy(ConnectionProxy());
|
Global::SetConnectionProxy(ProxyData());
|
||||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (cPlatform() == dbipWindows && cTryIPv6() != _tryIPv6.checked()) {
|
if (cPlatform() == dbipWindows && Global::TryIPv6() != _tryIPv6.checked()) {
|
||||||
cSetTryIPv6(_tryIPv6.checked());
|
Global::SetTryIPv6(_tryIPv6.checked());
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
|
Global::RefConnectionTypeChanged().notify();
|
||||||
|
|
||||||
cSetRestarting(true);
|
cSetRestarting(true);
|
||||||
cSetRestartingToSettings(true);
|
cSetRestartingToSettings(true);
|
||||||
App::quit();
|
App::quit();
|
||||||
} else {
|
} else {
|
||||||
cSetTryIPv6(_tryIPv6.checked());
|
Global::SetTryIPv6(_tryIPv6.checked());
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
|
Global::RefConnectionTypeChanged().notify();
|
||||||
|
|
||||||
MTP::restart();
|
MTP::restart();
|
||||||
reinitImageLinkManager();
|
reinitImageLinkManager();
|
||||||
reinitWebLoadManager();
|
reinitWebLoadManager();
|
||||||
|
|
|
@ -27,28 +27,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/filedialog.h"
|
#include "ui/filedialog.h"
|
||||||
#include "pspecific.h"
|
#include "pspecific.h"
|
||||||
|
|
||||||
namespace internal {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
void StartCallback() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void FinishCallback() {
|
|
||||||
}
|
|
||||||
|
|
||||||
Notify::SimpleObservedEventRegistrator<DownloadPathUpdateHandler> creator(StartCallback, FinishCallback);
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
Notify::ConnectionId plainRegisterObserver(DownloadPathUpdateHandler &&handler) {
|
|
||||||
return creator.registerObserver(std_::forward<DownloadPathUpdateHandler>(handler));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace interanl
|
|
||||||
|
|
||||||
DownloadPathBox::DownloadPathBox() : AbstractBox()
|
DownloadPathBox::DownloadPathBox() : AbstractBox()
|
||||||
, _path(cDownloadPath())
|
, _path(Global::DownloadPath())
|
||||||
, _pathBookmark(cDownloadPathBookmark())
|
, _pathBookmark(Global::DownloadPathBookmark())
|
||||||
, _default(this, qsl("dir_type"), 0, lang(lng_download_path_default_radio), _path.isEmpty())
|
, _default(this, qsl("dir_type"), 0, lang(lng_download_path_default_radio), _path.isEmpty())
|
||||||
, _temp(this, qsl("dir_type"), 1, lang(lng_download_path_temp_radio), _path == qsl("tmp"))
|
, _temp(this, qsl("dir_type"), 1, lang(lng_download_path_temp_radio), _path == qsl("tmp"))
|
||||||
, _dir(this, qsl("dir_type"), 2, lang(lng_download_path_dir_radio), !_path.isEmpty() && _path != qsl("tmp"))
|
, _dir(this, qsl("dir_type"), 2, lang(lng_download_path_dir_radio), !_path.isEmpty() && _path != qsl("tmp"))
|
||||||
|
@ -135,8 +116,8 @@ void DownloadPathBox::onChange() {
|
||||||
void DownloadPathBox::onEditPath() {
|
void DownloadPathBox::onEditPath() {
|
||||||
filedialogInit();
|
filedialogInit();
|
||||||
QString path, lastPath = cDialogLastPath();
|
QString path, lastPath = cDialogLastPath();
|
||||||
if (!cDownloadPath().isEmpty() && cDownloadPath() != qstr("tmp")) {
|
if (!Global::DownloadPath().isEmpty() && Global::DownloadPath() != qstr("tmp")) {
|
||||||
cSetDialogLastPath(cDownloadPath().left(cDownloadPath().size() - (cDownloadPath().endsWith('/') ? 1 : 0)));
|
cSetDialogLastPath(Global::DownloadPath().left(Global::DownloadPath().size() - (Global::DownloadPath().endsWith('/') ? 1 : 0)));
|
||||||
}
|
}
|
||||||
if (filedialogGetDir(path, lang(lng_download_path_choose))) {
|
if (filedialogGetDir(path, lang(lng_download_path_choose))) {
|
||||||
if (!path.isEmpty()) {
|
if (!path.isEmpty()) {
|
||||||
|
@ -149,10 +130,10 @@ void DownloadPathBox::onEditPath() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadPathBox::onSave() {
|
void DownloadPathBox::onSave() {
|
||||||
cSetDownloadPath(_default.checked() ? QString() : (_temp.checked() ? qsl("tmp") : _path));
|
Global::SetDownloadPath(_default.checked() ? QString() : (_temp.checked() ? qsl("tmp") : _path));
|
||||||
cSetDownloadPathBookmark((_default.checked() || _temp.checked()) ? QByteArray() : _pathBookmark);
|
Global::SetDownloadPathBookmark((_default.checked() || _temp.checked()) ? QByteArray() : _pathBookmark);
|
||||||
Local::writeUserSettings();
|
Local::writeUserSettings();
|
||||||
internal::creator.notify(DownloadPathUpdate());
|
Global::RefDownloadPathChanged().notify();
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,21 +23,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "abstractbox.h"
|
#include "abstractbox.h"
|
||||||
#include "core/observer.h"
|
#include "core/observer.h"
|
||||||
|
|
||||||
// Just a notification that cDownloadPath() has changed.
|
|
||||||
struct DownloadPathUpdate {
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace internal {
|
|
||||||
using DownloadPathUpdateHandler = Function<void, const DownloadPathUpdate&>;
|
|
||||||
Notify::ConnectionId plainRegisterObserver(DownloadPathUpdateHandler &&handler);
|
|
||||||
} // namespace internal
|
|
||||||
|
|
||||||
template <typename ObserverType>
|
|
||||||
void registerDownloadPathObserver(ObserverType *observer, void (ObserverType::*handler)(const DownloadPathUpdate &)) {
|
|
||||||
auto connection = internal::plainRegisterObserver(func(observer, handler));
|
|
||||||
Notify::observerRegistered(observer, connection);
|
|
||||||
}
|
|
||||||
|
|
||||||
class DownloadPathBox : public AbstractBox {
|
class DownloadPathBox : public AbstractBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
|
@ -747,11 +747,9 @@ enum DBIDefaultAttach {
|
||||||
dbidaPhoto = 1,
|
dbidaPhoto = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ConnectionProxy {
|
struct ProxyData {
|
||||||
ConnectionProxy() : port(0) {
|
|
||||||
}
|
|
||||||
QString host;
|
QString host;
|
||||||
uint32 port;
|
uint32 port = 0;
|
||||||
QString user, password;
|
QString user, password;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -331,12 +331,10 @@ public:
|
||||||
using Handler = typename CommonObservableData<EventType>::Handler;
|
using Handler = typename CommonObservableData<EventType>::Handler;
|
||||||
|
|
||||||
Subscription subscribe(Handler &&handler) {
|
Subscription subscribe(Handler &&handler) {
|
||||||
if (_data) {
|
if (!_data) {
|
||||||
_data->append(std_::forward<Handler>(handler));
|
_data = MakeShared<ObservableData<EventType>>(this);
|
||||||
} else {
|
|
||||||
_data = MakeShared<ObservableData<EventType>>(this, std_::forward<Handler>(handler));
|
|
||||||
}
|
}
|
||||||
return _data->last();
|
return _data->append(std_::forward<Handler>(handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -352,9 +350,9 @@ private:
|
||||||
template <typename EventType>
|
template <typename EventType>
|
||||||
class Observable : public internal::CommonObservable<EventType> {
|
class Observable : public internal::CommonObservable<EventType> {
|
||||||
public:
|
public:
|
||||||
void notify(EventType &&event) {
|
void notify(EventType &&event, bool sync = false) {
|
||||||
if (_data) {
|
if (_data) {
|
||||||
_data->notify(std_::move(event));
|
_data->notify(std_::move(event), sync);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,20 +365,18 @@ class CommonObservableData : public BaseObservableData {
|
||||||
public:
|
public:
|
||||||
using Handler = SubscriptionHandler<EventType>;
|
using Handler = SubscriptionHandler<EventType>;
|
||||||
|
|
||||||
CommonObservableData(CommonObservable<EventType> *observable, Handler &&handler) : _observable(observable)
|
CommonObservableData(CommonObservable<EventType> *observable) : _observable(observable) {
|
||||||
, _begin(new Node(observable->_data, std_::forward<Handler>(handler)))
|
|
||||||
, _end(_begin) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void append(Handler &&handler) {
|
Subscription append(Handler &&handler) {
|
||||||
auto node = new Node(_observable->_data, std_::forward<Handler>(handler));
|
auto node = new Node(_observable->_data, std_::forward<Handler>(handler));
|
||||||
|
if (_begin) {
|
||||||
_end->next = node;
|
_end->next = node;
|
||||||
node->prev = _end;
|
node->prev = _end;
|
||||||
_end = node;
|
_end = node;
|
||||||
|
} else {
|
||||||
|
_begin = _end = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
Subscription last() {
|
|
||||||
return { _end, &CommonObservableData::destroyNode };
|
return { _end, &CommonObservableData::destroyNode };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,15 +431,15 @@ private:
|
||||||
}
|
}
|
||||||
} while (_current);
|
} while (_current);
|
||||||
|
|
||||||
if (!_begin) {
|
if (empty()) {
|
||||||
_observable->_data.reset();
|
_observable->_data.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonObservable<EventType> *_observable = nullptr;
|
CommonObservable<EventType> *_observable = nullptr;
|
||||||
Node *_begin;
|
Node *_begin = nullptr;
|
||||||
Node *_current = nullptr;
|
Node *_current = nullptr;
|
||||||
Node *_end;
|
Node *_end = nullptr;
|
||||||
ObservableCallHandlers _callHandlers;
|
ObservableCallHandlers _callHandlers;
|
||||||
|
|
||||||
friend class ObservableData<EventType>;
|
friend class ObservableData<EventType>;
|
||||||
|
@ -455,7 +451,14 @@ class ObservableData : public CommonObservableData<EventType> {
|
||||||
public:
|
public:
|
||||||
using CommonObservableData<EventType>::CommonObservableData;
|
using CommonObservableData<EventType>::CommonObservableData;
|
||||||
|
|
||||||
void notify(EventType &&event) {
|
void notify(EventType &&event, bool sync) {
|
||||||
|
if (_handling) {
|
||||||
|
sync = false;
|
||||||
|
}
|
||||||
|
if (sync) {
|
||||||
|
_events.push_back(std_::move(event));
|
||||||
|
callHandlers();
|
||||||
|
} else {
|
||||||
if (!_callHandlers) {
|
if (!_callHandlers) {
|
||||||
_callHandlers = [this]() {
|
_callHandlers = [this]() {
|
||||||
callHandlers();
|
callHandlers();
|
||||||
|
@ -466,6 +469,7 @@ public:
|
||||||
}
|
}
|
||||||
_events.push_back(std_::move(event));
|
_events.push_back(std_::move(event));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
~ObservableData() {
|
~ObservableData() {
|
||||||
UnregisterObservable(&_callHandlers);
|
UnregisterObservable(&_callHandlers);
|
||||||
|
@ -473,16 +477,19 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void callHandlers() {
|
void callHandlers() {
|
||||||
|
_handling = true;
|
||||||
auto events = createAndSwap(_events);
|
auto events = createAndSwap(_events);
|
||||||
for (auto &event : events) {
|
for (auto &event : events) {
|
||||||
notifyEnumerate([this, &event]() {
|
notifyEnumerate([this, &event]() {
|
||||||
_current->handler(event);
|
_current->handler(event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
_handling = false;
|
||||||
UnregisterActiveObservable(&_callHandlers);
|
UnregisterActiveObservable(&_callHandlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
std_::vector_of_moveable<EventType> _events;
|
std_::vector_of_moveable<EventType> _events;
|
||||||
|
bool _handling = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -491,7 +498,14 @@ class ObservableData<void> : public CommonObservableData<void> {
|
||||||
public:
|
public:
|
||||||
using CommonObservableData<void>::CommonObservableData;
|
using CommonObservableData<void>::CommonObservableData;
|
||||||
|
|
||||||
void notify() {
|
void notify(bool sync) {
|
||||||
|
if (_handling) {
|
||||||
|
sync = false;
|
||||||
|
}
|
||||||
|
if (sync) {
|
||||||
|
++_eventsCount;
|
||||||
|
callHandlers();
|
||||||
|
} else {
|
||||||
if (!_callHandlers) {
|
if (!_callHandlers) {
|
||||||
_callHandlers = [this]() {
|
_callHandlers = [this]() {
|
||||||
callHandlers();
|
callHandlers();
|
||||||
|
@ -502,6 +516,7 @@ public:
|
||||||
}
|
}
|
||||||
++_eventsCount;
|
++_eventsCount;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
~ObservableData() {
|
~ObservableData() {
|
||||||
UnregisterObservable(&_callHandlers);
|
UnregisterObservable(&_callHandlers);
|
||||||
|
@ -509,16 +524,19 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void callHandlers() {
|
void callHandlers() {
|
||||||
|
_handling = true;
|
||||||
auto eventsCount = createAndSwap(_eventsCount);
|
auto eventsCount = createAndSwap(_eventsCount);
|
||||||
for (int i = 0; i != eventsCount; ++i) {
|
for (int i = 0; i != eventsCount; ++i) {
|
||||||
notifyEnumerate([this]() {
|
notifyEnumerate([this]() {
|
||||||
_current->handler();
|
_current->handler();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
_handling = false;
|
||||||
UnregisterActiveObservable(&_callHandlers);
|
UnregisterActiveObservable(&_callHandlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _eventsCount = 0;
|
int _eventsCount = 0;
|
||||||
|
bool _handling = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -527,9 +545,9 @@ private:
|
||||||
template <>
|
template <>
|
||||||
class Observable<void> : public internal::CommonObservable<void> {
|
class Observable<void> : public internal::CommonObservable<void> {
|
||||||
public:
|
public:
|
||||||
void notify() {
|
void notify(bool sync = false) {
|
||||||
if (_data) {
|
if (_data) {
|
||||||
_data->notify();
|
_data->notify(sync);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,6 +571,13 @@ protected:
|
||||||
_subscriptions[index].destroy();
|
_subscriptions[index].destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~Subscriber() {
|
||||||
|
auto subscriptions = createAndSwap(_subscriptions);
|
||||||
|
for (auto &subscription : subscriptions) {
|
||||||
|
subscription.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std_::vector_of_moveable<base::Subscription> _subscriptions;
|
std_::vector_of_moveable<base::Subscription> _subscriptions;
|
||||||
|
|
||||||
|
|
|
@ -107,3 +107,7 @@ dialogsNewChatButton: RoundButton {
|
||||||
textBg: transparent;
|
textBg: transparent;
|
||||||
textBgOver: transparent;
|
textBgOver: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settingsEditIcon: icon {
|
||||||
|
{ "dialogs_new_chat", #b7b7b7, point(3px, 9px) }
|
||||||
|
};
|
||||||
|
|
|
@ -30,6 +30,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "boxes/confirmbox.h"
|
#include "boxes/confirmbox.h"
|
||||||
#include "layerwidget.h"
|
#include "layerwidget.h"
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
|
#include "core/observer.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(ClickHandlerPtr);
|
Q_DECLARE_METATYPE(ClickHandlerPtr);
|
||||||
Q_DECLARE_METATYPE(Qt::MouseButton);
|
Q_DECLARE_METATYPE(Qt::MouseButton);
|
||||||
|
@ -407,7 +408,7 @@ struct Data {
|
||||||
int32 LangSystem = languageDefault;
|
int32 LangSystem = languageDefault;
|
||||||
|
|
||||||
QByteArray LastCrashDump;
|
QByteArray LastCrashDump;
|
||||||
ConnectionProxy PreLaunchProxy;
|
ProxyData PreLaunchProxy;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
@ -525,7 +526,7 @@ uint64 UserTag() {
|
||||||
DefineReadOnlyVar(Sandbox, QString, LangSystemISO);
|
DefineReadOnlyVar(Sandbox, QString, LangSystemISO);
|
||||||
DefineReadOnlyVar(Sandbox, int32, LangSystem);
|
DefineReadOnlyVar(Sandbox, int32, LangSystem);
|
||||||
DefineVar(Sandbox, QByteArray, LastCrashDump);
|
DefineVar(Sandbox, QByteArray, LastCrashDump);
|
||||||
DefineVar(Sandbox, ConnectionProxy, PreLaunchProxy);
|
DefineVar(Sandbox, ProxyData, PreLaunchProxy);
|
||||||
|
|
||||||
} // namespace Sandbox
|
} // namespace Sandbox
|
||||||
|
|
||||||
|
@ -581,6 +582,8 @@ struct Data {
|
||||||
|
|
||||||
Adaptive::Layout AdaptiveLayout = Adaptive::NormalLayout;
|
Adaptive::Layout AdaptiveLayout = Adaptive::NormalLayout;
|
||||||
bool AdaptiveForWide = true;
|
bool AdaptiveForWide = true;
|
||||||
|
base::Observable<void> AdaptiveChanged;
|
||||||
|
|
||||||
bool DialogsModeEnabled = false;
|
bool DialogsModeEnabled = false;
|
||||||
Dialogs::Mode DialogsMode = Dialogs::Mode::All;
|
Dialogs::Mode DialogsMode = Dialogs::Mode::All;
|
||||||
bool ModerateModeEnabled = false;
|
bool ModerateModeEnabled = false;
|
||||||
|
@ -626,6 +629,27 @@ struct Data {
|
||||||
MTP::DcOptions DcOptions;
|
MTP::DcOptions DcOptions;
|
||||||
|
|
||||||
CircleMasksMap CircleMasks;
|
CircleMasksMap CircleMasks;
|
||||||
|
|
||||||
|
base::Observable<void> SelfChanged;
|
||||||
|
|
||||||
|
bool AskDownloadPath = false;
|
||||||
|
QString DownloadPath;
|
||||||
|
QByteArray DownloadPathBookmark;
|
||||||
|
base::Observable<void> DownloadPathChanged;
|
||||||
|
|
||||||
|
bool SoundNotify = true;
|
||||||
|
bool DesktopNotify = true;
|
||||||
|
bool RestoreSoundNotifyFromTray = false;
|
||||||
|
bool IncludeMuted = true;
|
||||||
|
DBINotifyView NotifyView = dbinvShowPreview;
|
||||||
|
bool WindowsNotifications = true;
|
||||||
|
bool CustomNotifies = (cPlatform() == dbipMac) ? false : true;
|
||||||
|
base::Observable<Notify::ChangeType> NotifySettingsChanged;
|
||||||
|
|
||||||
|
DBIConnectionType ConnectionType = dbictAuto;
|
||||||
|
bool TryIPv6 = (cPlatform() == dbipWindows) ? false : true;
|
||||||
|
ProxyData ConnectionProxy;
|
||||||
|
base::Observable<void> ConnectionTypeChanged;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
@ -659,6 +683,8 @@ DefineRefVar(Global, SingleDelayedCall, HandleObservables);
|
||||||
|
|
||||||
DefineVar(Global, Adaptive::Layout, AdaptiveLayout);
|
DefineVar(Global, Adaptive::Layout, AdaptiveLayout);
|
||||||
DefineVar(Global, bool, AdaptiveForWide);
|
DefineVar(Global, bool, AdaptiveForWide);
|
||||||
|
DefineRefVar(Global, base::Observable<void>, AdaptiveChanged);
|
||||||
|
|
||||||
DefineVar(Global, bool, DialogsModeEnabled);
|
DefineVar(Global, bool, DialogsModeEnabled);
|
||||||
DefineVar(Global, Dialogs::Mode, DialogsMode);
|
DefineVar(Global, Dialogs::Mode, DialogsMode);
|
||||||
DefineVar(Global, bool, ModerateModeEnabled);
|
DefineVar(Global, bool, ModerateModeEnabled);
|
||||||
|
@ -705,4 +731,25 @@ DefineVar(Global, MTP::DcOptions, DcOptions);
|
||||||
|
|
||||||
DefineRefVar(Global, CircleMasksMap, CircleMasks);
|
DefineRefVar(Global, CircleMasksMap, CircleMasks);
|
||||||
|
|
||||||
|
DefineRefVar(Global, base::Observable<void>, SelfChanged);
|
||||||
|
|
||||||
|
DefineVar(Global, bool, AskDownloadPath);
|
||||||
|
DefineVar(Global, QString, DownloadPath);
|
||||||
|
DefineVar(Global, QByteArray, DownloadPathBookmark);
|
||||||
|
DefineRefVar(Global, base::Observable<void>, DownloadPathChanged);
|
||||||
|
|
||||||
|
DefineVar(Global, bool, SoundNotify);
|
||||||
|
DefineVar(Global, bool, DesktopNotify);
|
||||||
|
DefineVar(Global, bool, RestoreSoundNotifyFromTray);
|
||||||
|
DefineVar(Global, bool, IncludeMuted);
|
||||||
|
DefineVar(Global, DBINotifyView, NotifyView);
|
||||||
|
DefineVar(Global, bool, WindowsNotifications);
|
||||||
|
DefineVar(Global, bool, CustomNotifies);
|
||||||
|
DefineRefVar(Global, base::Observable<Notify::ChangeType>, NotifySettingsChanged);
|
||||||
|
|
||||||
|
DefineVar(Global, DBIConnectionType, ConnectionType);
|
||||||
|
DefineVar(Global, bool, TryIPv6);
|
||||||
|
DefineVar(Global, ProxyData, ConnectionProxy);
|
||||||
|
DefineRefVar(Global, base::Observable<void>, ConnectionTypeChanged);
|
||||||
|
|
||||||
} // namespace Global
|
} // namespace Global
|
||||||
|
|
|
@ -21,6 +21,16 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class LayerWidget;
|
class LayerWidget;
|
||||||
|
namespace base {
|
||||||
|
template <typename Type>
|
||||||
|
class Observable;
|
||||||
|
} // namespace base
|
||||||
|
namespace InlineBots {
|
||||||
|
namespace Layout {
|
||||||
|
class ItemBase;
|
||||||
|
} // namespace Layout
|
||||||
|
} // namespace InlineBots
|
||||||
|
|
||||||
|
|
||||||
namespace App {
|
namespace App {
|
||||||
|
|
||||||
|
@ -42,14 +52,6 @@ void logOutDelayed();
|
||||||
|
|
||||||
} // namespace App
|
} // namespace App
|
||||||
|
|
||||||
namespace InlineBots {
|
|
||||||
namespace Layout {
|
|
||||||
|
|
||||||
class ItemBase;
|
|
||||||
|
|
||||||
} // namespace Layout
|
|
||||||
} // namespace InlineBots
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
||||||
void showMediaPreview(DocumentData *document);
|
void showMediaPreview(DocumentData *document);
|
||||||
|
@ -142,6 +144,14 @@ void historyMuteUpdated(History *history);
|
||||||
void handlePendingHistoryUpdate();
|
void handlePendingHistoryUpdate();
|
||||||
void unreadCounterUpdated();
|
void unreadCounterUpdated();
|
||||||
|
|
||||||
|
enum class ChangeType {
|
||||||
|
SoundEnabled,
|
||||||
|
IncludeMuted,
|
||||||
|
DesktopEnabled,
|
||||||
|
ViewParams,
|
||||||
|
UseNative,
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Notify
|
} // namespace Notify
|
||||||
|
|
||||||
#define DeclareReadOnlyVar(Type, Name) const Type &Name();
|
#define DeclareReadOnlyVar(Type, Name) const Type &Name();
|
||||||
|
@ -163,7 +173,7 @@ uint64 UserTag();
|
||||||
DeclareReadOnlyVar(QString, LangSystemISO);
|
DeclareReadOnlyVar(QString, LangSystemISO);
|
||||||
DeclareReadOnlyVar(int32, LangSystem);
|
DeclareReadOnlyVar(int32, LangSystem);
|
||||||
DeclareVar(QByteArray, LastCrashDump);
|
DeclareVar(QByteArray, LastCrashDump);
|
||||||
DeclareVar(ConnectionProxy, PreLaunchProxy);
|
DeclareVar(ProxyData, PreLaunchProxy);
|
||||||
|
|
||||||
} // namespace Sandbox
|
} // namespace Sandbox
|
||||||
|
|
||||||
|
@ -234,6 +244,8 @@ DeclareRefVar(SingleDelayedCall, HandleObservables);
|
||||||
|
|
||||||
DeclareVar(Adaptive::Layout, AdaptiveLayout);
|
DeclareVar(Adaptive::Layout, AdaptiveLayout);
|
||||||
DeclareVar(bool, AdaptiveForWide);
|
DeclareVar(bool, AdaptiveForWide);
|
||||||
|
DeclareRefVar(base::Observable<void>, AdaptiveChanged);
|
||||||
|
|
||||||
DeclareVar(bool, DialogsModeEnabled);
|
DeclareVar(bool, DialogsModeEnabled);
|
||||||
DeclareVar(Dialogs::Mode, DialogsMode);
|
DeclareVar(Dialogs::Mode, DialogsMode);
|
||||||
DeclareVar(bool, ModerateModeEnabled);
|
DeclareVar(bool, ModerateModeEnabled);
|
||||||
|
@ -283,10 +295,35 @@ DeclareVar(MTP::DcOptions, DcOptions);
|
||||||
typedef QMap<uint64, QPixmap> CircleMasksMap;
|
typedef QMap<uint64, QPixmap> CircleMasksMap;
|
||||||
DeclareRefVar(CircleMasksMap, CircleMasks);
|
DeclareRefVar(CircleMasksMap, CircleMasks);
|
||||||
|
|
||||||
|
DeclareRefVar(base::Observable<void>, SelfChanged);
|
||||||
|
|
||||||
|
DeclareVar(bool, AskDownloadPath);
|
||||||
|
DeclareVar(QString, DownloadPath);
|
||||||
|
DeclareVar(QByteArray, DownloadPathBookmark);
|
||||||
|
DeclareRefVar(base::Observable<void>, DownloadPathChanged);
|
||||||
|
|
||||||
|
DeclareVar(bool, SoundNotify);
|
||||||
|
DeclareVar(bool, DesktopNotify);
|
||||||
|
DeclareVar(bool, RestoreSoundNotifyFromTray);
|
||||||
|
DeclareVar(bool, IncludeMuted);
|
||||||
|
DeclareVar(DBINotifyView, NotifyView);
|
||||||
|
DeclareVar(bool, WindowsNotifications);
|
||||||
|
DeclareVar(bool, CustomNotifies);
|
||||||
|
DeclareRefVar(base::Observable<Notify::ChangeType>, NotifySettingsChanged);
|
||||||
|
|
||||||
|
DeclareVar(DBIConnectionType, ConnectionType);
|
||||||
|
DeclareVar(bool, TryIPv6);
|
||||||
|
DeclareVar(ProxyData, ConnectionProxy);
|
||||||
|
DeclareRefVar(base::Observable<void>, ConnectionTypeChanged);
|
||||||
|
|
||||||
} // namespace Global
|
} // namespace Global
|
||||||
|
|
||||||
namespace Adaptive {
|
namespace Adaptive {
|
||||||
|
|
||||||
|
inline base::Observable<void> &Changed() {
|
||||||
|
return Global::RefAdaptiveChanged();
|
||||||
|
}
|
||||||
|
|
||||||
inline bool OneColumn() {
|
inline bool OneColumn() {
|
||||||
return Global::AdaptiveLayout() == OneColumnLayout;
|
return Global::AdaptiveLayout() == OneColumnLayout;
|
||||||
}
|
}
|
||||||
|
|
|
@ -699,6 +699,14 @@ HistoryItem *Histories::addNewMessage(const MTPMessage &msg, NewMessageType type
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Histories::unreadBadge() const {
|
||||||
|
return _unreadFull - (Global::IncludeMuted() ? 0 : _unreadMuted);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Histories::unreadOnlyMuted() const {
|
||||||
|
return Global::IncludeMuted() ? (_unreadMuted >= _unreadFull) : false;
|
||||||
|
}
|
||||||
|
|
||||||
HistoryItem *History::createItem(const MTPMessage &msg, bool applyServiceAction, bool detachExistingItem) {
|
HistoryItem *History::createItem(const MTPMessage &msg, bool applyServiceAction, bool detachExistingItem) {
|
||||||
MsgId msgId = 0;
|
MsgId msgId = 0;
|
||||||
switch (msg.type()) {
|
switch (msg.type()) {
|
||||||
|
@ -1492,7 +1500,7 @@ void History::setUnreadCount(int newUnreadCount) {
|
||||||
}
|
}
|
||||||
if (inChatList(Dialogs::Mode::All)) {
|
if (inChatList(Dialogs::Mode::All)) {
|
||||||
App::histories().unreadIncrement(newUnreadCount - _unreadCount, mute());
|
App::histories().unreadIncrement(newUnreadCount - _unreadCount, mute());
|
||||||
if (!mute() || cIncludeMuted()) {
|
if (!mute() || Global::IncludeMuted()) {
|
||||||
Notify::unreadCounterUpdated();
|
Notify::unreadCounterUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,15 +62,11 @@ public:
|
||||||
TypingHistories typing;
|
TypingHistories typing;
|
||||||
Animation _a_typings;
|
Animation _a_typings;
|
||||||
|
|
||||||
int32 unreadBadge() const {
|
int unreadBadge() const;
|
||||||
return _unreadFull - (cIncludeMuted() ? 0 : _unreadMuted);
|
int unreadMutedCount() const {
|
||||||
}
|
|
||||||
int32 unreadMutedCount() const {
|
|
||||||
return _unreadMuted;
|
return _unreadMuted;
|
||||||
}
|
}
|
||||||
bool unreadOnlyMuted() const {
|
bool unreadOnlyMuted() const;
|
||||||
return cIncludeMuted() ? (_unreadMuted >= _unreadFull) : false;
|
|
||||||
}
|
|
||||||
void unreadIncrement(int32 count, bool muted) {
|
void unreadIncrement(int32 count, bool muted) {
|
||||||
_unreadFull += count;
|
_unreadFull += count;
|
||||||
if (muted) {
|
if (muted) {
|
||||||
|
@ -86,7 +82,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32 _unreadFull, _unreadMuted;
|
int _unreadFull, _unreadMuted;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "localstorage.h"
|
#include "localstorage.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "window/top_bar_widget.h"
|
#include "window/top_bar_widget.h"
|
||||||
|
#include "window/chat_background.h"
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
#include "playerwidget.h"
|
#include "playerwidget.h"
|
||||||
|
|
||||||
|
@ -361,7 +362,7 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
} else if (noHistoryDisplayed) {
|
} else if (noHistoryDisplayed) {
|
||||||
QPoint dogPos((width() - st::msgDogImg.pxWidth()) / 2, ((height() - st::msgDogImg.pxHeight()) * 4) / 9);
|
QPoint dogPos((width() - st::msgDogImg.pxWidth()) / 2, ((height() - st::msgDogImg.pxHeight()) * 4) / 9);
|
||||||
p.drawPixmap(dogPos, *cChatDogImage());
|
p.drawPixmap(dogPos, Window::chatBackground()->dog());
|
||||||
}
|
}
|
||||||
if (!noHistoryDisplayed) {
|
if (!noHistoryDisplayed) {
|
||||||
adjustCurrent(r.top());
|
adjustCurrent(r.top());
|
||||||
|
@ -3149,6 +3150,8 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
|
||||||
connect(&_attachDragPhoto, SIGNAL(dropped(const QMimeData*)), this, SLOT(onPhotoDrop(const QMimeData*)));
|
connect(&_attachDragPhoto, SIGNAL(dropped(const QMimeData*)), this, SLOT(onPhotoDrop(const QMimeData*)));
|
||||||
|
|
||||||
connect(&_updateEditTimeLeftDisplay, SIGNAL(timeout()), this, SLOT(updateField()));
|
connect(&_updateEditTimeLeftDisplay, SIGNAL(timeout()), this, SLOT(updateField()));
|
||||||
|
|
||||||
|
subscribe(Adaptive::Changed(), [this]() { update(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::start() {
|
void HistoryWidget::start() {
|
||||||
|
@ -5521,10 +5524,6 @@ void HistoryWidget::doneShow() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::updateAdaptiveLayout() {
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void HistoryWidget::animStop() {
|
void HistoryWidget::animStop() {
|
||||||
if (!_a_show.animating()) return;
|
if (!_a_show.animating()) return;
|
||||||
_a_show.stop();
|
_a_show.stop();
|
||||||
|
@ -8692,8 +8691,8 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
|
||||||
int fromy = (hasTopBar ? (-st::topBarHeight) : 0) + (hasPlayer ? (-st::playerHeight) : 0), x = 0, y = 0;
|
int fromy = (hasTopBar ? (-st::topBarHeight) : 0) + (hasPlayer ? (-st::playerHeight) : 0), x = 0, y = 0;
|
||||||
QPixmap cached = App::main()->cachedBackground(fill, x, y);
|
QPixmap cached = App::main()->cachedBackground(fill, x, y);
|
||||||
if (cached.isNull()) {
|
if (cached.isNull()) {
|
||||||
const QPixmap &pix(*cChatBackground());
|
auto &pix = Window::chatBackground()->image();
|
||||||
if (cTileBackground()) {
|
if (Window::chatBackground()->tile()) {
|
||||||
int left = r.left(), top = r.top(), right = r.left() + r.width(), bottom = r.top() + r.height();
|
int left = r.left(), top = r.top(), right = r.left() + r.width(), bottom = r.top() + r.height();
|
||||||
float64 w = pix.width() / cRetinaFactor(), h = pix.height() / cRetinaFactor();
|
float64 w = pix.width() / cRetinaFactor(), h = pix.height() / cRetinaFactor();
|
||||||
int sx = qFloor(left / w), sy = qFloor((top - fromy) / h), cx = qCeil(right / w), cy = qCeil((bottom - fromy) / h);
|
int sx = qFloor(left / w), sy = qFloor((top - fromy) / h), cx = qCeil(right / w), cy = qCeil((bottom - fromy) / h);
|
||||||
|
@ -8731,7 +8730,7 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
|
||||||
if (_scroll.isHidden()) {
|
if (_scroll.isHidden()) {
|
||||||
p.setClipRect(_scroll.geometry());
|
p.setClipRect(_scroll.geometry());
|
||||||
QPoint dogPos((width() - st::msgDogImg.pxWidth()) / 2, ((height() - _field.height() - 2 * st::sendPadding - st::msgDogImg.pxHeight()) * 4) / 9);
|
QPoint dogPos((width() - st::msgDogImg.pxWidth()) / 2, ((height() - _field.height() - 2 * st::sendPadding - st::msgDogImg.pxHeight()) * 4) / 9);
|
||||||
p.drawPixmap(dogPos, *cChatDogImage());
|
p.drawPixmap(dogPos, Window::chatBackground()->dog());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
style::font font(st::msgServiceFont);
|
style::font font(st::msgServiceFont);
|
||||||
|
|
|
@ -520,7 +520,7 @@ public:
|
||||||
EntitiesInText entitiesFromTextTags(const TextWithTags::Tags &tags);
|
EntitiesInText entitiesFromTextTags(const TextWithTags::Tags &tags);
|
||||||
TextWithTags::Tags textTagsFromEntities(const EntitiesInText &entities);
|
TextWithTags::Tags textTagsFromEntities(const EntitiesInText &entities);
|
||||||
|
|
||||||
class HistoryWidget : public TWidget, public RPCSender {
|
class HistoryWidget : public TWidget, public RPCSender, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -614,7 +614,6 @@ public:
|
||||||
void step_show(float64 ms, bool timer);
|
void step_show(float64 ms, bool timer);
|
||||||
void animStop();
|
void animStop();
|
||||||
|
|
||||||
void updateAdaptiveLayout();
|
|
||||||
void doneShow();
|
void doneShow();
|
||||||
|
|
||||||
QPoint clampMousePosition(QPoint point);
|
QPoint clampMousePosition(QPoint point);
|
||||||
|
|
|
@ -373,9 +373,6 @@ void IntroWidget::keyPressEvent(QKeyEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntroWidget::updateAdaptiveLayout() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void IntroWidget::rpcClear() {
|
void IntroWidget::rpcClear() {
|
||||||
for (IntroStep *step : _stepHistory) {
|
for (IntroStep *step : _stepHistory) {
|
||||||
step->rpcClear();
|
step->rpcClear();
|
||||||
|
|
|
@ -34,8 +34,6 @@ public:
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
void keyPressEvent(QKeyEvent *e) override;
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
|
||||||
void updateAdaptiveLayout();
|
|
||||||
|
|
||||||
void animShow(const QPixmap &bgAnimCache, bool back = false);
|
void animShow(const QPixmap &bgAnimCache, bool back = false);
|
||||||
void step_show(float64 ms, bool timer);
|
void step_show(float64 ms, bool timer);
|
||||||
void stop_show();
|
void stop_show();
|
||||||
|
|
|
@ -281,9 +281,6 @@ void LayerStackWidget::resizeEvent(QResizeEvent *e) {
|
||||||
updateLayerBox();
|
updateLayerBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::updateAdaptiveLayout() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerStackWidget::showLayer(LayerWidget *l) {
|
void LayerStackWidget::showLayer(LayerWidget *l) {
|
||||||
clearLayers();
|
clearLayers();
|
||||||
appendLayer(l);
|
appendLayer(l);
|
||||||
|
|
|
@ -61,8 +61,6 @@ public:
|
||||||
|
|
||||||
void showFast();
|
void showFast();
|
||||||
|
|
||||||
void updateAdaptiveLayout();
|
|
||||||
|
|
||||||
void showLayer(LayerWidget *l);
|
void showLayer(LayerWidget *l);
|
||||||
void showSpecialLayer(LayerWidget *l);
|
void showSpecialLayer(LayerWidget *l);
|
||||||
void appendLayer(LayerWidget *l);
|
void appendLayer(LayerWidget *l);
|
||||||
|
|
|
@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "serialize/serialize_document.h"
|
#include "serialize/serialize_document.h"
|
||||||
#include "serialize/serialize_common.h"
|
#include "serialize/serialize_common.h"
|
||||||
#include "data/data_drafts.h"
|
#include "data/data_drafts.h"
|
||||||
|
#include "window/chat_background.h"
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
@ -910,7 +911,7 @@ namespace {
|
||||||
stream >> v;
|
stream >> v;
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
cSetSoundNotify(v == 1);
|
Global::SetSoundNotify(v == 1);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiAutoDownload: {
|
case dbiAutoDownload: {
|
||||||
|
@ -960,7 +961,7 @@ namespace {
|
||||||
stream >> v;
|
stream >> v;
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
cSetIncludeMuted(v == 1);
|
Global::SetIncludeMuted(v == 1);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiShowingSavedGifs: {
|
case dbiShowingSavedGifs: {
|
||||||
|
@ -976,7 +977,7 @@ namespace {
|
||||||
stream >> v;
|
stream >> v;
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
cSetDesktopNotify(v == 1);
|
Global::SetDesktopNotify(v == 1);
|
||||||
if (App::wnd()) App::wnd()->updateTrayMenu();
|
if (App::wnd()) App::wnd()->updateTrayMenu();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -985,9 +986,9 @@ namespace {
|
||||||
stream >> v;
|
stream >> v;
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
cSetWindowsNotifications(v == 1);
|
Global::SetWindowsNotifications(v == 1);
|
||||||
if (cPlatform() == dbipWindows) {
|
if (cPlatform() == dbipWindows) {
|
||||||
cSetCustomNotifies((App::wnd() ? !App::wnd()->psHasNativeNotifications() : true) || !cWindowsNotifications());
|
Global::SetCustomNotifies((App::wnd() ? !App::wnd()->psHasNativeNotifications() : true) || !Global::WindowsNotifications());
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -1011,18 +1012,17 @@ namespace {
|
||||||
switch (v) {
|
switch (v) {
|
||||||
case dbictHttpProxy:
|
case dbictHttpProxy:
|
||||||
case dbictTcpProxy: {
|
case dbictTcpProxy: {
|
||||||
ConnectionProxy p;
|
ProxyData p;
|
||||||
qint32 port;
|
qint32 port;
|
||||||
stream >> p.host >> port >> p.user >> p.password;
|
stream >> p.host >> port >> p.user >> p.password;
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
p.port = uint32(port);
|
p.port = uint32(port);
|
||||||
cSetConnectionProxy(p);
|
Global::SetConnectionProxy(p);
|
||||||
}
|
Global::SetConnectionType(DBIConnectionType(v));
|
||||||
cSetConnectionType(DBIConnectionType(v));
|
} break;
|
||||||
break;
|
|
||||||
case dbictHttpAuto:
|
case dbictHttpAuto:
|
||||||
default: cSetConnectionType(dbictAuto); break;
|
default: Global::SetConnectionType(dbictAuto); break;
|
||||||
};
|
};
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -1031,7 +1031,7 @@ namespace {
|
||||||
stream >> v;
|
stream >> v;
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
cSetTryIPv6(v == 1);
|
Global::SetTryIPv6(v == 1);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiSeenTrayTooltip: {
|
case dbiSeenTrayTooltip: {
|
||||||
|
@ -1148,10 +1148,8 @@ namespace {
|
||||||
stream >> v;
|
stream >> v;
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
cSetTileBackground(v == 1);
|
bool tile = (version < 8005 && !_backgroundKey) ? false : (v == 1);
|
||||||
if (version < 8005 && !_backgroundKey) {
|
Window::chatBackground()->setTile(tile);
|
||||||
cSetTileBackground(false);
|
|
||||||
}
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiAdaptiveForWide: {
|
case dbiAdaptiveForWide: {
|
||||||
|
@ -1195,9 +1193,9 @@ namespace {
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
switch (v) {
|
switch (v) {
|
||||||
case dbinvShowNothing: cSetNotifyView(dbinvShowNothing); break;
|
case dbinvShowNothing: Global::SetNotifyView(dbinvShowNothing); break;
|
||||||
case dbinvShowName: cSetNotifyView(dbinvShowName); break;
|
case dbinvShowName: Global::SetNotifyView(dbinvShowName); break;
|
||||||
default: cSetNotifyView(dbinvShowPreview); break;
|
default: Global::SetNotifyView(dbinvShowPreview); break;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -1206,7 +1204,7 @@ namespace {
|
||||||
stream >> v;
|
stream >> v;
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
cSetAskDownloadPath(v == 1);
|
Global::SetAskDownloadPath(v == 1);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiDownloadPathOld: {
|
case dbiDownloadPathOld: {
|
||||||
|
@ -1215,8 +1213,9 @@ namespace {
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
if (!v.isEmpty() && v != qstr("tmp") && !v.endsWith('/')) v += '/';
|
if (!v.isEmpty() && v != qstr("tmp") && !v.endsWith('/')) v += '/';
|
||||||
cSetDownloadPath(v);
|
Global::SetDownloadPath(v);
|
||||||
cSetDownloadPathBookmark(QByteArray());
|
Global::SetDownloadPathBookmark(QByteArray());
|
||||||
|
Global::RefDownloadPathChanged().notify();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiDownloadPath: {
|
case dbiDownloadPath: {
|
||||||
|
@ -1226,9 +1225,10 @@ namespace {
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
if (!v.isEmpty() && v != qstr("tmp") && !v.endsWith('/')) v += '/';
|
if (!v.isEmpty() && v != qstr("tmp") && !v.endsWith('/')) v += '/';
|
||||||
cSetDownloadPath(v);
|
Global::SetDownloadPath(v);
|
||||||
cSetDownloadPathBookmark(bookmark);
|
Global::SetDownloadPathBookmark(bookmark);
|
||||||
psDownloadPathEnableAccess();
|
psDownloadPathEnableAccess();
|
||||||
|
Global::RefDownloadPathChanged().notify();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiCompressPastedImage: {
|
case dbiCompressPastedImage: {
|
||||||
|
@ -1554,7 +1554,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 size = 18 * (sizeof(quint32) + sizeof(qint32));
|
uint32 size = 18 * (sizeof(quint32) + sizeof(qint32));
|
||||||
size += sizeof(quint32) + Serialize::stringSize(cAskDownloadPath() ? QString() : cDownloadPath()) + Serialize::bytearraySize(cAskDownloadPath() ? QByteArray() : cDownloadPathBookmark());
|
size += sizeof(quint32) + Serialize::stringSize(Global::AskDownloadPath() ? QString() : Global::DownloadPath()) + Serialize::bytearraySize(Global::AskDownloadPath() ? QByteArray() : Global::DownloadPathBookmark());
|
||||||
size += sizeof(quint32) + sizeof(qint32) + (cRecentEmojisPreload().isEmpty() ? cGetRecentEmojis().size() : cRecentEmojisPreload().size()) * (sizeof(uint64) + sizeof(ushort));
|
size += sizeof(quint32) + sizeof(qint32) + (cRecentEmojisPreload().isEmpty() ? cGetRecentEmojis().size() : cRecentEmojisPreload().size()) * (sizeof(uint64) + sizeof(ushort));
|
||||||
size += sizeof(quint32) + sizeof(qint32) + cEmojiVariants().size() * (sizeof(uint32) + sizeof(uint64));
|
size += sizeof(quint32) + sizeof(qint32) + cEmojiVariants().size() * (sizeof(uint32) + sizeof(uint64));
|
||||||
size += sizeof(quint32) + sizeof(qint32) + (cRecentStickersPreload().isEmpty() ? cGetRecentStickers().size() : cRecentStickersPreload().size()) * (sizeof(uint64) + sizeof(ushort));
|
size += sizeof(quint32) + sizeof(qint32) + (cRecentStickersPreload().isEmpty() ? cGetRecentStickers().size() : cRecentStickersPreload().size()) * (sizeof(uint64) + sizeof(ushort));
|
||||||
|
@ -1567,19 +1567,19 @@ namespace {
|
||||||
|
|
||||||
EncryptedDescriptor data(size);
|
EncryptedDescriptor data(size);
|
||||||
data.stream << quint32(dbiSendKey) << qint32(cCtrlEnter() ? dbiskCtrlEnter : dbiskEnter);
|
data.stream << quint32(dbiSendKey) << qint32(cCtrlEnter() ? dbiskCtrlEnter : dbiskEnter);
|
||||||
data.stream << quint32(dbiTileBackground) << qint32(cTileBackground() ? 1 : 0);
|
data.stream << quint32(dbiTileBackground) << qint32(Window::chatBackground()->tile() ? 1 : 0);
|
||||||
data.stream << quint32(dbiAdaptiveForWide) << qint32(Global::AdaptiveForWide() ? 1 : 0);
|
data.stream << quint32(dbiAdaptiveForWide) << qint32(Global::AdaptiveForWide() ? 1 : 0);
|
||||||
data.stream << quint32(dbiAutoLock) << qint32(cAutoLock());
|
data.stream << quint32(dbiAutoLock) << qint32(cAutoLock());
|
||||||
data.stream << quint32(dbiReplaceEmojis) << qint32(cReplaceEmojis() ? 1 : 0);
|
data.stream << quint32(dbiReplaceEmojis) << qint32(cReplaceEmojis() ? 1 : 0);
|
||||||
data.stream << quint32(dbiDefaultAttach) << qint32(cDefaultAttach());
|
data.stream << quint32(dbiDefaultAttach) << qint32(cDefaultAttach());
|
||||||
data.stream << quint32(dbiSoundNotify) << qint32(cSoundNotify());
|
data.stream << quint32(dbiSoundNotify) << qint32(Global::SoundNotify());
|
||||||
data.stream << quint32(dbiIncludeMuted) << qint32(cIncludeMuted());
|
data.stream << quint32(dbiIncludeMuted) << qint32(Global::IncludeMuted());
|
||||||
data.stream << quint32(dbiShowingSavedGifs) << qint32(cShowingSavedGifs());
|
data.stream << quint32(dbiShowingSavedGifs) << qint32(cShowingSavedGifs());
|
||||||
data.stream << quint32(dbiDesktopNotify) << qint32(cDesktopNotify());
|
data.stream << quint32(dbiDesktopNotify) << qint32(Global::DesktopNotify());
|
||||||
data.stream << quint32(dbiNotifyView) << qint32(cNotifyView());
|
data.stream << quint32(dbiNotifyView) << qint32(Global::NotifyView());
|
||||||
data.stream << quint32(dbiWindowsNotifications) << qint32(cWindowsNotifications());
|
data.stream << quint32(dbiWindowsNotifications) << qint32(Global::WindowsNotifications());
|
||||||
data.stream << quint32(dbiAskDownloadPath) << qint32(cAskDownloadPath());
|
data.stream << quint32(dbiAskDownloadPath) << qint32(Global::AskDownloadPath());
|
||||||
data.stream << quint32(dbiDownloadPath) << (cAskDownloadPath() ? QString() : cDownloadPath()) << (cAskDownloadPath() ? QByteArray() : cDownloadPathBookmark());
|
data.stream << quint32(dbiDownloadPath) << (Global::AskDownloadPath() ? QString() : Global::DownloadPath()) << (Global::AskDownloadPath() ? QByteArray() : Global::DownloadPathBookmark());
|
||||||
data.stream << quint32(dbiCompressPastedImage) << qint32(cCompressPastedImage());
|
data.stream << quint32(dbiCompressPastedImage) << qint32(cCompressPastedImage());
|
||||||
data.stream << quint32(dbiDialogLastPath) << cDialogLastPath();
|
data.stream << quint32(dbiDialogLastPath) << cDialogLastPath();
|
||||||
data.stream << quint32(dbiSongVolume) << qint32(qRound(Global::SongVolume() * 1e6));
|
data.stream << quint32(dbiSongVolume) << qint32(qRound(Global::SongVolume() * 1e6));
|
||||||
|
@ -2203,8 +2203,8 @@ namespace Local {
|
||||||
size += sizeof(quint32) + Serialize::stringSize(cLangFile());
|
size += sizeof(quint32) + Serialize::stringSize(cLangFile());
|
||||||
|
|
||||||
size += sizeof(quint32) + sizeof(qint32);
|
size += sizeof(quint32) + sizeof(qint32);
|
||||||
if (cConnectionType() == dbictHttpProxy || cConnectionType() == dbictTcpProxy) {
|
if (Global::ConnectionType() == dbictHttpProxy || Global::ConnectionType() == dbictTcpProxy) {
|
||||||
const ConnectionProxy &proxy(cConnectionProxy());
|
auto &proxy = Global::ConnectionProxy();
|
||||||
size += Serialize::stringSize(proxy.host) + sizeof(qint32) + Serialize::stringSize(proxy.user) + Serialize::stringSize(proxy.password);
|
size += Serialize::stringSize(proxy.host) + sizeof(qint32) + Serialize::stringSize(proxy.user) + Serialize::stringSize(proxy.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2231,12 +2231,12 @@ namespace Local {
|
||||||
}
|
}
|
||||||
data.stream << quint32(dbiLangFile) << cLangFile();
|
data.stream << quint32(dbiLangFile) << cLangFile();
|
||||||
|
|
||||||
data.stream << quint32(dbiConnectionType) << qint32(cConnectionType());
|
data.stream << quint32(dbiConnectionType) << qint32(Global::ConnectionType());
|
||||||
if (cConnectionType() == dbictHttpProxy || cConnectionType() == dbictTcpProxy) {
|
if (Global::ConnectionType() == dbictHttpProxy || Global::ConnectionType() == dbictTcpProxy) {
|
||||||
const ConnectionProxy &proxy(cConnectionProxy());
|
auto &proxy = Global::ConnectionProxy();
|
||||||
data.stream << proxy.host << qint32(proxy.port) << proxy.user << proxy.password;
|
data.stream << proxy.host << qint32(proxy.port) << proxy.user << proxy.password;
|
||||||
}
|
}
|
||||||
data.stream << quint32(dbiTryIPv6) << qint32(cTryIPv6());
|
data.stream << quint32(dbiTryIPv6) << qint32(Global::TryIPv6());
|
||||||
|
|
||||||
TWindowPos pos(cWindowPos());
|
TWindowPos pos(cWindowPos());
|
||||||
data.stream << quint32(dbiWindowPosition) << qint32(pos.x) << qint32(pos.y) << qint32(pos.w) << qint32(pos.h) << qint32(pos.moncrc) << qint32(pos.maximized);
|
data.stream << quint32(dbiWindowPosition) << qint32(pos.x) << qint32(pos.y) << qint32(pos.w) << qint32(pos.h) << qint32(pos.moncrc) << qint32(pos.maximized);
|
||||||
|
@ -3609,8 +3609,8 @@ namespace Local {
|
||||||
bg.stream >> id;
|
bg.stream >> id;
|
||||||
if (!id || id == DefaultChatBackground) {
|
if (!id || id == DefaultChatBackground) {
|
||||||
if (bg.version < 8005) {
|
if (bg.version < 8005) {
|
||||||
if (!id) cSetTileBackground(!DefaultChatBackground);
|
|
||||||
App::initBackground(DefaultChatBackground, QImage(), true);
|
App::initBackground(DefaultChatBackground, QImage(), true);
|
||||||
|
if (!id) Window::chatBackground()->setTile(!DefaultChatBackground);
|
||||||
} else {
|
} else {
|
||||||
App::initBackground(id, QImage(), true);
|
App::initBackground(id, QImage(), true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "media/media_audio.h"
|
#include "media/media_audio.h"
|
||||||
#include "core/qthelp_regex.h"
|
#include "core/qthelp_regex.h"
|
||||||
#include "core/qthelp_url.h"
|
#include "core/qthelp_url.h"
|
||||||
|
#include "window/chat_background.h"
|
||||||
|
|
||||||
StackItemSection::StackItemSection(std_::unique_ptr<Window::SectionMemento> &&memento) : StackItem(nullptr)
|
StackItemSection::StackItemSection(std_::unique_ptr<Window::SectionMemento> &&memento) : StackItem(nullptr)
|
||||||
, _memento(std_::move(memento)) {
|
, _memento(std_::move(memento)) {
|
||||||
|
@ -103,8 +104,16 @@ MainWidget::MainWidget(MainWindow *window) : TWidget(window)
|
||||||
_webPageUpdater.setSingleShot(true);
|
_webPageUpdater.setSingleShot(true);
|
||||||
connect(&_webPageUpdater, SIGNAL(timeout()), this, SLOT(webPagesUpdate()));
|
connect(&_webPageUpdater, SIGNAL(timeout()), this, SLOT(webPagesUpdate()));
|
||||||
|
|
||||||
|
subscribe(Window::chatBackground(), [this](const Window::ChatBackgroundUpdate &update) {
|
||||||
|
using Update = Window::ChatBackgroundUpdate;
|
||||||
|
if (update.type == Update::Type::New || update.type == Update::Type::Changed) {
|
||||||
|
clearCachedBackground();
|
||||||
|
}
|
||||||
|
});
|
||||||
connect(&_cacheBackgroundTimer, SIGNAL(timeout()), this, SLOT(onCacheBackground()));
|
connect(&_cacheBackgroundTimer, SIGNAL(timeout()), this, SLOT(onCacheBackground()));
|
||||||
|
|
||||||
|
subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); });
|
||||||
|
|
||||||
_dialogs->show();
|
_dialogs->show();
|
||||||
if (Adaptive::OneColumn()) {
|
if (Adaptive::OneColumn()) {
|
||||||
_history->hide();
|
_history->hide();
|
||||||
|
@ -1007,8 +1016,8 @@ bool MainWidget::sendMessageFail(const RPCError &error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::onCacheBackground() {
|
void MainWidget::onCacheBackground() {
|
||||||
const QPixmap &bg(*cChatBackground());
|
auto &bg = Window::chatBackground()->image();
|
||||||
if (cTileBackground()) {
|
if (Window::chatBackground()->tile()) {
|
||||||
QImage result(_willCacheFor.width() * cIntRetinaFactor(), _willCacheFor.height() * cIntRetinaFactor(), QImage::Format_RGB32);
|
QImage result(_willCacheFor.width() * cIntRetinaFactor(), _willCacheFor.height() * cIntRetinaFactor(), QImage::Format_RGB32);
|
||||||
result.setDevicePixelRatio(cRetinaFactor());
|
result.setDevicePixelRatio(cRetinaFactor());
|
||||||
{
|
{
|
||||||
|
@ -1508,9 +1517,10 @@ void MainWidget::loadFailed(mtpFileLoader *loader, bool started, const char *ret
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::onDownloadPathSettings() {
|
void MainWidget::onDownloadPathSettings() {
|
||||||
cSetDownloadPath(QString());
|
Global::SetDownloadPath(QString());
|
||||||
cSetDownloadPathBookmark(QByteArray());
|
Global::SetDownloadPathBookmark(QByteArray());
|
||||||
Ui::showLayer(new DownloadPathBox());
|
Ui::showLayer(new DownloadPathBox());
|
||||||
|
Global::RefDownloadPathChanged().notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::onSharePhoneWithBot(PeerData *recipient) {
|
void MainWidget::onSharePhoneWithBot(PeerData *recipient) {
|
||||||
|
@ -1766,6 +1776,7 @@ bool MainWidget::isIdle() const {
|
||||||
void MainWidget::clearCachedBackground() {
|
void MainWidget::clearCachedBackground() {
|
||||||
_cachedBackground = QPixmap();
|
_cachedBackground = QPixmap();
|
||||||
_cacheBackgroundTimer.stop();
|
_cacheBackgroundTimer.stop();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap MainWidget::cachedBackground(const QRect &forRect, int &x, int &y) {
|
QPixmap MainWidget::cachedBackground(const QRect &forRect, int &x, int &y) {
|
||||||
|
@ -1782,7 +1793,7 @@ QPixmap MainWidget::cachedBackground(const QRect &forRect, int &x, int &y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::backgroundParams(const QRect &forRect, QRect &to, QRect &from) const {
|
void MainWidget::backgroundParams(const QRect &forRect, QRect &to, QRect &from) const {
|
||||||
const QSize &bg(cChatBackground()->size());
|
auto &bg = Window::chatBackground()->image().size();
|
||||||
if (uint64(bg.width()) * forRect.height() > uint64(bg.height()) * forRect.width()) {
|
if (uint64(bg.width()) * forRect.height() > uint64(bg.height()) * forRect.width()) {
|
||||||
float64 pxsize = forRect.height() / float64(bg.height());
|
float64 pxsize = forRect.height() / float64(bg.height());
|
||||||
int takewidth = qCeil(forRect.width() / pxsize);
|
int takewidth = qCeil(forRect.width() / pxsize);
|
||||||
|
@ -2689,11 +2700,6 @@ void MainWidget::keyPressEvent(QKeyEvent *e) {
|
||||||
void MainWidget::updateAdaptiveLayout() {
|
void MainWidget::updateAdaptiveLayout() {
|
||||||
showAll();
|
showAll();
|
||||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||||
if (_wideSection) {
|
|
||||||
_wideSection->updateAdaptiveLayout();
|
|
||||||
}
|
|
||||||
_topBar->updateAdaptiveLayout();
|
|
||||||
_history->updateAdaptiveLayout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWidget::needBackButton() {
|
bool MainWidget::needBackButton() {
|
||||||
|
|
|
@ -127,7 +127,7 @@ class ItemBase;
|
||||||
} // namespace Layout
|
} // namespace Layout
|
||||||
} // namespace InlineBots
|
} // namespace InlineBots
|
||||||
|
|
||||||
class MainWidget : public TWidget, public RPCSender {
|
class MainWidget : public TWidget, public RPCSender, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -138,7 +138,6 @@ public:
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
void keyPressEvent(QKeyEvent *e) override;
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
|
||||||
void updateAdaptiveLayout();
|
|
||||||
bool needBackButton();
|
bool needBackButton();
|
||||||
|
|
||||||
// Temporary methods, while top bar was not done inside HistoryWidget / OverviewWidget.
|
// Temporary methods, while top bar was not done inside HistoryWidget / OverviewWidget.
|
||||||
|
@ -318,7 +317,6 @@ public:
|
||||||
|
|
||||||
bool isIdle() const;
|
bool isIdle() const;
|
||||||
|
|
||||||
void clearCachedBackground();
|
|
||||||
QPixmap cachedBackground(const QRect &forRect, int &x, int &y);
|
QPixmap cachedBackground(const QRect &forRect, int &x, int &y);
|
||||||
void backgroundParams(const QRect &forRect, QRect &to, QRect &from) const;
|
void backgroundParams(const QRect &forRect, QRect &to, QRect &from) const;
|
||||||
void updateScrollColors();
|
void updateScrollColors();
|
||||||
|
@ -480,6 +478,8 @@ private slots:
|
||||||
void onDeletePhotoSure();
|
void onDeletePhotoSure();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateAdaptiveLayout();
|
||||||
|
|
||||||
void sendReadRequest(PeerData *peer, MsgId upTo);
|
void sendReadRequest(PeerData *peer, MsgId upTo);
|
||||||
void channelReadDone(PeerData *peer, const MTPBool &result);
|
void channelReadDone(PeerData *peer, const MTPBool &result);
|
||||||
void historyReadDone(PeerData *peer, const MTPmessages_AffectedMessages &result);
|
void historyReadDone(PeerData *peer, const MTPmessages_AffectedMessages &result);
|
||||||
|
@ -562,6 +562,8 @@ private:
|
||||||
void overviewPreloaded(PeerData *data, const MTPmessages_Messages &result, mtpRequestId req);
|
void overviewPreloaded(PeerData *data, const MTPmessages_Messages &result, mtpRequestId req);
|
||||||
bool overviewFailed(PeerData *data, const RPCError &error, mtpRequestId req);
|
bool overviewFailed(PeerData *data, const RPCError &error, mtpRequestId req);
|
||||||
|
|
||||||
|
void clearCachedBackground();
|
||||||
|
|
||||||
Animation _a_show;
|
Animation _a_show;
|
||||||
QPixmap _cacheUnder, _cacheOver;
|
QPixmap _cacheUnder, _cacheOver;
|
||||||
anim::ivalue a_coordUnder, a_coordOver;
|
anim::ivalue a_coordUnder, a_coordOver;
|
||||||
|
|
|
@ -171,7 +171,7 @@ void NotifyWindow::updateNotifyDisplay() {
|
||||||
p.fillRect(st::notifyBorderWidth, h - st::notifyBorderWidth, w - st::notifyBorderWidth, st::notifyBorderWidth, st::notifyBorder->b);
|
p.fillRect(st::notifyBorderWidth, h - st::notifyBorderWidth, w - st::notifyBorderWidth, st::notifyBorderWidth, st::notifyBorder->b);
|
||||||
p.fillRect(0, st::notifyBorderWidth, st::notifyBorderWidth, h - st::notifyBorderWidth, st::notifyBorder->b);
|
p.fillRect(0, st::notifyBorderWidth, st::notifyBorderWidth, h - st::notifyBorderWidth, st::notifyBorder->b);
|
||||||
|
|
||||||
if (!App::passcoded() && cNotifyView() <= dbinvShowName) {
|
if (!App::passcoded() && Global::NotifyView() <= dbinvShowName) {
|
||||||
history->peer->loadUserpic(true, true);
|
history->peer->loadUserpic(true, true);
|
||||||
history->peer->paintUserpicLeft(p, st::notifyPhotoSize, st::notifyPhotoPos.x(), st::notifyPhotoPos.y(), width());
|
history->peer->paintUserpicLeft(p, st::notifyPhotoSize, st::notifyPhotoPos.x(), st::notifyPhotoPos.y(), width());
|
||||||
} else {
|
} else {
|
||||||
|
@ -182,7 +182,7 @@ void NotifyWindow::updateNotifyDisplay() {
|
||||||
int32 itemWidth = w - st::notifyPhotoPos.x() - st::notifyPhotoSize - st::notifyTextLeft - st::notifyClosePos.x() - st::notifyClose.width;
|
int32 itemWidth = w - st::notifyPhotoPos.x() - st::notifyPhotoSize - st::notifyTextLeft - st::notifyClosePos.x() - st::notifyClose.width;
|
||||||
|
|
||||||
QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height);
|
QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height);
|
||||||
if (!App::passcoded() && cNotifyView() <= dbinvShowName) {
|
if (!App::passcoded() && Global::NotifyView() <= dbinvShowName) {
|
||||||
if (history->peer->isChat() || history->peer->isMegagroup()) {
|
if (history->peer->isChat() || history->peer->isMegagroup()) {
|
||||||
p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), st::dlgChatImg);
|
p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), st::dlgChatImg);
|
||||||
rectForName.setLeft(rectForName.left() + st::dialogsImgSkip);
|
rectForName.setLeft(rectForName.left() + st::dialogsImgSkip);
|
||||||
|
@ -201,7 +201,7 @@ void NotifyWindow::updateNotifyDisplay() {
|
||||||
p.setPen(st::dialogsDateFg);
|
p.setPen(st::dialogsDateFg);
|
||||||
p.drawText(rectForName.left() + rectForName.width() + st::dialogsDateSkip, rectForName.top() + st::dialogsTextFont->ascent, dt);
|
p.drawText(rectForName.left() + rectForName.width() + st::dialogsDateSkip, rectForName.top() + st::dialogsTextFont->ascent, dt);
|
||||||
|
|
||||||
if (!App::passcoded() && cNotifyView() <= dbinvShowPreview) {
|
if (!App::passcoded() && Global::NotifyView() <= dbinvShowPreview) {
|
||||||
const HistoryItem *textCachedFor = 0;
|
const HistoryItem *textCachedFor = 0;
|
||||||
Text itemTextCache(itemWidth);
|
Text itemTextCache(itemWidth);
|
||||||
QRect r(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyItemTop + st::msgNameFont->height, itemWidth, 2 * st::dialogsTextFont->height);
|
QRect r(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyItemTop + st::msgNameFont->height, itemWidth, 2 * st::dialogsTextFont->height);
|
||||||
|
@ -226,7 +226,7 @@ void NotifyWindow::updateNotifyDisplay() {
|
||||||
}
|
}
|
||||||
|
|
||||||
p.setPen(st::dialogsNameFg);
|
p.setPen(st::dialogsNameFg);
|
||||||
if (!App::passcoded() && cNotifyView() <= dbinvShowName) {
|
if (!App::passcoded() && Global::NotifyView() <= dbinvShowName) {
|
||||||
history->peer->dialogName().drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
|
history->peer->dialogName().drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
|
||||||
} else {
|
} else {
|
||||||
p.setFont(st::msgNameFont->f);
|
p.setFont(st::msgNameFont->f);
|
||||||
|
@ -372,6 +372,19 @@ MainWindow::MainWindow() {
|
||||||
iconbig32 = iconbig256.scaledToWidth(32, Qt::SmoothTransformation);
|
iconbig32 = iconbig256.scaledToWidth(32, Qt::SmoothTransformation);
|
||||||
iconbig64 = iconbig256.scaledToWidth(64, Qt::SmoothTransformation);
|
iconbig64 = iconbig256.scaledToWidth(64, Qt::SmoothTransformation);
|
||||||
|
|
||||||
|
subscribe(Global::RefNotifySettingsChanged(), [this](const Notify::ChangeType &type) {
|
||||||
|
if (type == Notify::ChangeType::DesktopEnabled) {
|
||||||
|
updateTrayMenu();
|
||||||
|
notifyClear();
|
||||||
|
} else if (type == Notify::ChangeType::ViewParams) {
|
||||||
|
notifyUpdateAll();
|
||||||
|
} else if (type == Notify::ChangeType::UseNative) {
|
||||||
|
notifyClearFast();
|
||||||
|
} else if (type == Notify::ChangeType::IncludeMuted) {
|
||||||
|
Notify::unreadCounterUpdated();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (objectName().isEmpty()) {
|
if (objectName().isEmpty()) {
|
||||||
setObjectName(qsl("MainWindow"));
|
setObjectName(qsl("MainWindow"));
|
||||||
}
|
}
|
||||||
|
@ -396,6 +409,8 @@ MainWindow::MainWindow() {
|
||||||
|
|
||||||
connect(this, SIGNAL(imageLoaded()), this, SLOT(notifyUpdateAllPhotos()));
|
connect(this, SIGNAL(imageLoaded()), this, SLOT(notifyUpdateAllPhotos()));
|
||||||
|
|
||||||
|
subscribe(Global::RefSelfChanged(), [this]() { updateGlobalMenu(); });
|
||||||
|
|
||||||
setAttribute(Qt::WA_NoSystemBackground);
|
setAttribute(Qt::WA_NoSystemBackground);
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
}
|
}
|
||||||
|
@ -455,7 +470,7 @@ void MainWindow::firstShow() {
|
||||||
#else
|
#else
|
||||||
trayIconMenu = new QMenu(this);
|
trayIconMenu = new QMenu(this);
|
||||||
#endif
|
#endif
|
||||||
auto notificationItem = lang(cDesktopNotify()
|
auto notificationItem = lang(Global::DesktopNotify()
|
||||||
? lng_disable_notifications_from_tray : lng_enable_notifications_from_tray);
|
? lng_disable_notifications_from_tray : lng_enable_notifications_from_tray);
|
||||||
|
|
||||||
if (cPlatform() == dbipWindows || cPlatform() == dbipMac || cPlatform() == dbipMacOld) {
|
if (cPlatform() == dbipWindows || cPlatform() == dbipMac || cPlatform() == dbipMacOld) {
|
||||||
|
@ -716,7 +731,7 @@ void MainWindow::ui_hideSettingsAndLayer(ShowLayerOptions options) {
|
||||||
void MainWindow::mtpStateChanged(int32 dc, int32 state) {
|
void MainWindow::mtpStateChanged(int32 dc, int32 state) {
|
||||||
if (dc == MTP::maindc()) {
|
if (dc == MTP::maindc()) {
|
||||||
updateTitleStatus();
|
updateTitleStatus();
|
||||||
// if (settings) settings->updateConnectionType(); TODO
|
Global::RefConnectionTypeChanged().notify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1108,7 +1123,7 @@ void MainWindow::updateTrayMenu(bool force) {
|
||||||
if (!trayIconMenu || (cPlatform() == dbipWindows && !force)) return;
|
if (!trayIconMenu || (cPlatform() == dbipWindows && !force)) return;
|
||||||
|
|
||||||
bool active = isActive(false);
|
bool active = isActive(false);
|
||||||
QString notificationItem = lang(cDesktopNotify()
|
QString notificationItem = lang(Global::DesktopNotify()
|
||||||
? lng_disable_notifications_from_tray : lng_enable_notifications_from_tray);
|
? lng_disable_notifications_from_tray : lng_enable_notifications_from_tray);
|
||||||
|
|
||||||
if (cPlatform() == dbipWindows || cPlatform() == dbipMac || cPlatform() == dbipMacOld) {
|
if (cPlatform() == dbipWindows || cPlatform() == dbipMac || cPlatform() == dbipMacOld) {
|
||||||
|
@ -1255,15 +1270,28 @@ void MainWindow::toggleDisplayNotifyFromTray() {
|
||||||
Ui::showLayer(new InformBox(lang(lng_passcode_need_unblock)));
|
Ui::showLayer(new InformBox(lang(lng_passcode_need_unblock)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cSetDesktopNotify(!cDesktopNotify());
|
|
||||||
if (settings) {
|
bool soundNotifyChanged = false;
|
||||||
// settings->updateDisplayNotify(); TODO
|
Global::SetDesktopNotify(!Global::DesktopNotify());
|
||||||
|
if (Global::DesktopNotify()) {
|
||||||
|
if (Global::RestoreSoundNotifyFromTray() && !Global::SoundNotify()) {
|
||||||
|
Global::SetSoundNotify(true);
|
||||||
|
Global::SetRestoreSoundNotifyFromTray(false);
|
||||||
|
soundNotifyChanged = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!cDesktopNotify()) {
|
if (Global::SoundNotify()) {
|
||||||
notifyClear();
|
Global::SetSoundNotify(false);
|
||||||
|
Global::SetRestoreSoundNotifyFromTray(true);
|
||||||
|
soundNotifyChanged = true;
|
||||||
|
} else {
|
||||||
|
Global::SetRestoreSoundNotifyFromTray(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Local::writeUserSettings();
|
Local::writeUserSettings();
|
||||||
updateTrayMenu();
|
Global::RefNotifySettingsChanged().notify(Notify::ChangeType::DesktopEnabled);
|
||||||
|
if (soundNotifyChanged) {
|
||||||
|
Global::RefNotifySettingsChanged().notify(Notify::ChangeType::SoundEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1294,7 +1322,7 @@ void MainWindow::resizeEvent(QResizeEvent *e) {
|
||||||
}
|
}
|
||||||
if (layout != Global::AdaptiveLayout()) {
|
if (layout != Global::AdaptiveLayout()) {
|
||||||
Global::SetAdaptiveLayout(layout);
|
Global::SetAdaptiveLayout(layout);
|
||||||
updateAdaptiveLayout();
|
Adaptive::Changed().notify(true);
|
||||||
}
|
}
|
||||||
title->setGeometry(0, 0, width(), st::titleHeight);
|
title->setGeometry(0, 0, width(), st::titleHeight);
|
||||||
if (layerBg) layerBg->resize(width(), height());
|
if (layerBg) layerBg->resize(width(), height());
|
||||||
|
@ -1303,13 +1331,6 @@ void MainWindow::resizeEvent(QResizeEvent *e) {
|
||||||
emit resized(QSize(width(), height() - st::titleHeight));
|
emit resized(QSize(width(), height() - st::titleHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateAdaptiveLayout() {
|
|
||||||
title->updateAdaptiveLayout();
|
|
||||||
if (main) main->updateAdaptiveLayout();
|
|
||||||
if (intro) intro->updateAdaptiveLayout();
|
|
||||||
if (layerBg) layerBg->updateAdaptiveLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
MainWindow::TempDirState MainWindow::tempDirState() {
|
MainWindow::TempDirState MainWindow::tempDirState() {
|
||||||
if (_clearManager && _clearManager->hasTask(Local::ClearManagerDownloads)) {
|
if (_clearManager && _clearManager->hasTask(Local::ClearManagerDownloads)) {
|
||||||
return TempDirRemoving;
|
return TempDirRemoving;
|
||||||
|
@ -1407,7 +1428,7 @@ void MainWindow::notifySchedule(History *history, HistoryItem *item) {
|
||||||
|
|
||||||
uint64 when = ms + delay;
|
uint64 when = ms + delay;
|
||||||
notifyWhenAlerts[history].insert(when, notifyByFrom);
|
notifyWhenAlerts[history].insert(when, notifyByFrom);
|
||||||
if (cDesktopNotify() && !psSkipDesktopNotify()) {
|
if (Global::DesktopNotify() && !psSkipDesktopNotify()) {
|
||||||
NotifyWhenMaps::iterator i = notifyWhenMaps.find(history);
|
NotifyWhenMaps::iterator i = notifyWhenMaps.find(history);
|
||||||
if (i == notifyWhenMaps.end()) {
|
if (i == notifyWhenMaps.end()) {
|
||||||
i = notifyWhenMaps.insert(history, NotifyWhenMap());
|
i = notifyWhenMaps.insert(history, NotifyWhenMap());
|
||||||
|
@ -1553,14 +1574,14 @@ void MainWindow::notifyShowNext(NotifyWindow *remove) {
|
||||||
App::playSound();
|
App::playSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cCustomNotifies()) {
|
if (Global::CustomNotifies()) {
|
||||||
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
||||||
int32 ind = (*i)->index();
|
int32 ind = (*i)->index();
|
||||||
if (ind < 0) continue;
|
if (ind < 0) continue;
|
||||||
--count;
|
--count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count <= 0 || notifyWaiters.isEmpty() || !cDesktopNotify() || psSkipDesktopNotify()) {
|
if (count <= 0 || notifyWaiters.isEmpty() || !Global::DesktopNotify() || psSkipDesktopNotify()) {
|
||||||
if (nextAlert) {
|
if (nextAlert) {
|
||||||
notifyWaitTimer.start(nextAlert - ms);
|
notifyWaitTimer.start(nextAlert - ms);
|
||||||
}
|
}
|
||||||
|
@ -1656,7 +1677,7 @@ void MainWindow::notifyShowNext(NotifyWindow *remove) {
|
||||||
} while (nextNotify);
|
} while (nextNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cCustomNotifies()) {
|
if (Global::CustomNotifies()) {
|
||||||
NotifyWindow *notify = new NotifyWindow(notifyItem, x, y, fwdCount);
|
NotifyWindow *notify = new NotifyWindow(notifyItem, x, y, fwdCount);
|
||||||
notifyWindows.push_back(notify);
|
notifyWindows.push_back(notify);
|
||||||
psNotifyShown(notify);
|
psNotifyShown(notify);
|
||||||
|
@ -1689,7 +1710,7 @@ void MainWindow::notifyShowNext(NotifyWindow *remove) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::notifyItemRemoved(HistoryItem *item) {
|
void MainWindow::notifyItemRemoved(HistoryItem *item) {
|
||||||
if (cCustomNotifies()) {
|
if (Global::CustomNotifies()) {
|
||||||
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
||||||
(*i)->itemRemoved(item);
|
(*i)->itemRemoved(item);
|
||||||
}
|
}
|
||||||
|
@ -1697,7 +1718,7 @@ void MainWindow::notifyItemRemoved(HistoryItem *item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::notifyStopHiding() {
|
void MainWindow::notifyStopHiding() {
|
||||||
if (cCustomNotifies()) {
|
if (Global::CustomNotifies()) {
|
||||||
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
||||||
(*i)->stopHiding();
|
(*i)->stopHiding();
|
||||||
}
|
}
|
||||||
|
@ -1705,7 +1726,7 @@ void MainWindow::notifyStopHiding() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::notifyStartHiding() {
|
void MainWindow::notifyStartHiding() {
|
||||||
if (cCustomNotifies()) {
|
if (Global::CustomNotifies()) {
|
||||||
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
||||||
(*i)->startHiding();
|
(*i)->startHiding();
|
||||||
}
|
}
|
||||||
|
@ -1713,7 +1734,7 @@ void MainWindow::notifyStartHiding() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::notifyUpdateAllPhotos() {
|
void MainWindow::notifyUpdateAllPhotos() {
|
||||||
if (cCustomNotifies()) {
|
if (Global::CustomNotifies()) {
|
||||||
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
||||||
(*i)->updatePeerPhoto();
|
(*i)->updatePeerPhoto();
|
||||||
}
|
}
|
||||||
|
@ -1726,7 +1747,7 @@ void MainWindow::app_activateClickHandler(ClickHandlerPtr handler, Qt::MouseButt
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::notifyUpdateAll() {
|
void MainWindow::notifyUpdateAll() {
|
||||||
if (cCustomNotifies()) {
|
if (Global::CustomNotifies()) {
|
||||||
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
||||||
(*i)->updateNotifyDisplay();
|
(*i)->updateNotifyDisplay();
|
||||||
}
|
}
|
||||||
|
@ -1735,7 +1756,7 @@ void MainWindow::notifyUpdateAll() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::notifyActivateAll() {
|
void MainWindow::notifyActivateAll() {
|
||||||
if (cCustomNotifies()) {
|
if (Global::CustomNotifies()) {
|
||||||
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
|
||||||
psActivateNotify(*i);
|
psActivateNotify(*i);
|
||||||
}
|
}
|
||||||
|
@ -2758,7 +2779,7 @@ void LastCrashedWindow::updateControls() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastCrashedWindow::onNetworkSettings() {
|
void LastCrashedWindow::onNetworkSettings() {
|
||||||
const ConnectionProxy &p(Sandbox::PreLaunchProxy());
|
auto &p = Sandbox::PreLaunchProxy();
|
||||||
NetworkSettingsWindow *box = new NetworkSettingsWindow(this, p.host, p.port ? p.port : 80, p.user, p.password);
|
NetworkSettingsWindow *box = new NetworkSettingsWindow(this, p.host, p.port ? p.port : 80, p.user, p.password);
|
||||||
connect(box, SIGNAL(saved(QString, quint32, QString, QString)), this, SLOT(onNetworkSettingsSaved(QString, quint32, QString, QString)));
|
connect(box, SIGNAL(saved(QString, quint32, QString, QString)), this, SLOT(onNetworkSettingsSaved(QString, quint32, QString, QString)));
|
||||||
box->show();
|
box->show();
|
||||||
|
|
|
@ -126,7 +126,7 @@ typedef QList<NotifyWindow*> NotifyWindows;
|
||||||
|
|
||||||
class MediaPreviewWidget;
|
class MediaPreviewWidget;
|
||||||
|
|
||||||
class MainWindow : public Platform::MainWindow {
|
class MainWindow : public Platform::MainWindow, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -151,7 +151,6 @@ public:
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
void updateAdaptiveLayout();
|
|
||||||
|
|
||||||
void setupPasscode(bool anim);
|
void setupPasscode(bool anim);
|
||||||
void clearPasscode();
|
void clearPasscode();
|
||||||
|
|
|
@ -773,17 +773,17 @@ PeerData *MediaView::ui_getPeerForMouseAction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaView::onDownload() {
|
void MediaView::onDownload() {
|
||||||
if (cAskDownloadPath()) {
|
if (Global::AskDownloadPath()) {
|
||||||
return onSaveAs();
|
return onSaveAs();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString path;
|
QString path;
|
||||||
if (cDownloadPath().isEmpty()) {
|
if (Global::DownloadPath().isEmpty()) {
|
||||||
path = psDownloadPath();
|
path = psDownloadPath();
|
||||||
} else if (cDownloadPath() == qsl("tmp")) {
|
} else if (Global::DownloadPath() == qsl("tmp")) {
|
||||||
path = cTempDir();
|
path = cTempDir();
|
||||||
} else {
|
} else {
|
||||||
path = cDownloadPath();
|
path = Global::DownloadPath();
|
||||||
}
|
}
|
||||||
QString toName;
|
QString toName;
|
||||||
if (_doc) {
|
if (_doc) {
|
||||||
|
|
|
@ -513,7 +513,7 @@ QString ConnectionPrivate::transport() const {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
QString result = (_conn4 ? _conn4 : _conn6)->transport();
|
QString result = (_conn4 ? _conn4 : _conn6)->transport();
|
||||||
if (!result.isEmpty() && cTryIPv6()) result += (_conn4 ? "/IPv4" : "/IPv6");
|
if (!result.isEmpty() && Global::TryIPv6()) result += (_conn4 ? "/IPv4" : "/IPv6");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1130,15 +1130,15 @@ void ConnectionPrivate::socketStart(bool afterConfig) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool noIPv4 = !port[IPv4address][HttpProtocol], noIPv6 = (!cTryIPv6() || !port[IPv6address][HttpProtocol]);
|
bool noIPv4 = !port[IPv4address][HttpProtocol], noIPv6 = (!Global::TryIPv6() || !port[IPv6address][HttpProtocol]);
|
||||||
if (noIPv4 && noIPv6) {
|
if (noIPv4 && noIPv6) {
|
||||||
if (afterConfig) {
|
if (afterConfig) {
|
||||||
if (noIPv4) LOG(("MTP Error: DC %1 options for IPv4 over HTTP not found right after config load!").arg(dc));
|
if (noIPv4) LOG(("MTP Error: DC %1 options for IPv4 over HTTP not found right after config load!").arg(dc));
|
||||||
if (cTryIPv6() && noIPv6) LOG(("MTP Error: DC %1 options for IPv6 over HTTP not found right after config load!").arg(dc));
|
if (Global::TryIPv6() && noIPv6) LOG(("MTP Error: DC %1 options for IPv6 over HTTP not found right after config load!").arg(dc));
|
||||||
return restart();
|
return restart();
|
||||||
}
|
}
|
||||||
if (noIPv4) DEBUG_LOG(("MTP Info: DC %1 options for IPv4 over HTTP not found, waiting for config").arg(dc));
|
if (noIPv4) DEBUG_LOG(("MTP Info: DC %1 options for IPv4 over HTTP not found, waiting for config").arg(dc));
|
||||||
if (cTryIPv6() && noIPv6) DEBUG_LOG(("MTP Info: DC %1 options for IPv6 over HTTP not found, waiting for config").arg(dc));
|
if (Global::TryIPv6() && noIPv6) DEBUG_LOG(("MTP Info: DC %1 options for IPv6 over HTTP not found, waiting for config").arg(dc));
|
||||||
connect(configLoader(), SIGNAL(loaded()), this, SLOT(onConfigLoaded()));
|
connect(configLoader(), SIGNAL(loaded()), this, SLOT(onConfigLoaded()));
|
||||||
configLoader()->load();
|
configLoader()->load();
|
||||||
return;
|
return;
|
||||||
|
@ -1273,7 +1273,7 @@ void ConnectionPrivate::onPingSendForce() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionPrivate::onWaitReceivedFailed() {
|
void ConnectionPrivate::onWaitReceivedFailed() {
|
||||||
if (cConnectionType() != dbictAuto && cConnectionType() != dbictTcpProxy) {
|
if (Global::ConnectionType() != dbictAuto && Global::ConnectionType() != dbictTcpProxy) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,9 @@ MTPResPQ AbstractConnection::readPQFakeReply(const mtpBuffer &buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractConnection *AbstractConnection::create(QThread *thread) {
|
AbstractConnection *AbstractConnection::create(QThread *thread) {
|
||||||
if (cConnectionType() == dbictHttpProxy) {
|
if (Global::ConnectionType() == dbictHttpProxy) {
|
||||||
return new HTTPConnection(thread);
|
return new HTTPConnection(thread);
|
||||||
} else if (cConnectionType() == dbictTcpProxy) {
|
} else if (Global::ConnectionType() == dbictTcpProxy) {
|
||||||
return new TCPConnection(thread);
|
return new TCPConnection(thread);
|
||||||
}
|
}
|
||||||
return new AutoConnection(thread);
|
return new AutoConnection(thread);
|
||||||
|
|
|
@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "boxes/photocropbox.h"
|
#include "boxes/photocropbox.h"
|
||||||
#include "ui/filedialog.h"
|
#include "ui/filedialog.h"
|
||||||
#include "window/top_bar_widget.h"
|
#include "window/top_bar_widget.h"
|
||||||
|
#include "window/chat_background.h"
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
|
@ -812,7 +813,7 @@ void OverviewInner::paintEvent(QPaintEvent *e) {
|
||||||
|
|
||||||
if (_history->overview[_type].isEmpty() && (!_migrated || !_history->overviewLoaded(_type) || _migrated->overview[_type].isEmpty())) {
|
if (_history->overview[_type].isEmpty() && (!_migrated || !_history->overviewLoaded(_type) || _migrated->overview[_type].isEmpty())) {
|
||||||
QPoint dogPos((_width - st::msgDogImg.pxWidth()) / 2, ((height() - st::msgDogImg.pxHeight()) * 4) / 9);
|
QPoint dogPos((_width - st::msgDogImg.pxWidth()) / 2, ((height() - st::msgDogImg.pxHeight()) * 4) / 9);
|
||||||
p.drawPixmap(dogPos, *cChatDogImage());
|
p.drawPixmap(dogPos, Window::chatBackground()->dog());
|
||||||
return;
|
return;
|
||||||
} else if (_inSearch && _searchResults.isEmpty() && _searchFull && (!_migrated || _searchFullMigrated) && !_searchTimer.isActive()) {
|
} else if (_inSearch && _searchResults.isEmpty() && _searchFull && (!_migrated || _searchFullMigrated) && !_searchTimer.isActive()) {
|
||||||
p.setFont(st::noContactsFont->f);
|
p.setFont(st::noContactsFont->f);
|
||||||
|
|
|
@ -483,12 +483,12 @@ void MainWindow::psNotifyShown(NotifyWindow *w) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::psPlatformNotify(HistoryItem *item, int32 fwdCount) {
|
void MainWindow::psPlatformNotify(HistoryItem *item, int32 fwdCount) {
|
||||||
QString title = (!App::passcoded() && cNotifyView() <= dbinvShowName && !Global::ScreenIsLocked()) ? item->history()->peer->name : qsl("Telegram Desktop");
|
QString title = (!App::passcoded() && Global::NotifyView() <= dbinvShowName && !Global::ScreenIsLocked()) ? item->history()->peer->name : qsl("Telegram Desktop");
|
||||||
QString subtitle = (!App::passcoded() && cNotifyView() <= dbinvShowName && !Global::ScreenIsLocked()) ? item->notificationHeader() : QString();
|
QString subtitle = (!App::passcoded() && Global::NotifyView() <= dbinvShowName && !Global::ScreenIsLocked()) ? item->notificationHeader() : QString();
|
||||||
QPixmap pix = (!App::passcoded() && cNotifyView() <= dbinvShowName && !Global::ScreenIsLocked()) ? item->history()->peer->genUserpic(st::notifyMacPhotoSize) : QPixmap();
|
QPixmap pix = (!App::passcoded() && Global::NotifyView() <= dbinvShowName && !Global::ScreenIsLocked()) ? item->history()->peer->genUserpic(st::notifyMacPhotoSize) : QPixmap();
|
||||||
QString msg = (!App::passcoded() && cNotifyView() <= dbinvShowPreview && !Global::ScreenIsLocked()) ? (fwdCount < 2 ? item->notificationText() : lng_forward_messages(lt_count, fwdCount)) : lang(lng_notification_preview);
|
QString msg = (!App::passcoded() && Global::NotifyView() <= dbinvShowPreview && !Global::ScreenIsLocked()) ? (fwdCount < 2 ? item->notificationText() : lng_forward_messages(lt_count, fwdCount)) : lang(lng_notification_preview);
|
||||||
|
|
||||||
bool withReply = !App::passcoded() && (cNotifyView() <= dbinvShowPreview && !Global::ScreenIsLocked()) && item->history()->peer->canWrite();
|
bool withReply = !App::passcoded() && (Global::NotifyView() <= dbinvShowPreview && !Global::ScreenIsLocked()) && item->history()->peer->canWrite();
|
||||||
|
|
||||||
_private.showNotify(item->history()->peer->id, item->id, pix, title, subtitle, msg, withReply);
|
_private.showNotify(item->history()->peer->id, item->id, pix, title, subtitle, msg, withReply);
|
||||||
}
|
}
|
||||||
|
|
|
@ -886,9 +886,9 @@ bool MainWindow::psHasNativeNotifications() {
|
||||||
Q_DECLARE_METATYPE(QMargins);
|
Q_DECLARE_METATYPE(QMargins);
|
||||||
void MainWindow::psFirstShow() {
|
void MainWindow::psFirstShow() {
|
||||||
if (Toasts::supported()) {
|
if (Toasts::supported()) {
|
||||||
cSetCustomNotifies(!cWindowsNotifications());
|
Global::SetCustomNotifies(!Global::WindowsNotifications());
|
||||||
} else {
|
} else {
|
||||||
cSetCustomNotifies(true);
|
Global::SetCustomNotifies(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_psShadowWindows.init(_shActive);
|
_psShadowWindows.init(_shActive);
|
||||||
|
@ -1088,10 +1088,10 @@ void MainWindow::psNotifyShown(NotifyWindow *w) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::psPlatformNotify(HistoryItem *item, int32 fwdCount) {
|
void MainWindow::psPlatformNotify(HistoryItem *item, int32 fwdCount) {
|
||||||
QString title = (!App::passcoded() && cNotifyView() <= dbinvShowName) ? item->history()->peer->name : qsl("Telegram Desktop");
|
QString title = (!App::passcoded() && Global::NotifyView() <= dbinvShowName) ? item->history()->peer->name : qsl("Telegram Desktop");
|
||||||
QString subtitle = (!App::passcoded() && cNotifyView() <= dbinvShowName) ? item->notificationHeader() : QString();
|
QString subtitle = (!App::passcoded() && Global::NotifyView() <= dbinvShowName) ? item->notificationHeader() : QString();
|
||||||
bool showpix = (!App::passcoded() && cNotifyView() <= dbinvShowName);
|
bool showpix = (!App::passcoded() && Global::NotifyView() <= dbinvShowName);
|
||||||
QString msg = (!App::passcoded() && cNotifyView() <= dbinvShowPreview) ? (fwdCount < 2 ? item->notificationText() : lng_forward_messages(lt_count, fwdCount)) : lang(lng_notification_preview);
|
QString msg = (!App::passcoded() && Global::NotifyView() <= dbinvShowPreview) ? (fwdCount < 2 ? item->notificationText() : lng_forward_messages(lt_count, fwdCount)) : lang(lng_notification_preview);
|
||||||
|
|
||||||
Toasts::create(item->history()->peer, item->id, showpix, title, subtitle, msg);
|
Toasts::create(item->history()->peer, item->id, showpix, title, subtitle, msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ Widget::Widget(QWidget *parent, PeerData *peer) : Window::SectionWidget(parent)
|
||||||
_fixedBarShadow->setMode(ToggleableShadow::Mode::HiddenFast);
|
_fixedBarShadow->setMode(ToggleableShadow::Mode::HiddenFast);
|
||||||
_fixedBarShadow->raise();
|
_fixedBarShadow->raise();
|
||||||
updateAdaptiveLayout();
|
updateAdaptiveLayout();
|
||||||
|
subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); });
|
||||||
|
|
||||||
_scroll->setOwnedWidget(_inner);
|
_scroll->setOwnedWidget(_inner);
|
||||||
_scroll->move(0, _fixedBar->height());
|
_scroll->move(0, _fixedBar->height());
|
||||||
|
|
|
@ -48,8 +48,6 @@ public:
|
||||||
|
|
||||||
void setInnerFocus() override;
|
void setInnerFocus() override;
|
||||||
|
|
||||||
void updateAdaptiveLayout() override;
|
|
||||||
|
|
||||||
bool showInternal(const Window::SectionMemento *memento) override;
|
bool showInternal(const Window::SectionMemento *memento) override;
|
||||||
std_::unique_ptr<Window::SectionMemento> createMemento() const override;
|
std_::unique_ptr<Window::SectionMemento> createMemento() const override;
|
||||||
|
|
||||||
|
@ -65,6 +63,8 @@ private slots:
|
||||||
void onScroll();
|
void onScroll();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateAdaptiveLayout();
|
||||||
|
|
||||||
friend class SectionMemento;
|
friend class SectionMemento;
|
||||||
|
|
||||||
ChildWidget<ScrollArea> _scroll;
|
ChildWidget<ScrollArea> _scroll;
|
||||||
|
|
|
@ -47,11 +47,6 @@ QString gLangErrors;
|
||||||
|
|
||||||
QString gDialogLastPath, gDialogHelperPath; // optimize QFileDialog
|
QString gDialogLastPath, gDialogHelperPath; // optimize QFileDialog
|
||||||
|
|
||||||
bool gSoundNotify = true;
|
|
||||||
bool gIncludeMuted = true;
|
|
||||||
bool gDesktopNotify = true;
|
|
||||||
DBINotifyView gNotifyView = dbinvShowPreview;
|
|
||||||
bool gWindowsNotifications = true;
|
|
||||||
bool gStartMinimized = false;
|
bool gStartMinimized = false;
|
||||||
bool gStartInTray = false;
|
bool gStartInTray = false;
|
||||||
bool gAutoStart = false;
|
bool gAutoStart = false;
|
||||||
|
@ -61,13 +56,6 @@ TWindowPos gWindowPos;
|
||||||
LaunchMode gLaunchMode = LaunchModeNormal;
|
LaunchMode gLaunchMode = LaunchModeNormal;
|
||||||
bool gSupportTray = true;
|
bool gSupportTray = true;
|
||||||
DBIWorkMode gWorkMode = dbiwmWindowAndTray;
|
DBIWorkMode gWorkMode = dbiwmWindowAndTray;
|
||||||
DBIConnectionType gConnectionType = dbictAuto;
|
|
||||||
ConnectionProxy gConnectionProxy;
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
bool gTryIPv6 = false;
|
|
||||||
#else
|
|
||||||
bool gTryIPv6 = true;
|
|
||||||
#endif
|
|
||||||
bool gSeenTrayTooltip = false;
|
bool gSeenTrayTooltip = false;
|
||||||
bool gRestartingUpdate = false, gRestarting = false, gRestartingToSettings = false, gWriteProtected = false;
|
bool gRestartingUpdate = false, gRestarting = false, gRestartingToSettings = false, gWriteProtected = false;
|
||||||
int32 gLastUpdateCheck = 0;
|
int32 gLastUpdateCheck = 0;
|
||||||
|
@ -75,17 +63,9 @@ bool gNoStartUpdate = false;
|
||||||
bool gStartToSettings = false;
|
bool gStartToSettings = false;
|
||||||
DBIDefaultAttach gDefaultAttach = dbidaDocument;
|
DBIDefaultAttach gDefaultAttach = dbidaDocument;
|
||||||
bool gReplaceEmojis = true;
|
bool gReplaceEmojis = true;
|
||||||
bool gAskDownloadPath = false;
|
|
||||||
QString gDownloadPath;
|
|
||||||
QByteArray gDownloadPathBookmark;
|
|
||||||
|
|
||||||
bool gCtrlEnter = false;
|
bool gCtrlEnter = false;
|
||||||
|
|
||||||
QPixmapPointer gChatBackground = 0;
|
|
||||||
int32 gChatBackgroundId = 0;
|
|
||||||
QPixmapPointer gChatDogImage = 0;
|
|
||||||
bool gTileBackground = false;
|
|
||||||
|
|
||||||
uint32 gConnectionsInSession = 1;
|
uint32 gConnectionsInSession = 1;
|
||||||
QString gLoggedPhoneNumber;
|
QString gLoggedPhoneNumber;
|
||||||
|
|
||||||
|
@ -126,7 +106,6 @@ QString gLangFile;
|
||||||
bool gRetina = false;
|
bool gRetina = false;
|
||||||
float64 gRetinaFactor = 1.;
|
float64 gRetinaFactor = 1.;
|
||||||
int32 gIntRetinaFactor = 1;
|
int32 gIntRetinaFactor = 1;
|
||||||
bool gCustomNotifies = true;
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
DBIPlatform gPlatform = dbipWindows;
|
DBIPlatform gPlatform = dbipWindows;
|
||||||
|
@ -175,7 +154,6 @@ void settingsParseArgs(int argc, char *argv[]) {
|
||||||
case dbipMac:
|
case dbipMac:
|
||||||
gUpdateURL = QUrl(qsl("http://tdesktop.com/mac/tupdates/current"));
|
gUpdateURL = QUrl(qsl("http://tdesktop.com/mac/tupdates/current"));
|
||||||
gPlatformString = qsl("MacOS");
|
gPlatformString = qsl("MacOS");
|
||||||
gCustomNotifies = false;
|
|
||||||
break;
|
break;
|
||||||
case dbipMacOld:
|
case dbipMacOld:
|
||||||
gUpdateURL = QUrl(qsl("http://tdesktop.com/mac32/tupdates/current"));
|
gUpdateURL = QUrl(qsl("http://tdesktop.com/mac32/tupdates/current"));
|
||||||
|
|
|
@ -91,20 +91,8 @@ inline const QString &cDialogHelperPathFinal() {
|
||||||
}
|
}
|
||||||
DeclareSetting(bool, CtrlEnter);
|
DeclareSetting(bool, CtrlEnter);
|
||||||
|
|
||||||
typedef QPixmap *QPixmapPointer;
|
|
||||||
DeclareSetting(QPixmapPointer, ChatBackground);
|
|
||||||
DeclareSetting(int32, ChatBackgroundId);
|
|
||||||
DeclareSetting(QPixmapPointer, ChatDogImage);
|
|
||||||
DeclareSetting(bool, TileBackground);
|
|
||||||
|
|
||||||
DeclareSetting(bool, SoundNotify);
|
|
||||||
DeclareSetting(bool, IncludeMuted);
|
|
||||||
DeclareSetting(bool, DesktopNotify);
|
|
||||||
DeclareSetting(DBINotifyView, NotifyView);
|
|
||||||
DeclareSetting(bool, AutoUpdate);
|
DeclareSetting(bool, AutoUpdate);
|
||||||
|
|
||||||
DeclareSetting(bool, WindowsNotifications);
|
|
||||||
|
|
||||||
struct TWindowPos {
|
struct TWindowPos {
|
||||||
TWindowPos() : moncrc(0), maximized(0), x(0), y(0), w(0), h(0) {
|
TWindowPos() : moncrc(0), maximized(0), x(0), y(0), w(0), h(0) {
|
||||||
}
|
}
|
||||||
|
@ -114,10 +102,7 @@ struct TWindowPos {
|
||||||
DeclareSetting(TWindowPos, WindowPos);
|
DeclareSetting(TWindowPos, WindowPos);
|
||||||
DeclareSetting(bool, SupportTray);
|
DeclareSetting(bool, SupportTray);
|
||||||
DeclareSetting(DBIWorkMode, WorkMode);
|
DeclareSetting(DBIWorkMode, WorkMode);
|
||||||
DeclareSetting(DBIConnectionType, ConnectionType);
|
|
||||||
DeclareSetting(bool, TryIPv6);
|
|
||||||
DeclareSetting(DBIDefaultAttach, DefaultAttach);
|
DeclareSetting(DBIDefaultAttach, DefaultAttach);
|
||||||
DeclareSetting(ConnectionProxy, ConnectionProxy);
|
|
||||||
DeclareSetting(bool, SeenTrayTooltip);
|
DeclareSetting(bool, SeenTrayTooltip);
|
||||||
DeclareSetting(bool, RestartingUpdate);
|
DeclareSetting(bool, RestartingUpdate);
|
||||||
DeclareSetting(bool, Restarting);
|
DeclareSetting(bool, Restarting);
|
||||||
|
@ -128,9 +113,7 @@ DeclareSetting(bool, NoStartUpdate);
|
||||||
DeclareSetting(bool, StartToSettings);
|
DeclareSetting(bool, StartToSettings);
|
||||||
DeclareSetting(bool, ReplaceEmojis);
|
DeclareSetting(bool, ReplaceEmojis);
|
||||||
DeclareReadSetting(bool, ManyInstance);
|
DeclareReadSetting(bool, ManyInstance);
|
||||||
DeclareSetting(bool, AskDownloadPath);
|
|
||||||
DeclareSetting(QString, DownloadPath);
|
|
||||||
DeclareSetting(QByteArray, DownloadPathBookmark);
|
|
||||||
DeclareSetting(QByteArray, LocalSalt);
|
DeclareSetting(QByteArray, LocalSalt);
|
||||||
DeclareSetting(DBIScale, RealScale);
|
DeclareSetting(DBIScale, RealScale);
|
||||||
DeclareSetting(DBIScale, ScreenScale);
|
DeclareSetting(DBIScale, ScreenScale);
|
||||||
|
@ -279,7 +262,6 @@ DeclareSetting(QString, LangErrors);
|
||||||
DeclareSetting(bool, Retina);
|
DeclareSetting(bool, Retina);
|
||||||
DeclareSetting(float64, RetinaFactor);
|
DeclareSetting(float64, RetinaFactor);
|
||||||
DeclareSetting(int32, IntRetinaFactor);
|
DeclareSetting(int32, IntRetinaFactor);
|
||||||
DeclareSetting(bool, CustomNotifies);
|
|
||||||
|
|
||||||
DeclareReadSetting(DBIPlatform, Platform);
|
DeclareReadSetting(DBIPlatform, Platform);
|
||||||
DeclareReadSetting(QString, PlatformString);
|
DeclareReadSetting(QString, PlatformString);
|
||||||
|
|
|
@ -20,6 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
using "basic.style";
|
using "basic.style";
|
||||||
using "basic_types.style";
|
using "basic_types.style";
|
||||||
|
using "dialogs/dialogs.style";
|
||||||
|
|
||||||
settingsMaxWidth: 520px;
|
settingsMaxWidth: 520px;
|
||||||
settingsMaxPadding: 48px;
|
settingsMaxPadding: 48px;
|
||||||
|
@ -82,6 +83,22 @@ settingsSecondaryButton: RoundButton(settingsPrimaryButton) {
|
||||||
textBg: #ffffff;
|
textBg: #ffffff;
|
||||||
textBgOver: #f2f7fa;
|
textBgOver: #f2f7fa;
|
||||||
}
|
}
|
||||||
|
settingsEditButton: RoundButton {
|
||||||
|
width: 24px;
|
||||||
|
height: 34px;
|
||||||
|
icon: settingsEditIcon;
|
||||||
|
|
||||||
|
textTop: 0px;
|
||||||
|
downTextTop: 1px;
|
||||||
|
|
||||||
|
textFg: transparent;
|
||||||
|
textFgOver: transparent;
|
||||||
|
secondaryTextFg: transparent;
|
||||||
|
secondaryTextFgOver: transparent;
|
||||||
|
textBg: transparent;
|
||||||
|
textBgOver: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
settingsBlocksTop: 7px;
|
settingsBlocksTop: 7px;
|
||||||
settingsBlocksBottom: 20px;
|
settingsBlocksBottom: 20px;
|
||||||
|
@ -117,3 +134,5 @@ settingsSliderLabelTop: 17px;
|
||||||
settingsSliderLabelFont: normalFont;
|
settingsSliderLabelFont: normalFont;
|
||||||
settingsSliderLabelFg: #1485c2;
|
settingsSliderLabelFg: #1485c2;
|
||||||
settingsSliderDuration: 200;
|
settingsSliderDuration: 200;
|
||||||
|
|
||||||
|
settingsBackgroundSize: 120px;
|
||||||
|
|
|
@ -32,6 +32,11 @@ namespace Settings {
|
||||||
|
|
||||||
AdvancedWidget::AdvancedWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_advanced_settings)) {
|
AdvancedWidget::AdvancedWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_advanced_settings)) {
|
||||||
createControls();
|
createControls();
|
||||||
|
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||||
|
subscribe(Global::RefConnectionTypeChanged(), [this]() {
|
||||||
|
connectionTypeUpdated();
|
||||||
|
});
|
||||||
|
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvancedWidget::createControls() {
|
void AdvancedWidget::createControls() {
|
||||||
|
@ -43,6 +48,7 @@ void AdvancedWidget::createControls() {
|
||||||
}
|
}
|
||||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||||
addChildRow(_connectionType, marginLarge, lang(lng_connection_type), lang(lng_connection_auto_connecting));
|
addChildRow(_connectionType, marginLarge, lang(lng_connection_type), lang(lng_connection_auto_connecting));
|
||||||
|
connectionTypeUpdated();
|
||||||
connect(_connectionType->link(), SIGNAL(clicked()), this, SLOT(onConnectionType()));
|
connect(_connectionType->link(), SIGNAL(clicked()), this, SLOT(onConnectionType()));
|
||||||
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
|
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
|
||||||
if (self()) {
|
if (self()) {
|
||||||
|
@ -59,6 +65,23 @@ void AdvancedWidget::onManageLocalStorage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||||
|
void AdvancedWidget::connectionTypeUpdated() {
|
||||||
|
QString connection;
|
||||||
|
switch (Global::ConnectionType()) {
|
||||||
|
case dbictAuto: {
|
||||||
|
QString transport = MTP::dctransport();
|
||||||
|
connection = transport.isEmpty() ? lang(lng_connection_auto_connecting) : lng_connection_auto(lt_transport, transport);
|
||||||
|
} break;
|
||||||
|
case dbictHttpProxy:
|
||||||
|
case dbictTcpProxy: {
|
||||||
|
QString transport = MTP::dctransport();
|
||||||
|
connection = transport.isEmpty() ? lang(lng_connection_proxy_connecting) : lng_connection_proxy(lt_transport, transport);
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
_connectionType->link()->setText(connection);
|
||||||
|
resizeToWidth(width());
|
||||||
|
}
|
||||||
|
|
||||||
void AdvancedWidget::onConnectionType() {
|
void AdvancedWidget::onConnectionType() {
|
||||||
Ui::showLayer(new ConnectionBox());
|
Ui::showLayer(new ConnectionBox());
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,9 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createControls();
|
void createControls();
|
||||||
|
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||||
|
void connectionTypeUpdated();
|
||||||
|
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
|
||||||
void supportGot(const MTPhelp_Support &support);
|
void supportGot(const MTPhelp_Support &support);
|
||||||
|
|
||||||
ChildWidget<LinkButton> _manageLocalStorage = { nullptr };
|
ChildWidget<LinkButton> _manageLocalStorage = { nullptr };
|
||||||
|
|
|
@ -23,21 +23,237 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
#include "styles/style_settings.h"
|
#include "styles/style_settings.h"
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
|
#include "mainwidget.h"
|
||||||
|
#include "boxes/backgroundbox.h"
|
||||||
|
#include "ui/widgets/widget_slide_wrap.h"
|
||||||
|
#include "localstorage.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
#include "window/chat_background.h"
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
|
|
||||||
|
BackgroundRow::BackgroundRow(QWidget *parent) : TWidget(parent)
|
||||||
|
, _chooseFromGallery(this, lang(lng_settings_bg_from_gallery))
|
||||||
|
, _chooseFromFile(this, lang(lng_settings_bg_from_file))
|
||||||
|
, _radial(animation(this, &BackgroundRow::step_radial)) {
|
||||||
|
Window::chatBackground()->initIfEmpty();
|
||||||
|
|
||||||
|
updateImage();
|
||||||
|
|
||||||
|
connect(_chooseFromGallery, SIGNAL(clicked()), this, SIGNAL(chooseFromGallery()));
|
||||||
|
connect(_chooseFromFile, SIGNAL(clicked()), this, SIGNAL(chooseFromFile()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BackgroundRow::paintEvent(QPaintEvent *e) {
|
||||||
|
Painter p(this);
|
||||||
|
|
||||||
|
bool radial = false;
|
||||||
|
float64 radialOpacity = 0;
|
||||||
|
if (_radial.animating()) {
|
||||||
|
_radial.step(getms());
|
||||||
|
radial = _radial.animating();
|
||||||
|
radialOpacity = _radial.opacity();
|
||||||
|
}
|
||||||
|
if (radial) {
|
||||||
|
auto backThumb = App::main() ? App::main()->newBackgroundThumb() : ImagePtr();
|
||||||
|
if (backThumb->isNull()) {
|
||||||
|
p.drawPixmap(0, 0, _background);
|
||||||
|
} else {
|
||||||
|
const QPixmap &pix = App::main()->newBackgroundThumb()->pixBlurred(st::setBackgroundSize);
|
||||||
|
p.drawPixmap(0, 0, st::setBackgroundSize, st::setBackgroundSize, pix, 0, (pix.height() - st::setBackgroundSize) / 2, st::setBackgroundSize, st::setBackgroundSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto outer = radialRect();
|
||||||
|
QRect inner(QPoint(outer.x() + (outer.width() - st::radialSize.width()) / 2, outer.y() + (outer.height() - st::radialSize.height()) / 2), st::radialSize);
|
||||||
|
p.setPen(Qt::NoPen);
|
||||||
|
p.setBrush(st::black);
|
||||||
|
p.setOpacity(radialOpacity * st::radialBgOpacity);
|
||||||
|
|
||||||
|
p.setRenderHint(QPainter::HighQualityAntialiasing);
|
||||||
|
p.drawEllipse(inner);
|
||||||
|
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
|
||||||
|
|
||||||
|
p.setOpacity(1);
|
||||||
|
QRect arc(inner.marginsRemoved(QMargins(st::radialLine, st::radialLine, st::radialLine, st::radialLine)));
|
||||||
|
_radial.draw(p, arc, st::radialLine, st::white);
|
||||||
|
} else {
|
||||||
|
p.drawPixmap(0, 0, _background);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int BackgroundRow::resizeGetHeight(int newWidth) {
|
||||||
|
int linkLeft = st::settingsBackgroundSize + st::settingsSmallSkip;
|
||||||
|
int linkWidth = newWidth - linkLeft;
|
||||||
|
_chooseFromGallery->resizeToWidth(qMin(linkWidth, _chooseFromGallery->naturalWidth()));
|
||||||
|
_chooseFromFile->resizeToWidth(qMin(linkWidth, _chooseFromFile->naturalWidth()));
|
||||||
|
|
||||||
|
_chooseFromGallery->moveToLeft(linkLeft, 0);
|
||||||
|
_chooseFromFile->moveToLeft(linkLeft, _chooseFromGallery->height() + st::settingsSmallSkip);
|
||||||
|
|
||||||
|
return st::settingsBackgroundSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
float64 BackgroundRow::radialProgress() const {
|
||||||
|
if (auto m = App::main()) {
|
||||||
|
return m->chatBackgroundProgress();
|
||||||
|
}
|
||||||
|
return 1.;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BackgroundRow::radialLoading() const {
|
||||||
|
if (auto m = App::main()) {
|
||||||
|
if (m->chatBackgroundLoading()) {
|
||||||
|
m->checkChatBackground();
|
||||||
|
if (m->chatBackgroundLoading()) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
const_cast<BackgroundRow*>(this)->updateImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QRect BackgroundRow::radialRect() const {
|
||||||
|
return QRect(0, 0, st::setBackgroundSize, st::setBackgroundSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BackgroundRow::radialStart() {
|
||||||
|
if (radialLoading() && !_radial.animating()) {
|
||||||
|
_radial.start(radialProgress());
|
||||||
|
if (auto shift = radialTimeShift()) {
|
||||||
|
_radial.update(radialProgress(), !radialLoading(), getms() + shift);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64 BackgroundRow::radialTimeShift() const {
|
||||||
|
return st::radialDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BackgroundRow::step_radial(uint64 ms, bool timer) {
|
||||||
|
_radial.update(radialProgress(), !radialLoading(), ms + radialTimeShift());
|
||||||
|
if (timer && _radial.animating()) {
|
||||||
|
rtlupdate(radialRect());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BackgroundRow::updateImage() {
|
||||||
|
int32 size = st::setBackgroundSize * cIntRetinaFactor();
|
||||||
|
QImage back(size, size, QImage::Format_ARGB32_Premultiplied);
|
||||||
|
back.setDevicePixelRatio(cRetinaFactor());
|
||||||
|
{
|
||||||
|
QPainter p(&back);
|
||||||
|
auto &pix = Window::chatBackground()->image();
|
||||||
|
int sx = (pix.width() > pix.height()) ? ((pix.width() - pix.height()) / 2) : 0;
|
||||||
|
int sy = (pix.height() > pix.width()) ? ((pix.height() - pix.width()) / 2) : 0;
|
||||||
|
int s = (pix.width() > pix.height()) ? pix.height() : pix.width();
|
||||||
|
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
|
p.drawPixmap(0, 0, st::setBackgroundSize, st::setBackgroundSize, pix, sx, sy, s, s);
|
||||||
|
}
|
||||||
|
imageRound(back, ImageRoundRadius::Small);
|
||||||
|
_background = App::pixmapFromImageInPlace(std_::move(back));
|
||||||
|
_background.setDevicePixelRatio(cRetinaFactor());
|
||||||
|
|
||||||
|
rtlupdate(radialRect());
|
||||||
|
|
||||||
|
if (radialLoading()) {
|
||||||
|
radialStart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BackgroundWidget::BackgroundWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_background)) {
|
BackgroundWidget::BackgroundWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_background)) {
|
||||||
refreshControls();
|
FileDialog::registerObserver(this, &BackgroundWidget::notifyFileQueryUpdated);
|
||||||
|
createControls();
|
||||||
|
|
||||||
|
subscribe(Window::chatBackground(), [this](const Window::ChatBackgroundUpdate &update) {
|
||||||
|
using Update = Window::ChatBackgroundUpdate;
|
||||||
|
if (update.type == Update::Type::New) {
|
||||||
|
_background->updateImage();
|
||||||
|
} else if (update.type == Update::Type::Start) {
|
||||||
|
needBackgroundUpdate(update.tiled);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
subscribe(Adaptive::Changed(), [this]() {
|
||||||
|
if (Global::AdaptiveLayout() == Adaptive::WideLayout) {
|
||||||
|
_adaptive->slideDown();
|
||||||
|
} else {
|
||||||
|
_adaptive->slideUp();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundWidget::refreshControls() {
|
void BackgroundWidget::createControls() {
|
||||||
|
style::margins margin(0, 0, 0, st::settingsSmallSkip);
|
||||||
|
style::margins slidedPadding(0, margin.bottom() / 2, 0, margin.bottom() - (margin.bottom() / 2));
|
||||||
|
|
||||||
|
addChildRow(_background, margin);
|
||||||
|
connect(_background, SIGNAL(chooseFromGallery()), this, SLOT(onChooseFromGallery()));
|
||||||
|
connect(_background, SIGNAL(chooseFromFile()), this, SLOT(onChooseFromFile()));
|
||||||
|
|
||||||
|
addChildRow(_tile, margin, lang(lng_settings_bg_tile), SLOT(onTile()), Window::chatBackground()->tile());
|
||||||
|
addChildRow(_adaptive, margin, slidedPadding, lang(lng_settings_adaptive_wide), SLOT(onAdaptive()), Global::AdaptiveForWide());
|
||||||
|
if (Global::AdaptiveLayout() != Adaptive::WideLayout) {
|
||||||
|
_adaptive->hideFast();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int BackgroundWidget::resizeGetHeight(int newWidth) {
|
void BackgroundWidget::onChooseFromGallery() {
|
||||||
int newHeight = contentTop();
|
Ui::showLayer(new BackgroundBox());
|
||||||
|
}
|
||||||
|
|
||||||
newHeight += st::settingsBlockMarginBottom;
|
void BackgroundWidget::needBackgroundUpdate(bool tile) {
|
||||||
return newHeight;
|
_tile->setChecked(tile);
|
||||||
|
_background->updateImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BackgroundWidget::onChooseFromFile() {
|
||||||
|
QStringList imgExtensions(cImgExtensions());
|
||||||
|
QString filter(qsl("Image files (*") + imgExtensions.join(qsl(" *")) + qsl(");;") + filedialogAllFilesFilter());
|
||||||
|
|
||||||
|
_chooseFromFileQueryId = FileDialog::queryReadFile(lang(lng_choose_images), filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BackgroundWidget::notifyFileQueryUpdated(const FileDialog::QueryUpdate &update) {
|
||||||
|
if (_chooseFromFileQueryId != update.queryId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_chooseFromFileQueryId = 0;
|
||||||
|
|
||||||
|
if (update.filePaths.isEmpty() && update.remoteContent.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QImage img;
|
||||||
|
if (!update.remoteContent.isEmpty()) {
|
||||||
|
img = App::readImage(update.remoteContent);
|
||||||
|
} else {
|
||||||
|
img = App::readImage(update.filePaths.front());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (img.isNull() || img.width() <= 0 || img.height() <= 0) return;
|
||||||
|
|
||||||
|
if (img.width() > 4096 * img.height()) {
|
||||||
|
img = img.copy((img.width() - 4096 * img.height()) / 2, 0, 4096 * img.height(), img.height());
|
||||||
|
} else if (img.height() > 4096 * img.width()) {
|
||||||
|
img = img.copy(0, (img.height() - 4096 * img.width()) / 2, img.width(), 4096 * img.width());
|
||||||
|
}
|
||||||
|
|
||||||
|
App::initBackground(-1, img);
|
||||||
|
_tile->setChecked(false);
|
||||||
|
_background->updateImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BackgroundWidget::onTile() {
|
||||||
|
Window::chatBackground()->setTile(_tile->checked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void BackgroundWidget::onAdaptive() {
|
||||||
|
if (Global::AdaptiveForWide() != _adaptive->entity()->checked()) {
|
||||||
|
Global::SetAdaptiveForWide(_adaptive->entity()->checked());
|
||||||
|
Adaptive::Changed().notify();
|
||||||
|
Local::writeUserSettings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Settings
|
} // namespace Settings
|
||||||
|
|
|
@ -21,19 +21,72 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "settings/settings_block_widget.h"
|
#include "settings/settings_block_widget.h"
|
||||||
|
#include "ui/filedialog.h"
|
||||||
|
|
||||||
|
class LinkButton;
|
||||||
|
class Checkbox;
|
||||||
|
namespace Ui {
|
||||||
|
template <typename Widget>
|
||||||
|
class WidgetSlideWrap;
|
||||||
|
} // namespace Ui;
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
|
|
||||||
|
class BackgroundRow : public TWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
BackgroundRow(QWidget *parent);
|
||||||
|
|
||||||
|
void updateImage();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
|
int resizeGetHeight(int newWidth) override;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void chooseFromGallery();
|
||||||
|
void chooseFromFile();
|
||||||
|
|
||||||
|
private:
|
||||||
|
float64 radialProgress() const;
|
||||||
|
bool radialLoading() const;
|
||||||
|
QRect radialRect() const;
|
||||||
|
void radialStart();
|
||||||
|
uint64 radialTimeShift() const;
|
||||||
|
void step_radial(uint64 ms, bool timer);
|
||||||
|
|
||||||
|
QPixmap _background;
|
||||||
|
ChildWidget<LinkButton> _chooseFromGallery;
|
||||||
|
ChildWidget<LinkButton> _chooseFromFile;
|
||||||
|
|
||||||
|
RadialAnimation _radial;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class BackgroundWidget : public BlockWidget {
|
class BackgroundWidget : public BlockWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BackgroundWidget(QWidget *parent, UserData *self);
|
BackgroundWidget(QWidget *parent, UserData *self);
|
||||||
|
|
||||||
protected:
|
private slots:
|
||||||
// Resizes content and counts natural widget height for the desired width.
|
void onChooseFromGallery();
|
||||||
int resizeGetHeight(int newWidth) override;
|
void onChooseFromFile();
|
||||||
|
void onTile();
|
||||||
|
void onAdaptive();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void refreshControls();
|
void createControls();
|
||||||
|
void needBackgroundUpdate(bool tile);
|
||||||
|
void notifyFileQueryUpdated(const FileDialog::QueryUpdate &update);
|
||||||
|
|
||||||
|
ChildWidget<BackgroundRow> _background = { nullptr };
|
||||||
|
ChildWidget<Checkbox> _tile = { nullptr };
|
||||||
|
ChildWidget<Ui::WidgetSlideWrap<Checkbox>> _adaptive = { nullptr };
|
||||||
|
|
||||||
|
FileDialog::QueryId _chooseFromFileQueryId = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ void BlockWidget::createChildRow(ChildWidget<Radiobutton> &child, style::margins
|
||||||
|
|
||||||
void BlockWidget::createChildRow(ChildWidget<LinkButton> &child, style::margins &margin, const QString &text, const char *slot) {
|
void BlockWidget::createChildRow(ChildWidget<LinkButton> &child, style::margins &margin, const QString &text, const char *slot) {
|
||||||
child = new LinkButton(this, text);
|
child = new LinkButton(this, text);
|
||||||
connect(child, SIGNAL(changed()), this, slot);
|
connect(child, SIGNAL(clicked()), this, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Settings
|
} // namespace Settings
|
||||||
|
|
|
@ -32,7 +32,7 @@ class WidgetSlideWrap;
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
|
|
||||||
class BlockWidget : public ScrolledWidget, public Notify::Observer, public base::Subscriber {
|
class BlockWidget : public ScrolledWidget, public Notify::Observer, protected base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -36,8 +36,23 @@ namespace Settings {
|
||||||
|
|
||||||
ChatSettingsWidget::ChatSettingsWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_chat_settings)) {
|
ChatSettingsWidget::ChatSettingsWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_chat_settings)) {
|
||||||
createControls();
|
createControls();
|
||||||
|
|
||||||
|
subscribe(Global::RefDownloadPathChanged(), [this]() {
|
||||||
|
_downloadPath->entity()->link()->setText(downloadPathText());
|
||||||
|
resizeToWidth(width());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ChatSettingsWidget::downloadPathText() const {
|
||||||
|
if (Global::DownloadPath().isEmpty()) {
|
||||||
|
return lang(lng_download_path_default);
|
||||||
|
} else if (Global::DownloadPath() == qsl("tmp")) {
|
||||||
|
return lang(lng_download_path_temp);
|
||||||
|
}
|
||||||
|
return QDir::toNativeSeparators(Global::DownloadPath());
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void ChatSettingsWidget::createControls() {
|
void ChatSettingsWidget::createControls() {
|
||||||
style::margins marginSmall(0, 0, 0, st::settingsSmallSkip);
|
style::margins marginSmall(0, 0, 0, st::settingsSmallSkip);
|
||||||
style::margins marginSkip(0, 0, 0, st::settingsSkip);
|
style::margins marginSkip(0, 0, 0, st::settingsSkip);
|
||||||
|
@ -48,18 +63,13 @@ void ChatSettingsWidget::createControls() {
|
||||||
style::margins marginList(st::defaultCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
style::margins marginList(st::defaultCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
||||||
addChildRow(_viewList, marginList, slidedPadding, lang(lng_settings_view_emojis), SLOT(onViewList()));
|
addChildRow(_viewList, marginList, slidedPadding, lang(lng_settings_view_emojis), SLOT(onViewList()));
|
||||||
|
|
||||||
addChildRow(_dontAskDownloadPath, marginSub, lang(lng_download_path_dont_ask), SLOT(onDontAskDownloadPath()), !cAskDownloadPath());
|
addChildRow(_dontAskDownloadPath, marginSub, lang(lng_download_path_dont_ask), SLOT(onDontAskDownloadPath()), !Global::AskDownloadPath());
|
||||||
auto downloadPathText = []() -> QString {
|
|
||||||
if (cDownloadPath().isEmpty()) {
|
|
||||||
return lang(lng_download_path_default);
|
|
||||||
} else if (cDownloadPath() == qsl("tmp")) {
|
|
||||||
return lang(lng_download_path_temp);
|
|
||||||
}
|
|
||||||
return QDir::toNativeSeparators(cDownloadPath());
|
|
||||||
};
|
|
||||||
style::margins marginPath(st::defaultCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
style::margins marginPath(st::defaultCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
||||||
addChildRow(_downloadPath, marginPath, slidedPadding, lang(lng_download_path_label), downloadPathText());
|
addChildRow(_downloadPath, marginPath, slidedPadding, lang(lng_download_path_label), downloadPathText());
|
||||||
connect(_downloadPath->entity()->link(), SIGNAL(clicked()), this, SLOT(onDownloadPath()));
|
connect(_downloadPath->entity()->link(), SIGNAL(clicked()), this, SLOT(onDownloadPath()));
|
||||||
|
if (Global::AskDownloadPath()) {
|
||||||
|
_downloadPath->hideFast();
|
||||||
|
}
|
||||||
|
|
||||||
addChildRow(_sendByEnter, marginSmall, qsl("send_key"), 0, lang(lng_settings_send_enter), SLOT(onSendByEnter()), !cCtrlEnter());
|
addChildRow(_sendByEnter, marginSmall, qsl("send_key"), 0, lang(lng_settings_send_enter), SLOT(onSendByEnter()), !cCtrlEnter());
|
||||||
addChildRow(_sendByCtrlEnter, marginSkip, qsl("send_key"), 1, lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), SLOT(onSendByCtrlEnter()), cCtrlEnter());
|
addChildRow(_sendByCtrlEnter, marginSkip, qsl("send_key"), 1, lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), SLOT(onSendByCtrlEnter()), cCtrlEnter());
|
||||||
|
@ -104,7 +114,7 @@ void ChatSettingsWidget::onViewList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatSettingsWidget::onDontAskDownloadPath() {
|
void ChatSettingsWidget::onDontAskDownloadPath() {
|
||||||
cSetAskDownloadPath(!_dontAskDownloadPath->checked());
|
Global::SetAskDownloadPath(!_dontAskDownloadPath->checked());
|
||||||
Local::writeUserSettings();
|
Local::writeUserSettings();
|
||||||
if (_dontAskDownloadPath->checked()) {
|
if (_dontAskDownloadPath->checked()) {
|
||||||
_downloadPath->slideDown();
|
_downloadPath->slideDown();
|
||||||
|
|
|
@ -65,6 +65,7 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createControls();
|
void createControls();
|
||||||
|
QString downloadPathText() const;
|
||||||
|
|
||||||
ChildWidget<Checkbox> _replaceEmoji = { nullptr };
|
ChildWidget<Checkbox> _replaceEmoji = { nullptr };
|
||||||
ChildWidget<Ui::WidgetSlideWrap<LinkButton>> _viewList = { nullptr };
|
ChildWidget<Ui::WidgetSlideWrap<LinkButton>> _viewList = { nullptr };
|
||||||
|
|
|
@ -42,6 +42,7 @@ CoverWidget::CoverWidget(QWidget *parent, UserData *self) : BlockWidget(parent,
|
||||||
, _self(App::self())
|
, _self(App::self())
|
||||||
, _userpicButton(this, _self)
|
, _userpicButton(this, _self)
|
||||||
, _name(this, st::settingsNameLabel)
|
, _name(this, st::settingsNameLabel)
|
||||||
|
, _editNameInline(this, QString(), st::settingsEditButton)
|
||||||
, _setPhoto(this, lang(lng_settings_upload), st::settingsPrimaryButton)
|
, _setPhoto(this, lang(lng_settings_upload), st::settingsPrimaryButton)
|
||||||
, _editName(this, lang(lng_settings_edit), st::settingsSecondaryButton) {
|
, _editName(this, lang(lng_settings_edit), st::settingsSecondaryButton) {
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
@ -53,6 +54,7 @@ CoverWidget::CoverWidget(QWidget *parent, UserData *self) : BlockWidget(parent,
|
||||||
connect(_setPhoto, SIGNAL(clicked()), this, SLOT(onSetPhoto()));
|
connect(_setPhoto, SIGNAL(clicked()), this, SLOT(onSetPhoto()));
|
||||||
_editName->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
|
_editName->setTextTransform(Ui::RoundButton::TextTransform::ToUpper);
|
||||||
connect(_editName, SIGNAL(clicked()), this, SLOT(onEditName()));
|
connect(_editName, SIGNAL(clicked()), this, SLOT(onEditName()));
|
||||||
|
connect(_editNameInline, SIGNAL(clicked()), this, SLOT(onEditName()));
|
||||||
|
|
||||||
auto observeEvents = Notify::PeerUpdate::Flag::NameChanged;
|
auto observeEvents = Notify::PeerUpdate::Flag::NameChanged;
|
||||||
Notify::registerPeerObserver(observeEvents, this, &CoverWidget::notifyPeerUpdated);
|
Notify::registerPeerObserver(observeEvents, this, &CoverWidget::notifyPeerUpdated);
|
||||||
|
@ -97,8 +99,6 @@ int CoverWidget::resizeGetHeight(int newWidth) {
|
||||||
|
|
||||||
_userpicButton->moveToLeft(contentLeft() + st::settingsPhotoLeft, newHeight);
|
_userpicButton->moveToLeft(contentLeft() + st::settingsPhotoLeft, newHeight);
|
||||||
|
|
||||||
refreshNameGeometry(newWidth);
|
|
||||||
|
|
||||||
int infoLeft = _userpicButton->x() + _userpicButton->width();
|
int infoLeft = _userpicButton->x() + _userpicButton->width();
|
||||||
_statusPosition = QPoint(infoLeft + st::settingsStatusLeft, _userpicButton->y() + st::settingsStatusTop);
|
_statusPosition = QPoint(infoLeft + st::settingsStatusLeft, _userpicButton->y() + st::settingsStatusTop);
|
||||||
if (_cancelPhotoUpload) {
|
if (_cancelPhotoUpload) {
|
||||||
|
@ -109,12 +109,11 @@ int CoverWidget::resizeGetHeight(int newWidth) {
|
||||||
int buttonsRight = newWidth - st::settingsButtonSkip;
|
int buttonsRight = newWidth - st::settingsButtonSkip;
|
||||||
_setPhoto->moveToLeft(buttonLeft, _userpicButton->y() + st::settingsButtonTop);
|
_setPhoto->moveToLeft(buttonLeft, _userpicButton->y() + st::settingsButtonTop);
|
||||||
buttonLeft += _setPhoto->width() + st::settingsButtonSkip;
|
buttonLeft += _setPhoto->width() + st::settingsButtonSkip;
|
||||||
_editName->moveToLeft(buttonLeft, _setPhoto->y()); // TODO
|
_editName->moveToLeft(buttonLeft, _setPhoto->y());
|
||||||
if (buttonLeft + _editName->width() + st::settingsButtonSkip > newWidth) {
|
_editNameVisible = (buttonLeft + _editName->width() + st::settingsButtonSkip <= newWidth);
|
||||||
_editName->hide();
|
_editName->setVisible(_editNameVisible);
|
||||||
} else {
|
|
||||||
_editName->show();
|
refreshNameGeometry(newWidth);
|
||||||
}
|
|
||||||
|
|
||||||
newHeight += st::settingsPhotoSize;
|
newHeight += st::settingsPhotoSize;
|
||||||
newHeight += st::settingsMarginBottom;
|
newHeight += st::settingsMarginBottom;
|
||||||
|
@ -133,9 +132,17 @@ void CoverWidget::refreshNameGeometry(int newWidth) {
|
||||||
int nameLeft = infoLeft + st::settingsNameLeft - st::settingsNameLabel.margin.left();
|
int nameLeft = infoLeft + st::settingsNameLeft - st::settingsNameLabel.margin.left();
|
||||||
int nameTop = _userpicButton->y() + st::settingsNameTop - st::settingsNameLabel.margin.top();
|
int nameTop = _userpicButton->y() + st::settingsNameTop - st::settingsNameLabel.margin.top();
|
||||||
int nameWidth = newWidth - infoLeft - st::settingsNameLeft;
|
int nameWidth = newWidth - infoLeft - st::settingsNameLeft;
|
||||||
|
auto editNameInlineVisible = !_editNameVisible;
|
||||||
|
if (editNameInlineVisible) {
|
||||||
|
nameWidth -= _editNameInline->width();
|
||||||
|
}
|
||||||
int marginsAdd = st::settingsNameLabel.margin.left() + st::settingsNameLabel.margin.right();
|
int marginsAdd = st::settingsNameLabel.margin.left() + st::settingsNameLabel.margin.right();
|
||||||
|
|
||||||
_name->resizeToWidth(qMin(nameWidth - marginsAdd, _name->naturalWidth()) + marginsAdd);
|
_name->resizeToWidth(qMin(nameWidth - marginsAdd, _name->naturalWidth()) + marginsAdd);
|
||||||
_name->moveToLeft(nameLeft, nameTop);
|
_name->moveToLeft(nameLeft, nameTop);
|
||||||
|
|
||||||
|
_editNameInline->moveToLeft(nameLeft + _name->width(), nameTop);
|
||||||
|
_editNameInline->setVisible(editNameInlineVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoverWidget::showFinished() {
|
void CoverWidget::showFinished() {
|
||||||
|
|
|
@ -93,6 +93,7 @@ private:
|
||||||
ChildWidget<Profile::CoverDropArea> _dropArea = { nullptr };
|
ChildWidget<Profile::CoverDropArea> _dropArea = { nullptr };
|
||||||
|
|
||||||
ChildWidget<FlatLabel> _name;
|
ChildWidget<FlatLabel> _name;
|
||||||
|
ChildWidget<Ui::RoundButton> _editNameInline;
|
||||||
ChildWidget<LinkButton> _cancelPhotoUpload = { nullptr };
|
ChildWidget<LinkButton> _cancelPhotoUpload = { nullptr };
|
||||||
|
|
||||||
QPoint _statusPosition;
|
QPoint _statusPosition;
|
||||||
|
@ -101,6 +102,7 @@ private:
|
||||||
|
|
||||||
ChildWidget<Ui::RoundButton> _setPhoto;
|
ChildWidget<Ui::RoundButton> _setPhoto;
|
||||||
ChildWidget<Ui::RoundButton> _editName;
|
ChildWidget<Ui::RoundButton> _editName;
|
||||||
|
bool _editNameVisible = true;
|
||||||
|
|
||||||
int _dividerTop = 0;
|
int _dividerTop = 0;
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ QString currentVersion() {
|
||||||
|
|
||||||
GeneralWidget::GeneralWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_general))
|
GeneralWidget::GeneralWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_general))
|
||||||
, _changeLanguage(this, lang(lng_settings_change_lang)) {
|
, _changeLanguage(this, lang(lng_settings_change_lang)) {
|
||||||
|
connect(_changeLanguage, SIGNAL(clicked()), this, SLOT(onChangeLanguage()));
|
||||||
refreshControls();
|
refreshControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,9 +74,9 @@ void GeneralWidget::refreshControls() {
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
|
||||||
if (cPlatform() == dbipWindows || cSupportTray()) {
|
if (cPlatform() == dbipWindows || cSupportTray()) {
|
||||||
addChildRow(_enableTrayIcon, marginSmall, lang(lng_settings_workmode_tray), SLOT(onWorkmodeChange()), (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray));
|
addChildRow(_enableTrayIcon, marginSmall, lang(lng_settings_workmode_tray), SLOT(onEnableTrayIcon()), (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray));
|
||||||
if (cPlatform() == dbipWindows) {
|
if (cPlatform() == dbipWindows) {
|
||||||
addChildRow(_enableTaskbarIcon, marginLarge, lang(lng_settings_workmode_window), SLOT(onWorkmodeChange()), (cWorkMode() == dbiwmWindowOnly || cWorkMode() == dbiwmWindowAndTray));
|
addChildRow(_enableTaskbarIcon, marginLarge, lang(lng_settings_workmode_window), SLOT(onEnableTaskbarIcon()), (cWorkMode() == dbiwmWindowOnly || cWorkMode() == dbiwmWindowAndTray));
|
||||||
|
|
||||||
addChildRow(_autoStart, marginSmall, lang(lng_settings_auto_start), SLOT(onAutoStart()), cAutoStart());
|
addChildRow(_autoStart, marginSmall, lang(lng_settings_auto_start), SLOT(onAutoStart()), cAutoStart());
|
||||||
addChildRow(_startMinimized, marginLarge, slidedPadding, lang(lng_settings_start_min), SLOT(onStartMinimized()), cStartMinimized());
|
addChildRow(_startMinimized, marginLarge, slidedPadding, lang(lng_settings_start_min), SLOT(onStartMinimized()), cStartMinimized());
|
||||||
|
|
|
@ -37,18 +37,34 @@ namespace Settings {
|
||||||
|
|
||||||
InnerWidget::InnerWidget(QWidget *parent) : TWidget(parent)
|
InnerWidget::InnerWidget(QWidget *parent) : TWidget(parent)
|
||||||
, _self(App::self()) {
|
, _self(App::self()) {
|
||||||
if (_self) {
|
|
||||||
_cover = new CoverWidget(this, _self);
|
|
||||||
}
|
|
||||||
refreshBlocks();
|
refreshBlocks();
|
||||||
|
subscribe(Global::RefSelfChanged(), [this]() { selfUpdated(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
void InnerWidget::selfUpdated() {
|
||||||
|
_self = App::self();
|
||||||
|
refreshBlocks();
|
||||||
|
|
||||||
|
if (_cover) {
|
||||||
|
_cover->setContentLeft(_contentLeft);
|
||||||
|
_cover->resizeToWidth(width());
|
||||||
|
}
|
||||||
|
for_const (auto block, _blocks) {
|
||||||
|
block->setContentLeft(_contentLeft);
|
||||||
|
block->resizeToWidth(width());
|
||||||
|
}
|
||||||
|
onBlockHeightUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerWidget::refreshBlocks() {
|
void InnerWidget::refreshBlocks() {
|
||||||
|
_cover.destroyDelayed();
|
||||||
for_const (auto block, _blocks) {
|
for_const (auto block, _blocks) {
|
||||||
block->deleteLater();
|
block->deleteLater();
|
||||||
}
|
}
|
||||||
_blocks.clear();
|
_blocks.clear();
|
||||||
|
|
||||||
if (_self) {
|
if (_self) {
|
||||||
|
_cover = new CoverWidget(this, _self);
|
||||||
_blocks.push_back(new Settings::InfoWidget(this, _self));
|
_blocks.push_back(new Settings::InfoWidget(this, _self));
|
||||||
_blocks.push_back(new Settings::NotificationsWidget(this, _self));
|
_blocks.push_back(new Settings::NotificationsWidget(this, _self));
|
||||||
}
|
}
|
||||||
|
@ -60,7 +76,12 @@ void InnerWidget::refreshBlocks() {
|
||||||
_blocks.push_back(new Settings::PrivacyWidget(this, _self));
|
_blocks.push_back(new Settings::PrivacyWidget(this, _self));
|
||||||
}
|
}
|
||||||
_blocks.push_back(new Settings::AdvancedWidget(this, _self));
|
_blocks.push_back(new Settings::AdvancedWidget(this, _self));
|
||||||
|
|
||||||
|
if (_cover) {
|
||||||
|
_cover->show();
|
||||||
|
}
|
||||||
for_const (auto block, _blocks) {
|
for_const (auto block, _blocks) {
|
||||||
|
block->show();
|
||||||
connect(block, SIGNAL(heightUpdated()), this, SLOT(onBlockHeightUpdated()));
|
connect(block, SIGNAL(heightUpdated()), this, SLOT(onBlockHeightUpdated()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,6 +123,7 @@ void InnerWidget::onBlockHeightUpdated() {
|
||||||
int newHeight = refreshBlocksPositions();
|
int newHeight = refreshBlocksPositions();
|
||||||
if (newHeight != height()) {
|
if (newHeight != height()) {
|
||||||
resize(width(), newHeight);
|
resize(width(), newHeight);
|
||||||
|
emit heightUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Settings {
|
||||||
class CoverWidget;
|
class CoverWidget;
|
||||||
class BlockWidget;
|
class BlockWidget;
|
||||||
|
|
||||||
class InnerWidget : public TWidget {
|
class InnerWidget : public TWidget, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -42,6 +42,9 @@ public:
|
||||||
|
|
||||||
void showFinished();
|
void showFinished();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void heightUpdated();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onBlockHeightUpdated();
|
void onBlockHeightUpdated();
|
||||||
|
|
||||||
|
@ -50,6 +53,7 @@ protected:
|
||||||
int resizeGetHeight(int newWidth) override;
|
int resizeGetHeight(int newWidth) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void selfUpdated();
|
||||||
void refreshBlocks();
|
void refreshBlocks();
|
||||||
|
|
||||||
// Returns the new height value.
|
// Returns the new height value.
|
||||||
|
|
|
@ -32,14 +32,24 @@ namespace Settings {
|
||||||
|
|
||||||
NotificationsWidget::NotificationsWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_notify)) {
|
NotificationsWidget::NotificationsWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_notify)) {
|
||||||
createControls();
|
createControls();
|
||||||
|
|
||||||
|
subscribe(Global::RefNotifySettingsChanged(), [this](const Notify::ChangeType &type) {
|
||||||
|
if (type == Notify::ChangeType::DesktopEnabled) {
|
||||||
|
desktopEnabledUpdated();
|
||||||
|
} else if (type == Notify::ChangeType::ViewParams) {
|
||||||
|
viewParamUpdated();
|
||||||
|
} else if (type == Notify::ChangeType::SoundEnabled) {
|
||||||
|
_playSound->setChecked(Global::SoundNotify());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsWidget::createControls() {
|
void NotificationsWidget::createControls() {
|
||||||
style::margins margin(0, 0, 0, st::settingsSmallSkip);
|
style::margins margin(0, 0, 0, st::settingsSmallSkip);
|
||||||
style::margins slidedPadding(0, margin.bottom() / 2, 0, margin.bottom() - (margin.bottom() / 2));
|
style::margins slidedPadding(0, margin.bottom() / 2, 0, margin.bottom() - (margin.bottom() / 2));
|
||||||
addChildRow(_desktopNotifications, margin, lang(lng_settings_desktop_notify), SLOT(onDesktopNotifications()), cDesktopNotify());
|
addChildRow(_desktopNotifications, margin, lang(lng_settings_desktop_notify), SLOT(onDesktopNotifications()), Global::DesktopNotify());
|
||||||
addChildRow(_showSenderName, margin, slidedPadding, lang(lng_settings_show_name), SLOT(onShowSenderName()), cNotifyView() <= dbinvShowName);
|
addChildRow(_showSenderName, margin, slidedPadding, lang(lng_settings_show_name), SLOT(onShowSenderName()), Global::NotifyView() <= dbinvShowName);
|
||||||
addChildRow(_showMessagePreview, margin, slidedPadding, lang(lng_settings_show_preview), SLOT(onShowMessagePreview()), cNotifyView() <= dbinvShowPreview);
|
addChildRow(_showMessagePreview, margin, slidedPadding, lang(lng_settings_show_preview), SLOT(onShowMessagePreview()), Global::NotifyView() <= dbinvShowPreview);
|
||||||
if (!_showSenderName->entity()->checked()) {
|
if (!_showSenderName->entity()->checked()) {
|
||||||
_showMessagePreview->hideFast();
|
_showMessagePreview->hideFast();
|
||||||
}
|
}
|
||||||
|
@ -49,79 +59,105 @@ void NotificationsWidget::createControls() {
|
||||||
}
|
}
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if (App::wnd()->psHasNativeNotifications()) {
|
if (App::wnd()->psHasNativeNotifications()) {
|
||||||
addChildRow(_windowsNative, margin, lang(lng_settings_use_windows), SLOT(onWindowsNative()), cWindowsNotifications());
|
addChildRow(_windowsNative, margin, lang(lng_settings_use_windows), SLOT(onWindowsNative()), Global::WindowsNotifications());
|
||||||
}
|
}
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
addChildRow(_playSound, margin, lang(lng_settings_sound_notify), SLOT(onPlaySound()), cSoundNotify());
|
addChildRow(_playSound, margin, lang(lng_settings_sound_notify), SLOT(onPlaySound()), Global::SoundNotify());
|
||||||
addChildRow(_includeMuted, margin, lang(lng_settings_include_muted), SLOT(onIncludeMuted()), cIncludeMuted());
|
addChildRow(_includeMuted, margin, lang(lng_settings_include_muted), SLOT(onIncludeMuted()), Global::IncludeMuted());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsWidget::onDesktopNotifications() {
|
void NotificationsWidget::onDesktopNotifications() {
|
||||||
cSetDesktopNotify(_desktopNotifications->checked());
|
if (Global::DesktopNotify() == _desktopNotifications->checked()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Global::SetDesktopNotify(_desktopNotifications->checked());
|
||||||
Local::writeUserSettings();
|
Local::writeUserSettings();
|
||||||
if (App::wnd()) App::wnd()->updateTrayMenu();
|
Global::RefNotifySettingsChanged().notify(Notify::ChangeType::DesktopEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
if (_desktopNotifications->checked()) {
|
void NotificationsWidget::desktopEnabledUpdated() {
|
||||||
|
_desktopNotifications->setChecked(Global::DesktopNotify());
|
||||||
|
if (Global::DesktopNotify()) {
|
||||||
_showSenderName->slideDown();
|
_showSenderName->slideDown();
|
||||||
if (_showSenderName->entity()->checked()) {
|
if (_showSenderName->entity()->checked()) {
|
||||||
_showMessagePreview->slideDown();
|
_showMessagePreview->slideDown();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
App::wnd()->notifyClear();
|
|
||||||
_showSenderName->slideUp();
|
_showSenderName->slideUp();
|
||||||
_showMessagePreview->slideUp();
|
_showMessagePreview->slideUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsWidget::onShowSenderName() {
|
void NotificationsWidget::onShowSenderName() {
|
||||||
|
auto viewParam = ([this]() {
|
||||||
|
if (!_showSenderName->entity()->checked()) {
|
||||||
|
return dbinvShowNothing;
|
||||||
|
} else if (!_showMessagePreview->entity()->checked()) {
|
||||||
|
return dbinvShowName;
|
||||||
|
}
|
||||||
|
return dbinvShowPreview;
|
||||||
|
})();
|
||||||
|
if (viewParam == Global::NotifyView()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Global::SetNotifyView(viewParam);
|
||||||
|
Local::writeUserSettings();
|
||||||
|
Global::RefNotifySettingsChanged().notify(Notify::ChangeType::ViewParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotificationsWidget::onShowMessagePreview() {
|
||||||
|
auto viewParam = ([this]() {
|
||||||
|
if (_showMessagePreview->entity()->checked()) {
|
||||||
|
return dbinvShowPreview;
|
||||||
|
} else if (_showSenderName->entity()->checked()) {
|
||||||
|
return dbinvShowName;
|
||||||
|
}
|
||||||
|
return dbinvShowNothing;
|
||||||
|
})();
|
||||||
|
if (viewParam == Global::NotifyView()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Global::SetNotifyView(viewParam);
|
||||||
|
Local::writeUserSettings();
|
||||||
|
Global::RefNotifySettingsChanged().notify(Notify::ChangeType::ViewParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotificationsWidget::viewParamUpdated() {
|
||||||
if (_showSenderName->entity()->checked()) {
|
if (_showSenderName->entity()->checked()) {
|
||||||
_showMessagePreview->slideDown();
|
_showMessagePreview->slideDown();
|
||||||
} else {
|
} else {
|
||||||
_showMessagePreview->slideUp();
|
_showMessagePreview->slideUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_showSenderName->entity()->checked()) {
|
|
||||||
cSetNotifyView(dbinvShowNothing);
|
|
||||||
} else if (!_showMessagePreview->entity()->checked()) {
|
|
||||||
cSetNotifyView(dbinvShowName);
|
|
||||||
} else {
|
|
||||||
cSetNotifyView(dbinvShowPreview);
|
|
||||||
}
|
|
||||||
Local::writeUserSettings();
|
|
||||||
App::wnd()->notifyUpdateAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsWidget::onShowMessagePreview() {
|
|
||||||
if (_showMessagePreview->entity()->checked()) {
|
|
||||||
cSetNotifyView(dbinvShowPreview);
|
|
||||||
} else if (_showSenderName->entity()->checked()) {
|
|
||||||
cSetNotifyView(dbinvShowName);
|
|
||||||
} else {
|
|
||||||
cSetNotifyView(dbinvShowNothing);
|
|
||||||
}
|
|
||||||
Local::writeUserSettings();
|
|
||||||
App::wnd()->notifyUpdateAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
void NotificationsWidget::onWindowsNative() {
|
void NotificationsWidget::onWindowsNative() {
|
||||||
if (cPlatform() != dbipWindows) return;
|
#ifdef Q_OS_WIN
|
||||||
cSetWindowsNotifications(!cWindowsNotifications());
|
if (Global::WindowsNotifications() == _windowsNative->checked()) {
|
||||||
App::wnd()->notifyClearFast();
|
return;
|
||||||
cSetCustomNotifies(!cWindowsNotifications());
|
}
|
||||||
|
|
||||||
|
Global::SetWindowsNotifications(_windowsNative->checked());
|
||||||
|
Global::SetCustomNotifies(!Global::WindowsNotifications());
|
||||||
Local::writeUserSettings();
|
Local::writeUserSettings();
|
||||||
}
|
Global::RefNotifySettingsChanged().notify(Notify::ChangeType::UseNative);
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
|
}
|
||||||
|
|
||||||
void NotificationsWidget::onPlaySound() {
|
void NotificationsWidget::onPlaySound() {
|
||||||
cSetSoundNotify(_playSound->checked());
|
if (_playSound->checked() == Global::SoundNotify()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Global::SetSoundNotify(_playSound->checked());
|
||||||
Local::writeUserSettings();
|
Local::writeUserSettings();
|
||||||
|
Global::RefNotifySettingsChanged().notify(Notify::ChangeType::SoundEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsWidget::onIncludeMuted() {
|
void NotificationsWidget::onIncludeMuted() {
|
||||||
cSetIncludeMuted(_includeMuted->checked());
|
Global::SetIncludeMuted(_includeMuted->checked());
|
||||||
Notify::unreadCounterUpdated();
|
|
||||||
Local::writeUserSettings();
|
Local::writeUserSettings();
|
||||||
|
Global::RefNotifySettingsChanged().notify(Notify::ChangeType::IncludeMuted);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Settings
|
} // namespace Settings
|
||||||
|
|
|
@ -34,14 +34,14 @@ private slots:
|
||||||
void onDesktopNotifications();
|
void onDesktopNotifications();
|
||||||
void onShowSenderName();
|
void onShowSenderName();
|
||||||
void onShowMessagePreview();
|
void onShowMessagePreview();
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
void onWindowsNative();
|
void onWindowsNative();
|
||||||
#endif // Q_OS_WIN
|
|
||||||
void onPlaySound();
|
void onPlaySound();
|
||||||
void onIncludeMuted();
|
void onIncludeMuted();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createControls();
|
void createControls();
|
||||||
|
void desktopEnabledUpdated();
|
||||||
|
void viewParamUpdated();
|
||||||
|
|
||||||
ChildWidget<Checkbox> _desktopNotifications = { nullptr };
|
ChildWidget<Checkbox> _desktopNotifications = { nullptr };
|
||||||
ChildWidget<Ui::WidgetSlideWrap<Checkbox>> _showSenderName = { nullptr };
|
ChildWidget<Ui::WidgetSlideWrap<Checkbox>> _showSenderName = { nullptr };
|
||||||
|
|
|
@ -42,6 +42,8 @@ Widget::Widget() : LayerWidget()
|
||||||
_fixedBarShadow1->move(0, _fixedBar->y() + st::settingsFixedBarHeight);
|
_fixedBarShadow1->move(0, _fixedBar->y() + st::settingsFixedBarHeight);
|
||||||
_fixedBarShadow2->move(0, _fixedBarShadow1->y() + st::lineWidth);
|
_fixedBarShadow2->move(0, _fixedBarShadow1->y() + st::lineWidth);
|
||||||
_scroll->move(0, st::settingsFixedBarHeight);
|
_scroll->move(0, st::settingsFixedBarHeight);
|
||||||
|
|
||||||
|
connect(_inner, SIGNAL(heightUpdated()), this, SLOT(onInnerHeightUpdated()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::parentResized() {
|
void Widget::parentResized() {
|
||||||
|
@ -70,6 +72,17 @@ void Widget::parentResized() {
|
||||||
// resize it here, not in the resizeEvent() handler.
|
// resize it here, not in the resizeEvent() handler.
|
||||||
_inner->resizeToWidth(newWidth, newContentLeft);
|
_inner->resizeToWidth(newWidth, newContentLeft);
|
||||||
|
|
||||||
|
resizeUsingInnerHeight(newWidth, newContentLeft);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Widget::onInnerHeightUpdated() {
|
||||||
|
resizeUsingInnerHeight(width(), _contentLeft);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Widget::resizeUsingInnerHeight(int newWidth, int newContentLeft) {
|
||||||
|
if (!App::wnd()) return;
|
||||||
|
|
||||||
|
int windowWidth = App::wnd()->width();
|
||||||
int windowHeight = App::wnd()->height();
|
int windowHeight = App::wnd()->height();
|
||||||
int maxHeight = st::settingsFixedBarHeight + _inner->height();
|
int maxHeight = st::settingsFixedBarHeight + _inner->height();
|
||||||
int newHeight = maxHeight;
|
int newHeight = maxHeight;
|
||||||
|
|
|
@ -28,6 +28,8 @@ class InnerWidget;
|
||||||
class FixedBar;
|
class FixedBar;
|
||||||
|
|
||||||
class Widget : public LayerWidget {
|
class Widget : public LayerWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Widget();
|
Widget();
|
||||||
|
|
||||||
|
@ -38,7 +40,12 @@ protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onInnerHeightUpdated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void resizeUsingInnerHeight(int newWidth, int newContentLeft);
|
||||||
|
|
||||||
ChildWidget<ScrollArea> _scroll;
|
ChildWidget<ScrollArea> _scroll;
|
||||||
ChildWidget<InnerWidget> _inner;
|
ChildWidget<InnerWidget> _inner;
|
||||||
ChildWidget<FixedBar> _fixedBar;
|
ChildWidget<FixedBar> _fixedBar;
|
||||||
|
|
|
@ -127,12 +127,12 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent)
|
||||||
, _chooseUsername(this, (self() && !self()->username.isEmpty()) ? ('@' + self()->username) : lang(lng_settings_choose_username))
|
, _chooseUsername(this, (self() && !self()->username.isEmpty()) ? ('@' + self()->username) : lang(lng_settings_choose_username))
|
||||||
|
|
||||||
// notifications
|
// notifications
|
||||||
, _desktopNotify(this, lang(lng_settings_desktop_notify), cDesktopNotify())
|
, _desktopNotify(this, lang(lng_settings_desktop_notify), Global::DesktopNotify())
|
||||||
, _senderName(this, lang(lng_settings_show_name), cNotifyView() <= dbinvShowName)
|
, _senderName(this, lang(lng_settings_show_name), Global::NotifyView() <= dbinvShowName)
|
||||||
, _messagePreview(this, lang(lng_settings_show_preview), cNotifyView() <= dbinvShowPreview)
|
, _messagePreview(this, lang(lng_settings_show_preview), Global::NotifyView() <= dbinvShowPreview)
|
||||||
, _windowsNotifications(this, lang(lng_settings_use_windows), cWindowsNotifications())
|
, _windowsNotifications(this, lang(lng_settings_use_windows), Global::WindowsNotifications())
|
||||||
, _soundNotify(this, lang(lng_settings_sound_notify), cSoundNotify())
|
, _soundNotify(this, lang(lng_settings_sound_notify), Global::SoundNotify())
|
||||||
, _includeMuted(this, lang(lng_settings_include_muted), cIncludeMuted())
|
, _includeMuted(this, lang(lng_settings_include_muted), Global::IncludeMuted())
|
||||||
|
|
||||||
// general
|
// general
|
||||||
, _changeLanguage(this, lang(lng_settings_change_lang))
|
, _changeLanguage(this, lang(lng_settings_change_lang))
|
||||||
|
@ -165,9 +165,9 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent)
|
||||||
, _enterSend(this, qsl("send_key"), 0, lang(lng_settings_send_enter), !cCtrlEnter())
|
, _enterSend(this, qsl("send_key"), 0, lang(lng_settings_send_enter), !cCtrlEnter())
|
||||||
, _ctrlEnterSend(this, qsl("send_key"), 1, lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), cCtrlEnter())
|
, _ctrlEnterSend(this, qsl("send_key"), 1, lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), cCtrlEnter())
|
||||||
|
|
||||||
, _dontAskDownloadPath(this, lang(lng_download_path_dont_ask), !cAskDownloadPath())
|
, _dontAskDownloadPath(this, lang(lng_download_path_dont_ask), false/*!cAskDownloadPath()*/)
|
||||||
, _downloadPathWidth(st::linkFont->width(lang(lng_download_path_label)) + st::linkFont->spacew)
|
, _downloadPathWidth(st::linkFont->width(lang(lng_download_path_label)) + st::linkFont->spacew)
|
||||||
, _downloadPathEdit(this, cDownloadPath().isEmpty() ? lang(lng_download_path_default) : ((cDownloadPath() == qsl("tmp")) ? lang(lng_download_path_temp) : st::linkFont->elided(QDir::toNativeSeparators(cDownloadPath()), st::setWidth - st::cbDefFlat.textLeft - _downloadPathWidth)))
|
, _downloadPathEdit(this, /*cDownloadPath().isEmpty() ?*/ lang(lng_download_path_default) /*: ((cDownloadPath() == qsl("tmp")) ? lang(lng_download_path_temp) : st::linkFont->elided(QDir::toNativeSeparators(cDownloadPath()), st::setWidth - st::cbDefFlat.textLeft - _downloadPathWidth))*/)
|
||||||
, _downloadPathClear(this, lang(lng_download_path_clear))
|
, _downloadPathClear(this, lang(lng_download_path_clear))
|
||||||
, _tempDirClearingWidth(st::linkFont->width(lang(lng_download_path_clearing)))
|
, _tempDirClearingWidth(st::linkFont->width(lang(lng_download_path_clearing)))
|
||||||
, _tempDirClearedWidth(st::linkFont->width(lang(lng_download_path_cleared)))
|
, _tempDirClearedWidth(st::linkFont->width(lang(lng_download_path_cleared)))
|
||||||
|
@ -185,7 +185,7 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent)
|
||||||
// chat background
|
// chat background
|
||||||
, _backFromGallery(this, lang(lng_settings_bg_from_gallery))
|
, _backFromGallery(this, lang(lng_settings_bg_from_gallery))
|
||||||
, _backFromFile(this, lang(lng_settings_bg_from_file))
|
, _backFromFile(this, lang(lng_settings_bg_from_file))
|
||||||
, _tileBackground(this, lang(lng_settings_bg_tile), cTileBackground())
|
, _tileBackground(this, lang(lng_settings_bg_tile), false/*cTileBackground()*/)
|
||||||
, _adaptiveForWide(this, lang(lng_settings_adaptive_wide), Global::AdaptiveForWide())
|
, _adaptiveForWide(this, lang(lng_settings_adaptive_wide), Global::AdaptiveForWide())
|
||||||
, _needBackgroundUpdate(false)
|
, _needBackgroundUpdate(false)
|
||||||
, _radial(animation(this, &SettingsInner::step_radial))
|
, _radial(animation(this, &SettingsInner::step_radial))
|
||||||
|
@ -208,7 +208,6 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent)
|
||||||
, _logOut(this, lang(lng_settings_logout), st::btnRedLink)
|
, _logOut(this, lang(lng_settings_logout), st::btnRedLink)
|
||||||
, _supportGetRequest(0) {
|
, _supportGetRequest(0) {
|
||||||
Notify::registerPeerObserver(Notify::PeerUpdate::Flag::UsernameChanged, this, &SettingsInner::notifyPeerUpdated);
|
Notify::registerPeerObserver(Notify::PeerUpdate::Flag::UsernameChanged, this, &SettingsInner::notifyPeerUpdated);
|
||||||
registerDownloadPathObserver(this, &SettingsInner::notifyDownloadPathUpdated);
|
|
||||||
|
|
||||||
App::clearMousedItems();
|
App::clearMousedItems();
|
||||||
|
|
||||||
|
@ -313,7 +312,7 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// chat background
|
// chat background
|
||||||
if (!cChatBackground()) App::initBackground();
|
//if (!cChatBackground()) App::initBackground();
|
||||||
updateChatBackground();
|
updateChatBackground();
|
||||||
connect(&_backFromGallery, SIGNAL(clicked()), this, SLOT(onBackFromGallery()));
|
connect(&_backFromGallery, SIGNAL(clicked()), this, SLOT(onBackFromGallery()));
|
||||||
connect(&_backFromFile, SIGNAL(clicked()), this, SLOT(onBackFromFile()));
|
connect(&_backFromFile, SIGNAL(clicked()), this, SLOT(onBackFromFile()));
|
||||||
|
@ -368,19 +367,6 @@ void SettingsInner::notifyPeerUpdated(const Notify::PeerUpdate &update) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::notifyDownloadPathUpdated(const DownloadPathUpdate &update) {
|
|
||||||
QString path;
|
|
||||||
if (cDownloadPath().isEmpty()) {
|
|
||||||
path = lang(lng_download_path_default);
|
|
||||||
} else if (cDownloadPath() == qsl("tmp")) {
|
|
||||||
path = lang(lng_download_path_temp);
|
|
||||||
} else {
|
|
||||||
path = st::linkFont->elided(QDir::toNativeSeparators(cDownloadPath()), st::setWidth - st::setVersionLeft - _downloadPathWidth);
|
|
||||||
}
|
|
||||||
_downloadPathEdit.setText(path);
|
|
||||||
showAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsInner::peerUpdated(PeerData *data) {
|
void SettingsInner::peerUpdated(PeerData *data) {
|
||||||
if (self() && data == self()) {
|
if (self() && data == self()) {
|
||||||
if (self()->photoId && self()->photoId != UnknownPeerPhotoId) {
|
if (self()->photoId && self()->photoId != UnknownPeerPhotoId) {
|
||||||
|
@ -556,25 +542,25 @@ void SettingsInner::paintEvent(QPaintEvent *e) {
|
||||||
top += _ctrlEnterSend.height() + st::setSectionSkip;
|
top += _ctrlEnterSend.height() + st::setSectionSkip;
|
||||||
|
|
||||||
top += _dontAskDownloadPath.height();
|
top += _dontAskDownloadPath.height();
|
||||||
if (!cAskDownloadPath()) {
|
//if (!cAskDownloadPath()) {
|
||||||
top += st::setLittleSkip;
|
// top += st::setLittleSkip;
|
||||||
p.setFont(st::linkFont->f);
|
// p.setFont(st::linkFont->f);
|
||||||
p.setPen(st::black->p);
|
// p.setPen(st::black->p);
|
||||||
p.drawText(_left + st::cbDefFlat.textLeft, top + st::linkFont->ascent, lang(lng_download_path_label));
|
// p.drawText(_left + st::cbDefFlat.textLeft, top + st::linkFont->ascent, lang(lng_download_path_label));
|
||||||
if (cDownloadPath() == qsl("tmp")) {
|
// if (cDownloadPath() == qsl("tmp")) {
|
||||||
QString clearText;
|
// QString clearText;
|
||||||
int32 clearWidth = 0;
|
// int32 clearWidth = 0;
|
||||||
switch (_tempDirClearState) {
|
// switch (_tempDirClearState) {
|
||||||
case TempDirClearing: clearText = lang(lng_download_path_clearing); clearWidth = _tempDirClearingWidth; break;
|
// case TempDirClearing: clearText = lang(lng_download_path_clearing); clearWidth = _tempDirClearingWidth; break;
|
||||||
case TempDirCleared: clearText = lang(lng_download_path_cleared); clearWidth = _tempDirClearedWidth; break;
|
// case TempDirCleared: clearText = lang(lng_download_path_cleared); clearWidth = _tempDirClearedWidth; break;
|
||||||
case TempDirClearFailed: clearText = lang(lng_download_path_clear_failed); clearWidth = _tempDirClearFailedWidth; break;
|
// case TempDirClearFailed: clearText = lang(lng_download_path_clear_failed); clearWidth = _tempDirClearFailedWidth; break;
|
||||||
}
|
// }
|
||||||
if (clearWidth) {
|
// if (clearWidth) {
|
||||||
p.drawText(_left + st::setWidth - clearWidth, top + st::linkFont->ascent, clearText);
|
// p.drawText(_left + st::setWidth - clearWidth, top + st::linkFont->ascent, clearText);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
top += _downloadPathEdit.height();
|
// top += _downloadPathEdit.height();
|
||||||
}
|
//}
|
||||||
top += st::setLittleSkip;
|
top += st::setLittleSkip;
|
||||||
top += _autoDownload.height();
|
top += _autoDownload.height();
|
||||||
|
|
||||||
|
@ -755,14 +741,14 @@ void SettingsInner::resizeEvent(QResizeEvent *e) {
|
||||||
_enterSend.move(_left, top); top += _enterSend.height() + st::setLittleSkip;
|
_enterSend.move(_left, top); top += _enterSend.height() + st::setLittleSkip;
|
||||||
_ctrlEnterSend.move(_left, top); top += _ctrlEnterSend.height() + st::setSectionSkip;
|
_ctrlEnterSend.move(_left, top); top += _ctrlEnterSend.height() + st::setSectionSkip;
|
||||||
_dontAskDownloadPath.move(_left, top); top += _dontAskDownloadPath.height();
|
_dontAskDownloadPath.move(_left, top); top += _dontAskDownloadPath.height();
|
||||||
if (!cAskDownloadPath()) {
|
//if (!cAskDownloadPath()) {
|
||||||
top += st::setLittleSkip;
|
// top += st::setLittleSkip;
|
||||||
_downloadPathEdit.move(_left + st::cbDefFlat.textLeft + _downloadPathWidth, top);
|
// _downloadPathEdit.move(_left + st::cbDefFlat.textLeft + _downloadPathWidth, top);
|
||||||
if (cDownloadPath() == qsl("tmp")) {
|
// if (cDownloadPath() == qsl("tmp")) {
|
||||||
_downloadPathClear.move(_left + st::setWidth - _downloadPathClear.width(), top);
|
// _downloadPathClear.move(_left + st::setWidth - _downloadPathClear.width(), top);
|
||||||
}
|
// }
|
||||||
top += _downloadPathEdit.height();
|
// top += _downloadPathEdit.height();
|
||||||
}
|
//}
|
||||||
top += st::setLittleSkip;
|
top += st::setLittleSkip;
|
||||||
_autoDownload.move(_left + st::cbDefFlat.textLeft, top); top += _autoDownload.height();
|
_autoDownload.move(_left + st::cbDefFlat.textLeft, top); top += _autoDownload.height();
|
||||||
|
|
||||||
|
@ -950,19 +936,19 @@ void SettingsInner::updateOnlineDisplay() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::updateConnectionType() {
|
void SettingsInner::updateConnectionType() {
|
||||||
QString connection;
|
//QString connection;
|
||||||
switch (cConnectionType()) {
|
//switch (cConnectionType()) {
|
||||||
case dbictAuto: {
|
//case dbictAuto: {
|
||||||
QString transport = MTP::dctransport();
|
// QString transport = MTP::dctransport();
|
||||||
connection = transport.isEmpty() ? lang(lng_connection_auto_connecting) : lng_connection_auto(lt_transport, transport);
|
// connection = transport.isEmpty() ? lang(lng_connection_auto_connecting) : lng_connection_auto(lt_transport, transport);
|
||||||
} break;
|
//} break;
|
||||||
case dbictHttpProxy:
|
//case dbictHttpProxy:
|
||||||
case dbictTcpProxy: {
|
//case dbictTcpProxy: {
|
||||||
QString transport = MTP::dctransport();
|
// QString transport = MTP::dctransport();
|
||||||
connection = transport.isEmpty() ? lang(lng_connection_proxy_connecting) : lng_connection_proxy(lt_transport, transport);
|
// connection = transport.isEmpty() ? lang(lng_connection_proxy_connecting) : lng_connection_proxy(lt_transport, transport);
|
||||||
} break;
|
//} break;
|
||||||
}
|
//}
|
||||||
_connectionType.setText(connection);
|
//_connectionType.setText(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::passcodeChanged() {
|
void SettingsInner::passcodeChanged() {
|
||||||
|
@ -1128,17 +1114,17 @@ void SettingsInner::showAll() {
|
||||||
_enterSend.show();
|
_enterSend.show();
|
||||||
_ctrlEnterSend.show();
|
_ctrlEnterSend.show();
|
||||||
_dontAskDownloadPath.show();
|
_dontAskDownloadPath.show();
|
||||||
if (cAskDownloadPath()) {
|
//if (cAskDownloadPath()) {
|
||||||
_downloadPathEdit.hide();
|
// _downloadPathEdit.hide();
|
||||||
_downloadPathClear.hide();
|
// _downloadPathClear.hide();
|
||||||
} else {
|
//} else {
|
||||||
_downloadPathEdit.show();
|
// _downloadPathEdit.show();
|
||||||
if (cDownloadPath() == qsl("tmp") && _tempDirClearState == TempDirExists) { // dir exists, not clearing right now
|
// if (cDownloadPath() == qsl("tmp") && _tempDirClearState == TempDirExists) { // dir exists, not clearing right now
|
||||||
_downloadPathClear.show();
|
// _downloadPathClear.show();
|
||||||
} else {
|
// } else {
|
||||||
_downloadPathClear.hide();
|
// _downloadPathClear.hide();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
_autoDownload.show();
|
_autoDownload.show();
|
||||||
} else {
|
} else {
|
||||||
_replaceEmojis.hide();
|
_replaceEmojis.hide();
|
||||||
|
@ -1547,36 +1533,36 @@ void SettingsInner::setScale(DBIScale newScale) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onSoundNotify() {
|
void SettingsInner::onSoundNotify() {
|
||||||
cSetSoundNotify(_soundNotify.checked());
|
//cSetSoundNotify(_soundNotify.checked());
|
||||||
Local::writeUserSettings();
|
//Local::writeUserSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onIncludeMuted() {
|
void SettingsInner::onIncludeMuted() {
|
||||||
cSetIncludeMuted(_includeMuted.checked());
|
//cSetIncludeMuted(_includeMuted.checked());
|
||||||
Notify::unreadCounterUpdated();
|
//Notify::unreadCounterUpdated();
|
||||||
Local::writeUserSettings();
|
//Local::writeUserSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onWindowsNotifications() {
|
void SettingsInner::onWindowsNotifications() {
|
||||||
if (cPlatform() != dbipWindows) return;
|
//if (cPlatform() != dbipWindows) return;
|
||||||
cSetWindowsNotifications(!cWindowsNotifications());
|
//cSetWindowsNotifications(!cWindowsNotifications());
|
||||||
App::wnd()->notifyClearFast();
|
//App::wnd()->notifyClearFast();
|
||||||
cSetCustomNotifies(!cWindowsNotifications());
|
//cSetCustomNotifies(!cWindowsNotifications());
|
||||||
Local::writeUserSettings();
|
//Local::writeUserSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onDesktopNotify() {
|
void SettingsInner::onDesktopNotify() {
|
||||||
cSetDesktopNotify(_desktopNotify.checked());
|
//cSetDesktopNotify(_desktopNotify.checked());
|
||||||
if (!_desktopNotify.checked()) {
|
//if (!_desktopNotify.checked()) {
|
||||||
App::wnd()->notifyClear();
|
// App::wnd()->notifyClear();
|
||||||
_senderName.setDisabled(true);
|
// _senderName.setDisabled(true);
|
||||||
_messagePreview.setDisabled(true);
|
// _messagePreview.setDisabled(true);
|
||||||
} else {
|
//} else {
|
||||||
_senderName.setDisabled(false);
|
// _senderName.setDisabled(false);
|
||||||
_messagePreview.setDisabled(!_senderName.checked());
|
// _messagePreview.setDisabled(!_senderName.checked());
|
||||||
}
|
//}
|
||||||
Local::writeUserSettings();
|
//Local::writeUserSettings();
|
||||||
if (App::wnd()) App::wnd()->updateTrayMenu();
|
//if (App::wnd()) App::wnd()->updateTrayMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::enableDisplayNotify(bool enable)
|
void SettingsInner::enableDisplayNotify(bool enable)
|
||||||
|
@ -1585,32 +1571,32 @@ void SettingsInner::enableDisplayNotify(bool enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onSenderName() {
|
void SettingsInner::onSenderName() {
|
||||||
_messagePreview.setDisabled(!_senderName.checked());
|
//_messagePreview.setDisabled(!_senderName.checked());
|
||||||
if (!_senderName.checked() && _messagePreview.checked()) {
|
//if (!_senderName.checked() && _messagePreview.checked()) {
|
||||||
_messagePreview.setChecked(false);
|
// _messagePreview.setChecked(false);
|
||||||
} else {
|
//} else {
|
||||||
if (_messagePreview.checked()) {
|
// if (_messagePreview.checked()) {
|
||||||
cSetNotifyView(dbinvShowPreview);
|
// cSetNotifyView(dbinvShowPreview);
|
||||||
} else if (_senderName.checked()) {
|
// } else if (_senderName.checked()) {
|
||||||
cSetNotifyView(dbinvShowName);
|
// cSetNotifyView(dbinvShowName);
|
||||||
} else {
|
// } else {
|
||||||
cSetNotifyView(dbinvShowNothing);
|
// cSetNotifyView(dbinvShowNothing);
|
||||||
}
|
// }
|
||||||
Local::writeUserSettings();
|
// Local::writeUserSettings();
|
||||||
App::wnd()->notifyUpdateAll();
|
// App::wnd()->notifyUpdateAll();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onMessagePreview() {
|
void SettingsInner::onMessagePreview() {
|
||||||
if (_messagePreview.checked()) {
|
//if (_messagePreview.checked()) {
|
||||||
cSetNotifyView(dbinvShowPreview);
|
// cSetNotifyView(dbinvShowPreview);
|
||||||
} else if (_senderName.checked()) {
|
//} else if (_senderName.checked()) {
|
||||||
cSetNotifyView(dbinvShowName);
|
// cSetNotifyView(dbinvShowName);
|
||||||
} else {
|
//} else {
|
||||||
cSetNotifyView(dbinvShowNothing);
|
// cSetNotifyView(dbinvShowNothing);
|
||||||
}
|
//}
|
||||||
Local::writeUserSettings();
|
//Local::writeUserSettings();
|
||||||
App::wnd()->notifyUpdateAll();
|
//App::wnd()->notifyUpdateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onReplaceEmojis() {
|
void SettingsInner::onReplaceEmojis() {
|
||||||
|
@ -1649,12 +1635,12 @@ void SettingsInner::onCtrlEnterSend() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onBackFromGallery() {
|
void SettingsInner::onBackFromGallery() {
|
||||||
BackgroundBox *box = new BackgroundBox();
|
//BackgroundBox *box = new BackgroundBox();
|
||||||
box->setUpdateCallback([this, weak_this = weakThis()](bool tile) {
|
//box->setUpdateCallback([this, weak_this = weakThis()](bool tile) {
|
||||||
if (!weak_this) return;
|
// if (!weak_this) return;
|
||||||
needBackgroundUpdate(tile);
|
// needBackgroundUpdate(tile);
|
||||||
});
|
//});
|
||||||
Ui::showLayer(box);
|
//Ui::showLayer(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onBackFromFile() {
|
void SettingsInner::onBackFromFile() {
|
||||||
|
@ -1735,23 +1721,23 @@ void SettingsInner::step_radial(uint64 ms, bool timer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::updateChatBackground() {
|
void SettingsInner::updateChatBackground() {
|
||||||
int32 size = st::setBackgroundSize * cIntRetinaFactor();
|
//int32 size = st::setBackgroundSize * cIntRetinaFactor();
|
||||||
QImage back(size, size, QImage::Format_ARGB32_Premultiplied);
|
//QImage back(size, size, QImage::Format_ARGB32_Premultiplied);
|
||||||
back.setDevicePixelRatio(cRetinaFactor());
|
//back.setDevicePixelRatio(cRetinaFactor());
|
||||||
{
|
//{
|
||||||
QPainter p(&back);
|
// QPainter p(&back);
|
||||||
const QPixmap &pix(*cChatBackground());
|
// const QPixmap &pix(*cChatBackground());
|
||||||
int sx = (pix.width() > pix.height()) ? ((pix.width() - pix.height()) / 2) : 0;
|
// int sx = (pix.width() > pix.height()) ? ((pix.width() - pix.height()) / 2) : 0;
|
||||||
int sy = (pix.height() > pix.width()) ? ((pix.height() - pix.width()) / 2) : 0;
|
// int sy = (pix.height() > pix.width()) ? ((pix.height() - pix.width()) / 2) : 0;
|
||||||
int s = (pix.width() > pix.height()) ? pix.height() : pix.width();
|
// int s = (pix.width() > pix.height()) ? pix.height() : pix.width();
|
||||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
// p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
p.drawPixmap(0, 0, st::setBackgroundSize, st::setBackgroundSize, pix, sx, sy, s, s);
|
// p.drawPixmap(0, 0, st::setBackgroundSize, st::setBackgroundSize, pix, sx, sy, s, s);
|
||||||
}
|
//}
|
||||||
_background = App::pixmapFromImageInPlace(std_::move(back));
|
//_background = App::pixmapFromImageInPlace(std_::move(back));
|
||||||
_background.setDevicePixelRatio(cRetinaFactor());
|
//_background.setDevicePixelRatio(cRetinaFactor());
|
||||||
_needBackgroundUpdate = false;
|
//_needBackgroundUpdate = false;
|
||||||
|
|
||||||
updateBackgroundRect();
|
//updateBackgroundRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::needBackgroundUpdate(bool tile) {
|
void SettingsInner::needBackgroundUpdate(bool tile) {
|
||||||
|
@ -1764,30 +1750,30 @@ void SettingsInner::needBackgroundUpdate(bool tile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onTileBackground() {
|
void SettingsInner::onTileBackground() {
|
||||||
if (cTileBackground() != _tileBackground.checked()) {
|
//if (cTileBackground() != _tileBackground.checked()) {
|
||||||
cSetTileBackground(_tileBackground.checked());
|
// cSetTileBackground(_tileBackground.checked());
|
||||||
if (App::main()) App::main()->clearCachedBackground();
|
// if (App::main()) App::main()->clearCachedBackground();
|
||||||
Local::writeUserSettings();
|
// Local::writeUserSettings();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onAdaptiveForWide() {
|
void SettingsInner::onAdaptiveForWide() {
|
||||||
if (Global::AdaptiveForWide() != _adaptiveForWide.checked()) {
|
//if (Global::AdaptiveForWide() != _adaptiveForWide.checked()) {
|
||||||
Global::SetAdaptiveForWide(_adaptiveForWide.checked());
|
// Global::SetAdaptiveForWide(_adaptiveForWide.checked());
|
||||||
if (App::wnd()) {
|
// if (App::wnd()) {
|
||||||
App::wnd()->updateAdaptiveLayout();
|
// App::wnd()->updateAdaptiveLayout();
|
||||||
}
|
// }
|
||||||
Local::writeUserSettings();
|
// Local::writeUserSettings();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onDontAskDownloadPath() {
|
void SettingsInner::onDontAskDownloadPath() {
|
||||||
cSetAskDownloadPath(!_dontAskDownloadPath.checked());
|
//cSetAskDownloadPath(!_dontAskDownloadPath.checked());
|
||||||
Local::writeUserSettings();
|
//Local::writeUserSettings();
|
||||||
|
|
||||||
showAll();
|
//showAll();
|
||||||
resizeEvent(0);
|
//resizeEvent(0);
|
||||||
update();
|
//update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onDownloadPathEdit() {
|
void SettingsInner::onDownloadPathEdit() {
|
||||||
|
@ -2041,7 +2027,7 @@ void SettingsWidget::updateAdaptiveLayout() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidget::updateDisplayNotify() {
|
void SettingsWidget::updateDisplayNotify() {
|
||||||
_inner.enableDisplayNotify(cDesktopNotify());
|
//_inner.enableDisplayNotify(cDesktopNotify());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidget::updateOnlineDisplay() {
|
void SettingsWidget::updateOnlineDisplay() {
|
||||||
|
|
|
@ -194,7 +194,6 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void notifyPeerUpdated(const Notify::PeerUpdate &update);
|
void notifyPeerUpdated(const Notify::PeerUpdate &update);
|
||||||
void notifyDownloadPathUpdated(const DownloadPathUpdate &update);
|
|
||||||
|
|
||||||
void saveError(const QString &str = QString());
|
void saveError(const QString &str = QString());
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#endif // __clang__
|
#endif // __clang__
|
||||||
|
|
||||||
|
|
||||||
#include <QtWidgets/QtWidgets>
|
#include <QtWidgets/QtWidgets>
|
||||||
#include <QtNetwork/QtNetwork>
|
#include <QtNetwork/QtNetwork>
|
||||||
|
|
||||||
|
|
|
@ -806,7 +806,7 @@ QString saveFileName(const QString &title, const QString &filter, const QString
|
||||||
#elif defined Q_OS_LINUX
|
#elif defined Q_OS_LINUX
|
||||||
name = name.replace(QRegularExpression(qsl("[\\/]")), qsl("_"));
|
name = name.replace(QRegularExpression(qsl("[\\/]")), qsl("_"));
|
||||||
#endif
|
#endif
|
||||||
if (cAskDownloadPath() || savingAs) {
|
if (Global::AskDownloadPath() || savingAs) {
|
||||||
if (!name.isEmpty() && name.at(0) == QChar::fromLatin1('.')) {
|
if (!name.isEmpty() && name.at(0) == QChar::fromLatin1('.')) {
|
||||||
name = filedialogDefaultName(prefix, name);
|
name = filedialogDefaultName(prefix, name);
|
||||||
} else if (dir.path() != qsl(".")) {
|
} else if (dir.path() != qsl(".")) {
|
||||||
|
@ -851,12 +851,12 @@ QString saveFileName(const QString &title, const QString &filter, const QString
|
||||||
}
|
}
|
||||||
|
|
||||||
QString path;
|
QString path;
|
||||||
if (cDownloadPath().isEmpty()) {
|
if (Global::DownloadPath().isEmpty()) {
|
||||||
path = psDownloadPath();
|
path = psDownloadPath();
|
||||||
} else if (cDownloadPath() == qsl("tmp")) {
|
} else if (Global::DownloadPath() == qsl("tmp")) {
|
||||||
path = cTempDir();
|
path = cTempDir();
|
||||||
} else {
|
} else {
|
||||||
path = cDownloadPath();
|
path = Global::DownloadPath();
|
||||||
}
|
}
|
||||||
if (name.isEmpty()) name = qsl(".unknown");
|
if (name.isEmpty()) name = qsl(".unknown");
|
||||||
if (name.at(0) == QChar::fromLatin1('.')) {
|
if (name.at(0) == QChar::fromLatin1('.')) {
|
||||||
|
@ -1480,7 +1480,7 @@ QString DocumentData::filepath(FilePathResolveType type, bool forceSavingAs) con
|
||||||
if (saveFromData) {
|
if (saveFromData) {
|
||||||
if (type != FilePathResolveSaveFromData && type != FilePathResolveSaveFromDataSilent) {
|
if (type != FilePathResolveSaveFromData && type != FilePathResolveSaveFromDataSilent) {
|
||||||
saveFromData = false;
|
saveFromData = false;
|
||||||
} else if (type == FilePathResolveSaveFromDataSilent && (cAskDownloadPath() || forceSavingAs)) {
|
} else if (type == FilePathResolveSaveFromDataSilent && (Global::AskDownloadPath() || forceSavingAs)) {
|
||||||
saveFromData = false;
|
saveFromData = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,8 @@ TitleWidget::TitleWidget(MainWindow *window) : TWidget(window)
|
||||||
Sandbox::connect(SIGNAL(updateReady()), this, SLOT(showUpdateBtn()));
|
Sandbox::connect(SIGNAL(updateReady()), this, SLOT(showUpdateBtn()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); });
|
||||||
|
|
||||||
if (cPlatform() != dbipWindows) {
|
if (cPlatform() != dbipWindows) {
|
||||||
_minimize.hide();
|
_minimize.hide();
|
||||||
_maximize.hide();
|
_maximize.hide();
|
||||||
|
|
|
@ -39,7 +39,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TitleWidget : public TWidget {
|
class TitleWidget : public TWidget, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -49,7 +49,6 @@ public:
|
||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
void updateBackButton();
|
void updateBackButton();
|
||||||
void updateAdaptiveLayout();
|
|
||||||
void updateCounter();
|
void updateCounter();
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
void mousePressEvent(QMouseEvent *e);
|
||||||
|
@ -77,6 +76,7 @@ signals:
|
||||||
void hiderClicked();
|
void hiderClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateAdaptiveLayout();
|
||||||
|
|
||||||
MainWindow *wnd;
|
MainWindow *wnd;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
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
|
||||||
|
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
|
*/
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "window/chat_background.h"
|
||||||
|
|
||||||
|
#include "mainwidget.h"
|
||||||
|
#include "localstorage.h"
|
||||||
|
|
||||||
|
namespace Window {
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
NeverFreedPointer<ChatBackground> instance;
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
bool ChatBackground::empty() const {
|
||||||
|
return _image.isNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChatBackground::initIfEmpty() {
|
||||||
|
if (empty()) {
|
||||||
|
App::initBackground();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChatBackground::init(int32 id, QPixmap &&image, QPixmap &&dog) {
|
||||||
|
_id = id;
|
||||||
|
_image = std_::move(image);
|
||||||
|
_dog = std_::move(dog);
|
||||||
|
|
||||||
|
notify(ChatBackgroundUpdate(ChatBackgroundUpdate::Type::New, _tile));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChatBackground::reset() {
|
||||||
|
_id = 0;
|
||||||
|
_image = QPixmap();
|
||||||
|
_dog = QPixmap();
|
||||||
|
_tile = false;
|
||||||
|
|
||||||
|
notify(ChatBackgroundUpdate(ChatBackgroundUpdate::Type::New, _tile));
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 ChatBackground::id() const {
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QPixmap &ChatBackground::image() const {
|
||||||
|
return _image;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QPixmap &ChatBackground::dog() const {
|
||||||
|
return _dog;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ChatBackground::tile() const {
|
||||||
|
return _tile;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChatBackground::setTile(bool tile) {
|
||||||
|
if (_tile != tile) {
|
||||||
|
_tile = tile;
|
||||||
|
Local::writeUserSettings();
|
||||||
|
notify(ChatBackgroundUpdate(ChatBackgroundUpdate::Type::Changed, _tile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ChatBackground *chatBackground() {
|
||||||
|
instance.makeIfNull();
|
||||||
|
return instance.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Window
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
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
|
||||||
|
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Window {
|
||||||
|
|
||||||
|
struct ChatBackgroundUpdate {
|
||||||
|
enum class Type {
|
||||||
|
New,
|
||||||
|
Changed,
|
||||||
|
Start,
|
||||||
|
};
|
||||||
|
|
||||||
|
ChatBackgroundUpdate(Type type, bool tiled) : type(type), tiled(tiled) {
|
||||||
|
}
|
||||||
|
Type type;
|
||||||
|
bool tiled;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ChatBackground : public base::Observable<ChatBackgroundUpdate> {
|
||||||
|
public:
|
||||||
|
bool empty() const;
|
||||||
|
void initIfEmpty();
|
||||||
|
void init(int32 id, QPixmap &&image, QPixmap &&dog);
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
int32 id() const;
|
||||||
|
const QPixmap &image() const;
|
||||||
|
const QPixmap &dog() const;
|
||||||
|
bool tile() const;
|
||||||
|
void setTile(bool tile);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int32 _id = 0;
|
||||||
|
QPixmap _image;
|
||||||
|
QPixmap _dog;
|
||||||
|
bool _tile = false;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
ChatBackground *chatBackground();
|
||||||
|
|
||||||
|
} // namespace Window
|
|
@ -32,7 +32,7 @@ struct SectionSlideParams {
|
||||||
bool withTopBarShadow = false;
|
bool withTopBarShadow = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SectionWidget : public TWidget {
|
class SectionWidget : public TWidget, protected base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -71,9 +71,6 @@ public:
|
||||||
setFocus();
|
setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void updateAdaptiveLayout() {
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,8 @@ TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w)
|
||||||
connect(_info, SIGNAL(clicked()), this, SLOT(onInfoClicked()));
|
connect(_info, SIGNAL(clicked()), this, SLOT(onInfoClicked()));
|
||||||
connect(_search, SIGNAL(clicked()), this, SLOT(onSearch()));
|
connect(_search, SIGNAL(clicked()), this, SLOT(onSearch()));
|
||||||
|
|
||||||
|
subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); });
|
||||||
|
|
||||||
setCursor(style::cur_pointer);
|
setCursor(style::cur_pointer);
|
||||||
showAll();
|
showAll();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class IconedButton;
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
|
|
||||||
class TopBarWidget : public TWidget {
|
class TopBarWidget : public TWidget, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -51,8 +51,6 @@ public:
|
||||||
void showAll();
|
void showAll();
|
||||||
void showSelected(uint32 selCount, bool canDelete = false);
|
void showSelected(uint32 selCount, bool canDelete = false);
|
||||||
|
|
||||||
void updateAdaptiveLayout();
|
|
||||||
|
|
||||||
void updateMembersShowArea();
|
void updateMembersShowArea();
|
||||||
|
|
||||||
Ui::RoundButton *mediaTypeButton();
|
Ui::RoundButton *mediaTypeButton();
|
||||||
|
@ -71,6 +69,8 @@ signals:
|
||||||
void clicked();
|
void clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateAdaptiveLayout();
|
||||||
|
|
||||||
MainWidget *main();
|
MainWidget *main();
|
||||||
anim::fvalue a_over = { 0. };
|
anim::fvalue a_over = { 0. };
|
||||||
Animation _a_appearance;
|
Animation _a_appearance;
|
||||||
|
|
|
@ -86,6 +86,7 @@
|
||||||
'<(src_loc)/application.h',
|
'<(src_loc)/application.h',
|
||||||
'<(src_loc)/autoupdater.cpp',
|
'<(src_loc)/autoupdater.cpp',
|
||||||
'<(src_loc)/autoupdater.h',
|
'<(src_loc)/autoupdater.h',
|
||||||
|
'<(src_loc)/config.h',
|
||||||
'<(src_loc)/dialogswidget.cpp',
|
'<(src_loc)/dialogswidget.cpp',
|
||||||
'<(src_loc)/dialogswidget.h',
|
'<(src_loc)/dialogswidget.h',
|
||||||
'<(src_loc)/dropdown.cpp',
|
'<(src_loc)/dropdown.cpp',
|
||||||
|
@ -427,6 +428,8 @@
|
||||||
'<(src_loc)/ui/scrollarea.h',
|
'<(src_loc)/ui/scrollarea.h',
|
||||||
'<(src_loc)/ui/twidget.cpp',
|
'<(src_loc)/ui/twidget.cpp',
|
||||||
'<(src_loc)/ui/twidget.h',
|
'<(src_loc)/ui/twidget.h',
|
||||||
|
'<(src_loc)/window/chat_background.cpp',
|
||||||
|
'<(src_loc)/window/chat_background.h',
|
||||||
'<(src_loc)/window/main_window.cpp',
|
'<(src_loc)/window/main_window.cpp',
|
||||||
'<(src_loc)/window/main_window.h',
|
'<(src_loc)/window/main_window.h',
|
||||||
'<(src_loc)/window/section_widget.cpp',
|
'<(src_loc)/window/section_widget.cpp',
|
||||||
|
|
|
@ -20,16 +20,7 @@
|
||||||
{
|
{
|
||||||
'conditions': [
|
'conditions': [
|
||||||
[ 'build_win', {
|
[ 'build_win', {
|
||||||
'msvs_cygwin_shell': 0,
|
'defines': [
|
||||||
'msvs_settings': {
|
|
||||||
'VCCLCompilerTool': {
|
|
||||||
'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
|
|
||||||
'DebugInformationFormat': '3', # Program Database (/Zi)
|
|
||||||
'AdditionalOptions': [
|
|
||||||
'/MP', # Enable multi process build.
|
|
||||||
'/EHsc', # Catch C++ exceptions only, extern C functions never throw a C++ exception.
|
|
||||||
],
|
|
||||||
'PreprocessorDefinitions': [
|
|
||||||
'WIN32',
|
'WIN32',
|
||||||
'_WINDOWS',
|
'_WINDOWS',
|
||||||
'_UNICODE',
|
'_UNICODE',
|
||||||
|
@ -39,6 +30,15 @@
|
||||||
'_SCL_SECURE_NO_WARNINGS',
|
'_SCL_SECURE_NO_WARNINGS',
|
||||||
'_USING_V110_SDK71_',
|
'_USING_V110_SDK71_',
|
||||||
],
|
],
|
||||||
|
'msvs_cygwin_shell': 0,
|
||||||
|
'msvs_settings': {
|
||||||
|
'VCCLCompilerTool': {
|
||||||
|
'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
|
||||||
|
'DebugInformationFormat': '3', # Program Database (/Zi)
|
||||||
|
'AdditionalOptions': [
|
||||||
|
'/MP', # Enable multi process build.
|
||||||
|
'/EHsc', # Catch C++ exceptions only, extern C functions never throw a C++ exception.
|
||||||
|
],
|
||||||
'TreatWChar_tAsBuiltInType': 'false',
|
'TreatWChar_tAsBuiltInType': 'false',
|
||||||
},
|
},
|
||||||
'VCLinkerTool': {
|
'VCLinkerTool': {
|
||||||
|
|
Loading…
Reference in New Issue