some namespaces reorganized, author photo display added to wide mode (where messages are centered), version 0.9.20.dev

This commit is contained in:
John Preston 2016-02-08 17:54:55 +03:00
parent 5320285943
commit 80ba0259dd
46 changed files with 400 additions and 381 deletions

View file

@ -51,7 +51,10 @@ color7: #2996ad; // sea
color8: #ce671b; // orange
wndMinWidth: 380px;
wideModeWidth: 640px;
adaptiveNormalWidth: 640px;
adaptiveWideWidth: 1120px;
wndMinHeight: 480px;
wndDefWidth: 800px;
wndDefHeight: 600px;

View file

@ -2612,10 +2612,10 @@ namespace App {
QNetworkProxy getHttpProxySettings() {
const ConnectionProxy *proxy = 0;
if (Sandbox::started()) {
if (Global::started()) {
proxy = (cConnectionType() == dbictHttpProxy) ? (&cConnectionProxy()) : 0;
} else {
proxy = Global::PreLaunchProxy().host.isEmpty() ? 0 : (&Global::PreLaunchProxy());
proxy = Sandbox::PreLaunchProxy().host.isEmpty() ? 0 : (&Sandbox::PreLaunchProxy());
}
if (proxy) {
return QNetworkProxy(QNetworkProxy::HttpProxy, proxy->host, proxy->port, proxy->user, proxy->password);

View file

@ -75,6 +75,9 @@ namespace {
if (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray) {
App::wnd()->minimizeToTray();
return true;
} else {
App::wnd()->close();
return true;
}
}
}
@ -178,7 +181,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
Application::~Application() {
App::setQuiting();
Global::finish();
Sandbox::finish();
delete AppObject;
@ -277,7 +280,7 @@ void Application::singleInstanceChecked() {
Logs::multipleInstances();
}
Global::start();
Sandbox::start();
if (!Logs::started() || (!cManyInstance() && !Logs::instanceChecked())) {
new NotStartedWindow();
@ -286,17 +289,17 @@ void Application::singleInstanceChecked() {
if (status == SignalHandlers::CantOpen) {
new NotStartedWindow();
} else if (status == SignalHandlers::LastCrashed) {
if (Global::LastCrashDump().isEmpty()) { // don't handle bad closing for now
if (Sandbox::LastCrashDump().isEmpty()) { // don't handle bad closing for now
if (SignalHandlers::restart() == SignalHandlers::CantOpen) {
new NotStartedWindow();
} else {
Sandboxer::startSandbox();
Sandbox::launch();
}
} else {
new LastCrashedWindow();
}
} else {
Sandboxer::startSandbox();
Sandbox::launch();
}
}
}
@ -328,7 +331,7 @@ void Application::readClients() {
for (int32 to = cmds.indexOf(QChar(';'), from); to >= from; to = (from < l) ? cmds.indexOf(QChar(';'), from) : -1) {
QStringRef cmd(&cmds, from, to - from);
if (cmd.startsWith(qsl("CMD:"))) {
Sandboxer::execExternal(cmds.mid(from + 4, to - from - 4));
Sandbox::execExternal(cmds.mid(from + 4, to - from - 4));
QByteArray response(qsl("RES:%1;").arg(QCoreApplication::applicationPid()).toLatin1());
i->first->write(response.data(), response.size());
} else if (cmd.startsWith(qsl("SEND:"))) {
@ -546,7 +549,7 @@ inline Application *application() {
return qobject_cast<Application*>(QApplication::instance());
}
namespace Sandboxer {
namespace Sandbox {
QRect availableGeometry() {
if (Application *a = application()) {
@ -665,7 +668,7 @@ namespace Sandboxer {
}
}
void startSandbox() {
void launch() {
t_assert(application() != 0);
float64 dpi = Application::primaryScreen()->logicalDotsPerInch();
@ -699,7 +702,7 @@ AppClass::AppClass() : QObject()
Fonts::start();
ThirdParty::start();
Sandbox::start();
Global::start();
Local::start();
if (Local::oldSettingsVersion() < AppVersion) {
psNewVersion();
@ -719,7 +722,7 @@ AppClass::AppClass() : QObject()
}
if (cLang() < languageTest) {
cSetLang(Global::LangSystem());
cSetLang(Sandbox::LangSystem());
}
if (cLang() == languageTest) {
if (QFileInfo(cLangFile()).exists()) {
@ -752,7 +755,7 @@ AppClass::AppClass() : QObject()
application()->installNativeEventFilter(psNativeEventFilter());
Sandboxer::connect(SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onAppStateChanged(Qt::ApplicationState)));
Sandbox::connect(SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onAppStateChanged(Qt::ApplicationState)));
connect(&_mtpUnpauseTimer, SIGNAL(timeout()), this, SLOT(doMtpUnpause()));
@ -1048,8 +1051,12 @@ void AppClass::checkMapVersion() {
if (Local::oldMapVersion() < AppVersion) {
if (Local::oldMapVersion()) {
QString versionFeatures;
if (cDevVersion() && Local::oldMapVersion() < 9019) {
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Choose an emoticon and see the suggested stickers\n\xe2\x80\x94 Bug fixes in minor improvements");// .replace('@', qsl("@") + QChar(0x200D));
if (cDevVersion() && Local::oldMapVersion() < 9020) {
if (cPlatform() == dbipMac || cPlatform() == dbipMacOld) {
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Testing new crash reporting system\n\xe2\x80\x94 Conversation history is centered in wide windows\n\xe2\x80\x94 New cute link and timestamp tooltips design\n\xe2\x80\x94 Bug fixes and other minor improvements");// .replace('@', qsl("@") + QChar(0x200D));
} else {
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Testing new crash reporting system\n\xe2\x80\x94 Conversation history is centered in wide windows\n\xe2\x80\x94 New cute link and timestamp tooltips design\n\xe2\x80\x94 Ctrl+W or Ctrl+F4 closes Telegram window\n\xe2\x80\x94 Bug fixes and other minor improvements");// .replace('@', qsl("@") + QChar(0x200D));
}
} else if (Local::oldMapVersion() < 9016) {
versionFeatures = lng_new_version_text(lt_gifs_link, qsl("https://telegram.org/blog/gif-revolution"), lt_bots_link, qsl("https://telegram.org/blog/inline-bots")).trimmed();
} else {
@ -1087,7 +1094,7 @@ AppClass::~AppClass() {
style::stopManager();
Local::finish();
Sandbox::finish();
Global::finish();
ThirdParty::finish();
}

View file

@ -105,7 +105,7 @@ private:
#endif
};
namespace Sandboxer {
namespace Sandbox {
QRect availableGeometry();
QRect screenGeometry(const QPoint &p);
@ -135,7 +135,7 @@ namespace Sandboxer {
void connect(const char *signal, QObject *object, const char *method);
void startSandbox();
void launch();
}

View file

@ -127,7 +127,7 @@ void UpdateChecker::partMetaGot() {
full = m.captured(1).toInt();
}
Sandboxer::updateProgress(already, full);
Sandbox::updateProgress(already, full);
}
}
}
@ -180,7 +180,7 @@ void UpdateChecker::partFinished(qint64 got, qint64 total) {
outputFile.close();
unpackUpdate();
} else {
Sandboxer::updateProgress(already, full);
Sandbox::updateProgress(already, full);
}
}
@ -199,12 +199,12 @@ void UpdateChecker::partFailed(QNetworkReply::NetworkError e) {
}
}
LOG(("Update Error: failed to download part starting from %1, error %2").arg(already).arg(e));
Sandboxer::updateFailed();
Sandbox::updateFailed();
}
void UpdateChecker::fatalFail() {
clearAll();
Sandboxer::updateFailed();
Sandbox::updateFailed();
}
void UpdateChecker::clearAll() {
@ -466,7 +466,7 @@ void UpdateChecker::unpackUpdate() {
}
outputFile.remove();
Sandboxer::updateReady();
Sandbox::updateReady();
}
UpdateChecker::~UpdateChecker() {

View file

@ -20,10 +20,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
static const int32 AppVersion = 9019;
static const wchar_t *AppVersionStr = L"0.9.19";
static const int32 AppVersion = 9020;
static const wchar_t *AppVersionStr = L"0.9.20";
static const bool DevVersion = true;
#define BETA_VERSION (9019002ULL) // just comment this line to build public version
//#define BETA_VERSION (9019002ULL) // just comment this line to build public version
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
static const wchar_t *AppName = L"Telegram Desktop";

View file

@ -2268,7 +2268,7 @@ void DialogsWidget::dragEnterEvent(QDragEnterEvent *e) {
_dragForward = e->mimeData()->hasFormat(qsl("application/x-td-forward-selected"));
if (!_dragForward) _dragForward = e->mimeData()->hasFormat(qsl("application/x-td-forward-pressed-link"));
if (!_dragForward) _dragForward = e->mimeData()->hasFormat(qsl("application/x-td-forward-pressed"));
if (_dragForward && !cWideMode()) _dragForward = false;
if (_dragForward && Adaptive::OneColumn()) _dragForward = false;
if (_dragForward) {
e->setDropAction(Qt::CopyAction);
e->accept();
@ -2540,7 +2540,7 @@ bool DialogsWidget::onCancelSearch() {
_searchRequest = 0;
}
if (_searchInPeer && !clearing) {
if (!cWideMode()) {
if (Adaptive::OneColumn()) {
Ui::showPeerHistory(_searchInPeer, ShowAtUnreadMsgId);
}
_searchInPeer = _searchInMigrated = 0;
@ -2560,7 +2560,7 @@ void DialogsWidget::onCancelSearchInPeer() {
_searchRequest = 0;
}
if (_searchInPeer) {
if (!cWideMode() && !App::main()->selectingPeer()) {
if (Adaptive::OneColumn() && !App::main()->selectingPeer()) {
Ui::showPeerHistory(_searchInPeer, ShowAtUnreadMsgId);
}
_searchInPeer = _searchInMigrated = 0;
@ -2570,7 +2570,7 @@ void DialogsWidget::onCancelSearchInPeer() {
_filter.clear();
_filter.updatePlaceholder();
onFilterUpdate();
if (cWideMode() && !App::main()->selectingPeer()) {
if (!Adaptive::OneColumn() && !App::main()->selectingPeer()) {
emit cancelled();
}
}

View file

@ -4013,9 +4013,9 @@ void MentionsInner::paintEvent(QPaintEvent *e) {
}
}
}
p.fillRect(cWideMode() ? st::lineWidth : 0, _parent->innerBottom() - st::lineWidth, width() - (cWideMode() ? st::lineWidth : 0), st::lineWidth, st::shadowColor->b);
p.fillRect(Adaptive::OneColumn() ? 0 : st::lineWidth, _parent->innerBottom() - st::lineWidth, width() - (Adaptive::OneColumn() ? 0 : st::lineWidth), st::lineWidth, st::shadowColor->b);
}
p.fillRect(cWideMode() ? st::lineWidth : 0, _parent->innerTop(), width() - (cWideMode() ? st::lineWidth : 0), st::lineWidth, st::shadowColor->b);
p.fillRect(Adaptive::OneColumn() ? 0 : st::lineWidth, _parent->innerTop(), width() - (Adaptive::OneColumn() ? 0 : st::lineWidth), st::lineWidth, st::shadowColor->b);
}
void MentionsInner::resizeEvent(QResizeEvent *e) {

View file

@ -176,16 +176,31 @@ namespace Notify {
}
struct GlobalDataStruct {
#define DefineReadOnlyVar(Namespace, Type, Name) const Type &Name() { \
t_assert_full(Namespace##Data != 0, #Namespace "Data is null in " #Namespace "::" #Name, __FILE__, __LINE__); \
return Namespace##Data->Name; \
}
#define DefineRefVar(Namespace, Type, Name) DefineReadOnlyVar(Namespace, Type, Name) \
Type &Ref##Name() { \
t_assert_full(Namespace##Data != 0, #Namespace "Data is null in Global::Ref" #Name, __FILE__, __LINE__); \
return Namespace##Data->Name; \
}
#define DefineVar(Namespace, Type, Name) DefineRefVar(Namespace, Type, Name) \
void Set##Name(const Type &Name) { \
t_assert_full(Namespace##Data != 0, #Namespace "Data is null in Global::Set" #Name, __FILE__, __LINE__); \
Namespace##Data->Name = Name; \
}
struct SandboxDataStruct {
QString LangSystemISO;
int32 LangSystem = languageDefault;
QByteArray LastCrashDump;
ConnectionProxy PreLaunchProxy;
};
GlobalDataStruct *GlobalData = 0;
SandboxDataStruct *SandboxData = 0;
namespace Global {
namespace Sandbox {
bool CheckBetaVersionDir() {
QFile beta(cExeDir() + qsl("TelegramBeta_data/tdata/beta"));
@ -248,14 +263,14 @@ namespace Global {
}
void start() {
GlobalData = new GlobalDataStruct();
SandboxData = new SandboxDataStruct();
GlobalData->LangSystemISO = psCurrentLanguage();
if (GlobalData->LangSystemISO.isEmpty()) GlobalData->LangSystemISO = qstr("en");
SandboxData->LangSystemISO = psCurrentLanguage();
if (SandboxData->LangSystemISO.isEmpty()) SandboxData->LangSystemISO = qstr("en");
QByteArray l = LangSystemISO().toLatin1();
for (int32 i = 0; i < languageCount; ++i) {
if (l.at(0) == LanguageCodes[i][0] && l.at(1) == LanguageCodes[i][1]) {
GlobalData->LangSystem = i;
SandboxData->LangSystem = i;
break;
}
}
@ -263,69 +278,42 @@ namespace Global {
srand((int32)time(NULL));
}
void finish() {
delete GlobalData;
GlobalData = 0;
}
#define DefineGlobalReadOnly(Type, Name) const Type &Name() { \
t_assert_full(GlobalData != 0, "_data is null in Global::" #Name, __FILE__, __LINE__); \
return GlobalData->Name; \
}
#define DefineGlobal(Type, Name) DefineGlobalReadOnly(Type, Name) \
void Set##Name(const Type &Name) { \
t_assert_full(GlobalData != 0, "_data is null in Global::Set" #Name, __FILE__, __LINE__); \
GlobalData->Name = Name; \
} \
Type &Ref##Name() { \
t_assert_full(GlobalData != 0, "_data is null in Global::Ref" #Name, __FILE__, __LINE__); \
return GlobalData->Name; \
}
DefineGlobalReadOnly(QString, LangSystemISO);
DefineGlobalReadOnly(int32, LangSystem);
DefineGlobal(QByteArray, LastCrashDump);
DefineGlobal(ConnectionProxy, PreLaunchProxy);
}
struct SandboxDataStruct {
uint64 LaunchId = 0;
};
SandboxDataStruct *SandboxData = 0;
namespace Sandbox {
bool started() {
return SandboxData != 0;
}
void start() {
SandboxData = new SandboxDataStruct();
memset_rand(&SandboxData->LaunchId, sizeof(SandboxData->LaunchId));
}
void finish() {
delete SandboxData;
SandboxData = 0;
}
#define DefineSandboxReadOnly(Type, Name) const Type &Name() { \
t_assert_full(SandboxData != 0, "_data is null in Global::" #Name, __FILE__, __LINE__); \
return SandboxData->Name; \
}
#define DefineSandboxRef(Type, Name) DefineSandboxReadOnly(Type, Name) \
Type &Ref##Name() { \
t_assert_full(SandboxData != 0, "_data is null in Global::Ref" #Name, __FILE__, __LINE__); \
return SandboxData->Name; \
}
#define DefineSandbox(Type, Name) DefineSandboxRef(Type, Name) \
void Set##Name(const Type &Name) { \
t_assert_full(SandboxData != 0, "_data is null in Global::Set" #Name, __FILE__, __LINE__); \
SandboxData->Name = Name; \
DefineReadOnlyVar(Sandbox, QString, LangSystemISO);
DefineReadOnlyVar(Sandbox, int32, LangSystem);
DefineVar(Sandbox, QByteArray, LastCrashDump);
DefineVar(Sandbox, ConnectionProxy, PreLaunchProxy);
}
DefineSandboxReadOnly(uint64, LaunchId);
struct GlobalDataStruct {
uint64 LaunchId = 0;
Adaptive::Layout AdaptiveLayout = Adaptive::NormalLayout;
};
GlobalDataStruct *GlobalData = 0;
namespace Global {
bool started() {
return GlobalData != 0;
}
void start() {
GlobalData = new GlobalDataStruct();
memset_rand(&GlobalData->LaunchId, sizeof(GlobalData->LaunchId));
}
void finish() {
delete GlobalData;
GlobalData = 0;
}
DefineReadOnlyVar(Global, uint64, LaunchId);
DefineVar(Global, Adaptive::Layout, AdaptiveLayout);
};

View file

@ -96,7 +96,13 @@ namespace Notify {
};
namespace Global {
#define DeclareReadOnlyVar(Type, Name) const Type &Name();
#define DeclareRefVar(Type, Name) DeclareReadOnlyVar(Type, Name) \
Type &Ref##Name();
#define DeclareVar(Type, Name) DeclareRefVar(Type, Name) \
void Set##Name(const Type &Name);
namespace Sandbox {
bool CheckBetaVersionDir();
void WorkingDirReady();
@ -104,30 +110,40 @@ namespace Global {
void start();
void finish();
#define DeclareGlobalReadOnly(Type, Name) const Type &Name();
#define DeclareGlobal(Type, Name) DeclareGlobalReadOnly(Type, Name) \
void Set##Name(const Type &Name); \
Type &Ref##Name();
DeclareGlobalReadOnly(QString, LangSystemISO);
DeclareGlobalReadOnly(int32, LangSystem);
DeclareGlobal(QByteArray, LastCrashDump);
DeclareGlobal(ConnectionProxy, PreLaunchProxy);
DeclareReadOnlyVar(QString, LangSystemISO);
DeclareReadOnlyVar(int32, LangSystem);
DeclareVar(QByteArray, LastCrashDump);
DeclareVar(ConnectionProxy, PreLaunchProxy);
}
namespace Sandbox {
namespace Adaptive {
enum Layout {
OneColumnLayout,
NormalLayout,
WideLayout,
};
};
namespace Global {
bool started();
void start();
void finish();
#define DeclareSandboxReadOnly(Type, Name) const Type &Name();
#define DeclareSandboxRef(Type, Name) DeclareSandboxReadOnly(Type, Name) \
Type &Ref##Name();
#define DeclareSandbox(Type, Name) DeclareSandboxRef(Type, Name) \
void Set##Name(const Type &Name);
DeclareSandboxReadOnly(uint64, LaunchId);
DeclareReadOnlyVar(uint64, LaunchId);
DeclareVar(Adaptive::Layout, AdaptiveLayout);
};
namespace Adaptive {
inline bool OneColumn() {
return Global::AdaptiveLayout() == OneColumnLayout;
}
inline bool Normal() {
return Global::AdaptiveLayout() == NormalLayout;
}
inline bool Wide() {
return Global::AdaptiveLayout() == WideLayout;
}
}

View file

@ -464,7 +464,7 @@ void PopupMenu::showMenu(const QPoint &p, PopupMenu *parent, PressSource source)
_parent = parent;
QPoint w = p - QPoint(0, _padding.top());
QRect r = Sandboxer::screenGeometry(p);
QRect r = Sandbox::screenGeometry(p);
if (rtl()) {
if (w.x() - width() < r.x() - _padding.left()) {
if (_parent && w.x() + _parent->width() - _padding.left() - _padding.right() + width() - _padding.right() <= r.x() + r.width()) {
@ -580,7 +580,7 @@ void PopupTooltip::popup(const QPoint &m, const QString &text, const style::Tool
_hideByLeaveTimer.setSingleShot(true);
connect(&_hideByLeaveTimer, SIGNAL(timeout()), this, SLOT(onHideByLeave()));
Sandboxer::installEventFilter(this);
Sandbox::installEventFilter(this);
}
_point = m;

View file

@ -2923,6 +2923,10 @@ void HistoryItem::setId(MsgId newId) {
id = newId;
}
bool HistoryItem::displayFromPhoto() const {
return Adaptive::Wide() || (!out() && !history()->peer->isUser() && !fromChannel());
}
void HistoryItem::clipCallback(ClipReaderNotification notification) {
HistoryMedia *media = getMedia();
if (!media) return;
@ -6209,27 +6213,27 @@ void HistoryMessage::initDimensions() {
}
void HistoryMessage::countPositionAndSize(int32 &left, int32 &width) const {
int32 mwidth = qMin(int(st::msgMaxWidth), _maxw), hwidth = _history->width;
if (_media && _media->currentWidth() < mwidth) {
mwidth = qMax(_media->currentWidth(), qMin(mwidth, plainMaxWidth()));
int32 maxwidth = qMin(int(st::msgMaxWidth), _maxw), hwidth = _history->width, hmaxwidth = st::historyMaxWidth + (Adaptive::Wide() ? (2 * st::msgPhotoSkip) : 0);
if (_media && _media->currentWidth() < maxwidth) {
maxwidth = qMax(_media->currentWidth(), qMin(maxwidth, plainMaxWidth()));
}
left = 0;
if (hwidth > st::historyMaxWidth) {
left = (hwidth - st::historyMaxWidth) / 2;
hwidth = st::historyMaxWidth;
if (hwidth > hmaxwidth) {
left = (hwidth - hmaxwidth) / 2;
hwidth = hmaxwidth;
}
left += (!fromChannel() && out()) ? st::msgMargin.right() : st::msgMargin.left();
if (displayFromPhoto()) {
left += st::msgPhotoSkip;
left += (!fromChannel() && out()) ? -st::msgPhotoSkip : st::msgPhotoSkip;
}
width = hwidth - st::msgMargin.left() - st::msgMargin.right();
if (width > mwidth) {
if (width > maxwidth) {
if (!fromChannel() && out()) {
left += width - mwidth;
left += width - maxwidth;
}
width = mwidth;
width = maxwidth;
}
}
@ -6480,7 +6484,8 @@ void HistoryMessage::draw(Painter &p, const QRect &r, uint32 selection, uint64 m
}
if (displayFromPhoto()) {
p.drawPixmap(left - st::msgPhotoSkip, _height - st::msgMargin.bottom() - st::msgPhotoSize, _from->photo->pixRounded(st::msgPhotoSize));
int32 photoleft = left + ((!fromChannel() && out()) ? (width + (st::msgPhotoSkip - st::msgPhotoSize)) : (-st::msgPhotoSkip));
p.drawPixmap(photoleft, _height - st::msgMargin.bottom() - st::msgPhotoSize, _from->photo->pixRounded(st::msgPhotoSize));
}
if (width < 1) return;
@ -6647,7 +6652,8 @@ void HistoryMessage::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32
int32 left = 0, width = 0;
countPositionAndSize(left, width);
if (displayFromPhoto()) {
if (x >= left - st::msgPhotoSkip && x < left - st::msgPhotoSkip + st::msgPhotoSize && y >= _height - st::msgMargin.bottom() - st::msgPhotoSize && y < _height - st::msgMargin.bottom()) {
int32 photoleft = left + ((!fromChannel() && out()) ? (width + (st::msgPhotoSkip - st::msgPhotoSize)) : (-st::msgPhotoSkip));
if (x >= photoleft && x < photoleft + st::msgPhotoSize && y >= _height - st::msgMargin.bottom() - st::msgPhotoSize && y < _height - st::msgMargin.bottom()) {
lnk = _from->lnk;
return;
}
@ -6911,7 +6917,8 @@ void HistoryForwarded::getState(TextLinkPtr &lnk, HistoryCursorState &state, int
int32 left = 0, width = 0;
countPositionAndSize(left, width);
if (displayFromPhoto()) {
if (x >= left - st::msgPhotoSkip && x < left - st::msgPhotoSkip + st::msgPhotoSize) {
int32 photoleft = left + ((!fromChannel() && out()) ? (width + (st::msgPhotoSkip - st::msgPhotoSize)) : (-st::msgPhotoSkip));
if (x >= photoleft && x < photoleft + st::msgPhotoSize) {
return HistoryMessage::getState(lnk, state, x, y);
}
}
@ -7230,8 +7237,9 @@ void HistoryReply::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x
if (drawBubble()) {
int32 left = 0, width = 0;
countPositionAndSize(left, width);
if (displayFromPhoto()) { // from user left photo
if (x >= left - st::msgPhotoSkip && x < left - st::msgPhotoSkip + st::msgPhotoSize) {
if (displayFromPhoto()) {
int32 photoleft = left + ((!fromChannel() && out()) ? (width + (st::msgPhotoSkip - st::msgPhotoSize)) : (-st::msgPhotoSkip));
if (x >= photoleft && x < photoleft + st::msgPhotoSize) {
return HistoryMessage::getState(lnk, state, x, y);
}
}

View file

@ -1020,9 +1020,7 @@ public:
bool hasFromName() const {
return (!out() || fromChannel()) && !history()->peer->isUser();
}
bool displayFromPhoto() const {
return !out() && !history()->peer->isUser() && !fromChannel();
}
bool displayFromPhoto() const;
void clipCallback(ClipReaderNotification notification);

View file

@ -630,7 +630,7 @@ void HistoryInner::onDragExec() {
mimeData->setText(sel);
if (!urls.isEmpty()) mimeData->setUrls(urls);
if (uponSelected && !_selected.isEmpty() && _selected.cbegin().value() == FullSelection && cWideMode()) {
if (uponSelected && !_selected.isEmpty() && _selected.cbegin().value() == FullSelection && !Adaptive::OneColumn()) {
mimeData->setData(qsl("application/x-td-forward-selected"), "1");
}
drag->setMimeData(mimeData);
@ -1987,7 +1987,7 @@ void ReportSpamPanel::resizeEvent(QResizeEvent *e) {
void ReportSpamPanel::paintEvent(QPaintEvent *e) {
Painter p(this);
p.fillRect(QRect(0, 0, width(), height() - st::lineWidth), st::reportSpamBg->b);
p.fillRect(cWideMode() ? st::lineWidth : 0, height() - st::lineWidth, width() - (cWideMode() ? st::lineWidth : 0), st::lineWidth, st::shadowColor->b);
p.fillRect(Adaptive::OneColumn() ? 0 : st::lineWidth, height() - st::lineWidth, width() - (Adaptive::OneColumn() ? 0 : st::lineWidth), st::lineWidth, st::shadowColor->b);
if (!_clear.isHidden()) {
p.setPen(st::black->p);
p.setFont(st::msgFont->f);
@ -2473,15 +2473,15 @@ void HistoryHider::mousePressEvent(QMouseEvent *e) {
void HistoryHider::startHide() {
if (hiding) return;
hiding = true;
if (cWideMode()) {
if (Adaptive::OneColumn()) {
QTimer::singleShot(0, this, SLOT(deleteLater()));
} else {
if (offered) cacheForAnim = myGrab(this, box);
if (_forwardRequest) MTP::cancel(_forwardRequest);
a_opacity.start(0);
_send.hide();
_cancel.hide();
_a_appearance.start();
} else {
QTimer::singleShot(0, this, SLOT(deleteLater()));
}
}
@ -2801,7 +2801,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
_attachDragPhoto.hide();
_topShadow.hide();
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
connect(&_attachDragDocument, SIGNAL(dropped(const QMimeData*)), this, SLOT(onDocumentDrop(const QMimeData*)));
connect(&_attachDragPhoto, SIGNAL(dropped(const QMimeData*)), this, SLOT(onPhotoDrop(const QMimeData*)));
@ -4671,7 +4671,7 @@ void HistoryWidget::step_show(float64 ms, bool timer) {
float64 dt = ms / st::slideDuration;
if (dt >= 1) {
_a_show.stop();
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
_topShadow.setVisible(_peer ? true : false);
a_coordUnder.finish();
@ -4705,14 +4705,14 @@ void HistoryWidget::doneShow() {
}
}
void HistoryWidget::updateWideMode() {
_sideShadow.setVisible(cWideMode());
void HistoryWidget::updateAdaptiveLayout() {
_sideShadow.setVisible(!Adaptive::OneColumn());
}
void HistoryWidget::animStop() {
if (!_a_show.animating()) return;
_a_show.stop();
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
_topShadow.setVisible(_peer ? true : false);
}
@ -5301,7 +5301,7 @@ void HistoryWidget::paintTopBar(QPainter &p, float64 over, int32 decreaseWidth)
if (!_history) return;
int32 increaseLeft = cWideMode() ? 0 : (st::topBarForwardPadding.right() - st::topBarForwardPadding.left());
int32 increaseLeft = Adaptive::OneColumn() ? (st::topBarForwardPadding.right() - st::topBarForwardPadding.left()) : 0;
decreaseWidth += increaseLeft;
QRect rectForName(st::topBarForwardPadding.left() + increaseLeft, st::topBarForwardPadding.top(), width() - decreaseWidth - st::topBarForwardPadding.left() - st::topBarForwardPadding.right(), st::msgNameFont->height);
p.setFont(st::dlgHistFont->f);
@ -5316,20 +5316,20 @@ void HistoryWidget::paintTopBar(QPainter &p, float64 over, int32 decreaseWidth)
p.setPen(st::dlgNameColor->p);
_peer->dialogName().drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
if (cWideMode()) {
p.setOpacity(st::topBarForwardAlpha + (1 - st::topBarForwardAlpha) * over);
p.drawPixmap(QPoint(width() - (st::topBarForwardPadding.right() + st::topBarForwardImg.pxWidth()) / 2, (st::topBarHeight - st::topBarForwardImg.pxHeight()) / 2), App::sprite(), st::topBarForwardImg);
} else {
if (Adaptive::OneColumn()) {
p.setOpacity(st::topBarForwardAlpha + (1 - st::topBarForwardAlpha) * over);
p.drawPixmap(QPoint((st::topBarForwardPadding.right() - st::topBarBackwardImg.pxWidth()) / 2, (st::topBarHeight - st::topBarBackwardImg.pxHeight()) / 2), App::sprite(), st::topBarBackwardImg);
} else {
p.setOpacity(st::topBarForwardAlpha + (1 - st::topBarForwardAlpha) * over);
p.drawPixmap(QPoint(width() - (st::topBarForwardPadding.right() + st::topBarForwardImg.pxWidth()) / 2, (st::topBarHeight - st::topBarForwardImg.pxHeight()) / 2), App::sprite(), st::topBarForwardImg);
}
}
void HistoryWidget::topBarClick() {
if (cWideMode()) {
if (_history) App::main()->showPeerProfile(_peer);
} else {
if (Adaptive::OneColumn()) {
Ui::showChatsList();
} else {
if (_history) App::main()->showPeerProfile(_peer);
}
}
@ -5973,8 +5973,8 @@ void HistoryWidget::resizeEvent(QResizeEvent *e) {
break;
}
_topShadow.resize(width() - ((cWideMode() && !_inGrab) ? st::lineWidth : 0), st::lineWidth);
_topShadow.moveToLeft((cWideMode() && !_inGrab) ? st::lineWidth : 0, 0);
_topShadow.resize(width() - ((!Adaptive::OneColumn() && !_inGrab) ? st::lineWidth : 0), st::lineWidth);
_topShadow.moveToLeft((!Adaptive::OneColumn() && !_inGrab) ? st::lineWidth : 0, 0);
_sideShadow.resize(st::lineWidth, height());
_sideShadow.moveToLeft(0, 0);
}

View file

@ -486,7 +486,7 @@ public:
void step_show(float64 ms, bool timer);
void animStop();
void updateWideMode();
void updateAdaptiveLayout();
void doneShow();
QPoint clampMousePosition(QPoint point);
@ -562,7 +562,7 @@ public:
resizeEvent(0);
}
void grabFinish() {
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
_inGrab = false;
resizeEvent(0);
}

View file

@ -46,9 +46,9 @@ namespace {
countryForReg = nearest.vcountry.c_string().v.c_str();
emit signalEmitOn->countryChanged();
}
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
Sandboxer::startUpdateCheck();
#endif
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
Sandbox::startUpdateCheck();
#endif
}
}
@ -425,8 +425,7 @@ void IntroWidget::keyPressEvent(QKeyEvent *e) {
}
}
void IntroWidget::updateWideMode() {
void IntroWidget::updateAdaptiveLayout() {
}
void IntroWidget::rpcInvalidate() {

View file

@ -40,13 +40,13 @@ public:
void resizeEvent(QResizeEvent *e);
void mousePressEvent(QMouseEvent *e);
void keyPressEvent(QKeyEvent *e);
void updateWideMode();
void updateAdaptiveLayout();
void animShow(const QPixmap &bgAnimCache, bool back = false);
void step_show(float64 ms, bool timer);
void stop_show();
void step_stage(float64 ms, bool timer);
QRect innerRect() const;
@ -150,7 +150,7 @@ public:
}
protected:
IntroWidget *intro() {
return qobject_cast<IntroWidget*>(parent());
}

View file

@ -230,7 +230,7 @@ void IntroPhone::phoneCheckDone(const MTPauth_CheckedPhone &result) {
checkRequest.start(1000);
sentRequest = MTP::send(MTPauth_SendCode(MTP_string(sentPhone), MTP_int(5), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Global::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail));
sentRequest = MTP::send(MTPauth_SendCode(MTP_string(sentPhone), MTP_int(5), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Sandbox::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail));
} else {
showError(lang(lng_bad_phone_noreg), true);
enableAll(true);
@ -260,7 +260,7 @@ void IntroPhone::toSignUp() {
checkRequest.start(1000);
sentRequest = MTP::send(MTPauth_SendCode(MTP_string(sentPhone), MTP_int(0), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Global::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail));
sentRequest = MTP::send(MTPauth_SendCode(MTP_string(sentPhone), MTP_int(0), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Sandbox::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail));
}
bool IntroPhone::phoneSubmitFail(const RPCError &error) {

View file

@ -36,7 +36,7 @@ _next(this, lang(lng_start_msgs), st::btnIntroNext) {
_changeLang.hide();
if (cLang() == languageDefault) {
int32 l = Global::LangSystem();
int32 l = Sandbox::LangSystem();
if (l != languageDefault) {
LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[l] + qsl(".strings"), LangLoaderRequest(lng_switch_to_this));
QString text = loader.found().value(lng_switch_to_this);

View file

@ -125,8 +125,7 @@ void BackgroundWidget::resizeEvent(QResizeEvent *e) {
w->parentResized();
}
void BackgroundWidget::updateWideMode() {
void BackgroundWidget::updateAdaptiveLayout() {
}
void BackgroundWidget::replaceInner(LayeredWidget *n) {

View file

@ -71,7 +71,7 @@ public:
void mousePressEvent(QMouseEvent *e);
void resizeEvent(QResizeEvent *e);
void updateWideMode();
void updateAdaptiveLayout();
void replaceInner(LayeredWidget *n);
void showLayerLast(LayeredWidget *n);

View file

@ -295,7 +295,7 @@ namespace Logs {
Initializer::Initializer() {
t_assert(LogsData == 0);
if (!Global::CheckBetaVersionDir()) {
if (!Sandbox::CheckBetaVersionDir()) {
return;
}
bool workingDirChosen = cBetaVersion();
@ -336,7 +336,7 @@ namespace Logs {
QDir().setCurrent(cWorkingDir());
QDir().mkpath(cWorkingDir() + qstr("tdata"));
Global::WorkingDirReady();
Sandbox::WorkingDirReady();
SignalHandlers::StartBreakpad();
if (!LogsData->openMain()) {
@ -940,7 +940,7 @@ namespace SignalHandlers {
}
fclose(f);
Global::SetLastCrashDump(lastdump);
Sandbox::SetLastCrashDump(lastdump);
LOG(("Opened '%1' for reading, the previous Telegram Desktop launch was not finished properly :( Crash log size: %2").arg(QString::fromUtf8(CrashDumpPath)).arg(lastdump.size()));

View file

@ -282,7 +282,7 @@ void TopBarWidget::startAnim() {
void TopBarWidget::stopAnim() {
_animating = false;
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
showAll();
}
@ -346,13 +346,13 @@ void TopBarWidget::showAll() {
_mediaType.hide();
}
}
if (App::main() && App::main()->historyPeer() && !o && !p && _clearSelection.isHidden() && !cWideMode()) {
if (App::main() && App::main()->historyPeer() && !o && !p && _clearSelection.isHidden() && Adaptive::OneColumn()) {
_info.show();
} else {
_info.hide();
}
}
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
resizeEvent(0);
}
@ -367,7 +367,7 @@ void TopBarWidget::showSelected(uint32 selCount, bool canDelete) {
showAll();
}
void TopBarWidget::updateWideMode() {
void TopBarWidget::updateAdaptiveLayout() {
showAll();
}
@ -453,10 +453,10 @@ MainWidget::MainWidget(Window *window) : TWidget(window)
connect(&_cacheBackgroundTimer, SIGNAL(timeout()), this, SLOT(onCacheBackground()));
dialogs.show();
if (cWideMode()) {
history.show();
} else {
if (Adaptive::OneColumn()) {
history.hide();
} else {
history.show();
}
App::wnd()->getTitle()->updateBackButton();
_topBar.hide();
@ -715,7 +715,7 @@ QPixmap MainWidget::grabInner() {
return myGrab(overview);
} else if (profile && !profile->isHidden()) {
return myGrab(profile);
} else if (!cWideMode() && history.isHidden()) {
} else if (Adaptive::OneColumn() && history.isHidden()) {
return myGrab(&dialogs, QRect(0, st::topBarHeight, dialogs.width(), dialogs.height() - st::topBarHeight));
} else if (history.peer()) {
return myGrab(&history);
@ -734,7 +734,7 @@ bool MainWidget::isItemVisible(HistoryItem *item) {
QPixmap MainWidget::grabTopBar() {
if (!_topBar.isHidden()) {
return myGrab(&_topBar);
} else if (!cWideMode() && history.isHidden()) {
} else if (Adaptive::OneColumn() && history.isHidden()) {
return myGrab(&dialogs, QRect(0, 0, dialogs.width(), st::topBarHeight));
} else {
return myGrab(&history, QRect(0, 0, history.width(), st::topBarHeight));
@ -838,12 +838,7 @@ void MainWidget::notify_historyItemResized(const HistoryItem *item, bool scrollT
void MainWidget::noHider(HistoryHider *destroyed) {
if (_hider == destroyed) {
_hider = 0;
if (cWideMode()) {
if (_forwardConfirm) {
_forwardConfirm->deleteLater();
_forwardConfirm = 0;
}
} else {
if (Adaptive::OneColumn()) {
if (_forwardConfirm) {
_forwardConfirm->startHide();
_forwardConfirm = 0;
@ -864,6 +859,11 @@ void MainWidget::noHider(HistoryHider *destroyed) {
}
}
App::wnd()->getTitle()->updateBackButton();
} else {
if (_forwardConfirm) {
_forwardConfirm->deleteLater();
_forwardConfirm = 0;
}
}
}
}
@ -876,11 +876,7 @@ void MainWidget::hiderLayer(HistoryHider *h) {
_hider = h;
connect(_hider, SIGNAL(forwarded()), &dialogs, SLOT(onCancelSearch()));
if (cWideMode()) {
_hider->show();
resizeEvent(0);
dialogs.activate();
} else {
if (Adaptive::OneColumn()) {
dialogsToUp();
_hider->hide();
@ -898,6 +894,10 @@ void MainWidget::hiderLayer(HistoryHider *h) {
resizeEvent(0);
dialogs.animShow(animCache);
App::wnd()->getTitle()->updateBackButton();
} else {
_hider->show();
resizeEvent(0);
dialogs.activate();
}
}
@ -937,7 +937,7 @@ bool MainWidget::selectingPeer(bool withConfirm) {
void MainWidget::offerPeer(PeerId peer) {
Ui::hideLayer();
if (_hider->offerPeer(peer) && !cWideMode()) {
if (_hider->offerPeer(peer) && Adaptive::OneColumn()) {
_forwardConfirm = new ConfirmBox(_hider->offeredText(), lang(lng_forward_send));
connect(_forwardConfirm, SIGNAL(confirmed()), _hider, SLOT(forward()));
connect(_forwardConfirm, SIGNAL(cancelled()), this, SLOT(onForwardCancel()));
@ -1402,7 +1402,7 @@ bool MainWidget::insertBotCommand(const QString &cmd, bool specialGif) {
void MainWidget::searchMessages(const QString &query, PeerData *inPeer) {
App::wnd()->hideMediaview();
dialogs.searchMessages(query, inPeer);
if (!cWideMode()) {
if (Adaptive::OneColumn()) {
Ui::showChatsList();
} else {
dialogs.activate();
@ -2286,15 +2286,15 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool bac
}
QPixmap animCache, animTopBarCache;
if (!_a_show.animating() && ((history.isHidden() && (profile || overview)) || (!cWideMode() && (history.isHidden() || !peerId)))) {
if (!_a_show.animating() && ((history.isHidden() && (profile || overview)) || (Adaptive::OneColumn() && (history.isHidden() || !peerId)))) {
if (peerId) {
animCache = grabInner();
} else if (cWideMode()) {
animCache = myGrab(this, QRect(_dialogsWidth, _playerHeight, width() - _dialogsWidth, height() - _playerHeight));
} else {
} else if (Adaptive::OneColumn()) {
animCache = myGrab(this, QRect(0, _playerHeight, _dialogsWidth, height() - _playerHeight));
} else {
animCache = myGrab(this, QRect(_dialogsWidth, _playerHeight, width() - _dialogsWidth, height() - _playerHeight));
}
if (peerId || cWideMode()) {
if (peerId || !Adaptive::OneColumn()) {
animTopBarCache = grabTopBar();
}
history.show();
@ -2302,7 +2302,7 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool bac
if (history.peer() && history.peer()->id != peerId) clearBotStartToken(history.peer());
history.showHistory(peerId, showAtMsgId);
bool noPeer = (!history.peer() || !history.peer()->id), onlyDialogs = noPeer && !cWideMode();
bool noPeer = (!history.peer() || !history.peer()->id), onlyDialogs = noPeer && Adaptive::OneColumn();
if (profile || overview) {
if (profile) {
profile->hide();
@ -2343,7 +2343,7 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool bac
}
_viewsIncremented.remove(activePeer());
}
if (!cWideMode() && !dialogs.isHidden()) dialogs.hide();
if (Adaptive::OneColumn() && !dialogs.isHidden()) dialogs.hide();
if (!_a_show.animating()) {
if (history.isHidden()) history.show();
if (!animCache.isNull()) {
@ -2437,7 +2437,7 @@ void MainWidget::showMediaOverview(PeerData *peer, MediaOverviewType type, bool
QRect topBarRect = QRect(_topBar.x(), _topBar.y(), _topBar.width(), st::topBarHeight);
QRect historyRect = QRect(history.x(), topBarRect.y() + topBarRect.height(), history.width(), history.y() + history.height() - topBarRect.y() - topBarRect.height());
QPixmap animCache, animTopBarCache;
if (!_a_show.animating() && (!cWideMode() || profile || overview || history.peer())) {
if (!_a_show.animating() && (Adaptive::OneColumn() || profile || overview || history.peer())) {
animCache = grabInner();
animTopBarCache = grabTopBar();
}
@ -2481,7 +2481,7 @@ void MainWidget::showMediaOverview(PeerData *peer, MediaOverviewType type, bool
if (back) clearBotStartToken(history.peer());
history.showHistory(0, 0);
history.hide();
if (!cWideMode()) dialogs.hide();
if (Adaptive::OneColumn()) dialogs.hide();
orderWidgets();
@ -2531,7 +2531,7 @@ void MainWidget::showPeerProfile(PeerData *peer, bool back, int32 lastScrollTop)
if (back) clearBotStartToken(history.peer());
history.showHistory(0, 0);
history.hide();
if (!cWideMode()) dialogs.hide();
if (Adaptive::OneColumn()) dialogs.hide();
orderWidgets();
@ -2728,27 +2728,7 @@ void MainWidget::showAll() {
cSetPasswordRecovered(false);
Ui::showLayer(new InformBox(lang(lng_signin_password_removed)));
}
if (cWideMode()) {
if (_hider) {
_hider->show();
if (_forwardConfirm) {
Ui::hideLayer(true);
_forwardConfirm = 0;
}
}
dialogs.show();
if (overview) {
overview->show();
} else if (profile) {
profile->show();
} else {
history.show();
history.resizeEvent(0);
}
if (profile || overview || history.peer()) {
_topBar.show();
}
} else {
if (Adaptive::OneColumn()) {
if (_hider) {
_hider->hide();
if (!_forwardConfirm && _hider->wasOffered()) {
@ -2779,6 +2759,26 @@ void MainWidget::showAll() {
_topBar.show();
dialogs.hide();
}
} else {
if (_hider) {
_hider->show();
if (_forwardConfirm) {
Ui::hideLayer(true);
_forwardConfirm = 0;
}
}
dialogs.show();
if (overview) {
overview->show();
} else if (profile) {
profile->show();
} else {
history.show();
history.resizeEvent(0);
}
if (profile || overview || history.peer()) {
_topBar.show();
}
}
if (audioPlayer()) {
SongMsgId playing;
@ -2802,7 +2802,14 @@ void MainWidget::showAll() {
void MainWidget::resizeEvent(QResizeEvent *e) {
int32 tbh = _topBar.isHidden() ? 0 : st::topBarHeight;
if (cWideMode()) {
if (Adaptive::OneColumn()) {
_dialogsWidth = width();
_player.setGeometry(0, 0, _dialogsWidth, _player.height());
dialogs.setGeometry(0, _playerHeight, _dialogsWidth, height() - _playerHeight);
_topBar.setGeometry(0, _playerHeight, _dialogsWidth, st::topBarHeight);
history.setGeometry(0, _playerHeight + tbh, _dialogsWidth, height() - _playerHeight - tbh);
if (_hider) _hider->setGeometry(0, 0, _dialogsWidth, height());
} else {
_dialogsWidth = snap<int>((width() * 5) / 14, st::dlgMinWidth, st::dlgMaxWidth);
dialogs.resize(_dialogsWidth, height());
dialogs.moveToLeft(0, 0);
@ -2816,13 +2823,6 @@ void MainWidget::resizeEvent(QResizeEvent *e) {
_hider->resize(width() - _dialogsWidth, height());
_hider->moveToLeft(_dialogsWidth, 0);
}
} else {
_dialogsWidth = width();
_player.setGeometry(0, 0, _dialogsWidth, _player.height());
dialogs.setGeometry(0, _playerHeight, _dialogsWidth, height() - _playerHeight);
_topBar.setGeometry(0, _playerHeight, _dialogsWidth, st::topBarHeight);
history.setGeometry(0, _playerHeight + tbh, _dialogsWidth, height() - _playerHeight - tbh);
if (_hider) _hider->setGeometry(0, 0, _dialogsWidth, height());
}
_mediaType.moveToLeft(width() - _mediaType.width(), _playerHeight + st::topBarHeight);
if (profile) profile->setGeometry(history.geometry());
@ -2838,13 +2838,13 @@ int32 MainWidget::contentScrollAddToY() const {
void MainWidget::keyPressEvent(QKeyEvent *e) {
}
void MainWidget::updateWideMode() {
void MainWidget::updateAdaptiveLayout() {
showAll();
_topBar.updateWideMode();
history.updateWideMode();
if (overview) overview->updateWideMode();
if (profile) profile->updateWideMode();
_player.updateWideMode();
_topBar.updateAdaptiveLayout();
history.updateAdaptiveLayout();
if (overview) overview->updateAdaptiveLayout();
if (profile) profile->updateAdaptiveLayout();
_player.updateAdaptiveLayout();
}
bool MainWidget::needBackButton() {
@ -2910,7 +2910,7 @@ void MainWidget::onTopBarClick() {
}
void MainWidget::onHistoryShown(History *history, MsgId atMsgId) {
if ((cWideMode() || !selectingPeer()) && (profile || overview || history)) {
if ((!Adaptive::OneColumn() || !selectingPeer()) && (profile || overview || history)) {
_topBar.show();
} else {
_topBar.hide();
@ -2925,11 +2925,11 @@ void MainWidget::onHistoryShown(History *history, MsgId atMsgId) {
void MainWidget::searchInPeer(PeerData *peer) {
dialogs.searchInPeer(peer);
if (cWideMode()) {
dialogs.activate();
} else {
if (Adaptive::OneColumn()) {
dialogsToUp();
Ui::showChatsList();
} else {
dialogs.activate();
}
}
@ -3458,9 +3458,9 @@ void MainWidget::start(const MTPUser &user) {
cSetOtherOnline(0);
App::feedUsers(MTP_vector<MTPUser>(1, user));
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
Sandboxer::startUpdateCheck();
#endif
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
Sandbox::startUpdateCheck();
#endif
MTP::send(MTPupdates_GetState(), rpcDone(&MainWidget::gotState));
update();
if (!cStartUrl().isEmpty()) {

View file

@ -55,7 +55,7 @@ public:
void showAll();
void showSelected(uint32 selCount, bool canDelete = false);
void updateWideMode();
void updateAdaptiveLayout();
FlatButton *mediaTypeButton();
@ -63,7 +63,7 @@ public:
_sideShadow.hide();
}
void grabFinish() {
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
}
public slots:
@ -192,7 +192,7 @@ public:
void resizeEvent(QResizeEvent *e);
void keyPressEvent(QKeyEvent *e);
void updateWideMode();
void updateAdaptiveLayout();
bool needBackButton();
void paintTopBar(QPainter &p, float64 over, int32 decreaseWidth);

View file

@ -179,7 +179,7 @@ void MediaView::moveToScreen() {
}
QPoint wndCenter(App::wnd()->x() + App::wnd()->width() / 2, App::wnd()->y() + App::wnd()->height() / 2);
QRect avail = Sandboxer::screenGeometry(wndCenter);
QRect avail = Sandbox::screenGeometry(wndCenter);
if (avail != geometry()) {
setGeometry(avail);
}
@ -586,7 +586,7 @@ void MediaView::onSaveAs() {
}
}
activateWindow();
Sandboxer::setActiveWindow(this);
Sandbox::setActiveWindow(this);
setFocus();
}
@ -1074,7 +1074,7 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty
show();
psShowOverAll(this);
activateWindow();
Sandboxer::setActiveWindow(this);
Sandbox::setActiveWindow(this);
setFocus();
}
}
@ -1990,7 +1990,7 @@ void MediaView::onCheckActive() {
if (App::wnd() && isVisible()) {
if (App::wnd()->isActiveWindow() && App::wnd()->hasFocus()) {
activateWindow();
Sandboxer::setActiveWindow(this);
Sandbox::setActiveWindow(this);
setFocus();
}
}

View file

@ -623,7 +623,7 @@ void OverviewInner::onDragExec() {
QList<QUrl> urls;
bool forwardSelected = false;
if (uponSelected) {
forwardSelected = !_selected.isEmpty() && _selected.cbegin().value() == FullSelection && cWideMode();
forwardSelected = !_selected.isEmpty() && _selected.cbegin().value() == FullSelection && !Adaptive::OneColumn();
} else if (textlnkDown()) {
sel = textlnkDown()->encoded();
if (!sel.isEmpty() && sel.at(0) != '/' && sel.at(0) != '@' && sel.at(0) != '#') {
@ -2007,7 +2007,7 @@ OverviewWidget::OverviewWidget(QWidget *parent, PeerData *peer, MediaOverviewTyp
_scroll.move(0, 0);
_inner.move(0, 0);
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
updateScrollColors();
@ -2058,8 +2058,8 @@ void OverviewWidget::resizeEvent(QResizeEvent *e) {
}
_noDropResizeIndex = false;
_topShadow.resize(width() - ((cWideMode() && !_inGrab) ? st::lineWidth : 0), st::lineWidth);
_topShadow.moveToLeft((cWideMode() && !_inGrab) ? st::lineWidth : 0, 0);
_topShadow.resize(width() - ((!Adaptive::OneColumn() && !_inGrab) ? st::lineWidth : 0), st::lineWidth);
_topShadow.moveToLeft((!Adaptive::OneColumn() && !_inGrab) ? st::lineWidth : 0, 0);
_sideShadow.resize(st::lineWidth, height());
_sideShadow.moveToLeft(0, 0);
}
@ -2240,7 +2240,7 @@ void OverviewWidget::step_show(float64 ms, bool timer) {
float64 dt = ms / st::slideDuration;
if (dt >= 1) {
_a_show.stop();
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
_topShadow.show();
a_coordUnder.finish();
@ -2263,8 +2263,8 @@ void OverviewWidget::step_show(float64 ms, bool timer) {
}
}
void OverviewWidget::updateWideMode() {
_sideShadow.setVisible(cWideMode());
void OverviewWidget::updateAdaptiveLayout() {
_sideShadow.setVisible(!Adaptive::OneColumn());
}
void OverviewWidget::doneShow() {

View file

@ -271,7 +271,7 @@ public:
void animShow(const QPixmap &oldAnimCache, const QPixmap &bgAnimTopBarCache, bool back = false, int32 lastScrollTop = -1);
void step_show(float64 ms, bool timer);
void updateWideMode();
void updateAdaptiveLayout();
void doneShow();
void mediaOverviewUpdated(PeerData *peer, MediaOverviewType type);
@ -297,7 +297,7 @@ public:
resizeEvent(0);
}
void grabFinish() {
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
_inGrab = false;
resizeEvent(0);
}

View file

@ -59,7 +59,7 @@ PlayerWidget::PlayerWidget(QWidget *parent) : TWidget(parent)
resize(st::wndMinWidth, st::playerHeight);
setMouseTracking(true);
memset(_stateHovers, 0, sizeof(_stateHovers));
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
}
void PlayerWidget::paintEvent(QPaintEvent *e) {
@ -364,8 +364,8 @@ void PlayerWidget::mediaOverviewUpdated(PeerData *peer, MediaOverviewType type)
}
}
void PlayerWidget::updateWideMode() {
_sideShadow.setVisible(cWideMode());
void PlayerWidget::updateAdaptiveLayout() {
_sideShadow.setVisible(!Adaptive::OneColumn());
}
bool PlayerWidget::seekingSong(const SongMsgId &song) const {
@ -551,7 +551,7 @@ void PlayerWidget::stopPressed() {
void PlayerWidget::resizeEvent(QResizeEvent *e) {
int32 availh = (height() - st::playerLineHeight);
int32 ch = st::playerPlay.pxHeight() + st::playerSkip, ct = (availh - ch) / 2;
_playbackRect = QRect(cWideMode() ? st::lineWidth : 0, height() - st::playerMoverSize.height(), width() - (cWideMode() ? st::lineWidth : 0), st::playerMoverSize.height());
_playbackRect = QRect(Adaptive::OneColumn() ? 0 : st::lineWidth, height() - st::playerMoverSize.height(), width() - (Adaptive::OneColumn() ? 0 : st::lineWidth), st::playerMoverSize.height());
_prevRect = _fullAvailable ? QRect(st::playerSkip / 2, ct, st::playerPrev.pxWidth() + st::playerSkip, ch) : QRect();
_playRect = QRect(_fullAvailable ? (_prevRect.x() + _prevRect.width()) : (st::playerSkip / 2), ct, st::playerPlay.pxWidth() + st::playerSkip, ch);
_nextRect = _fullAvailable ? QRect(_playRect.x() + _playRect.width(), ct, st::playerNext.pxWidth() + st::playerSkip, ch) : QRect();

View file

@ -51,7 +51,7 @@ public:
void clearSelection();
void mediaOverviewUpdated(PeerData *peer, MediaOverviewType type);
void updateWideMode();
void updateAdaptiveLayout();
bool seekingSong(const SongMsgId &song) const;

View file

@ -1731,7 +1731,7 @@ ProfileWidget::ProfileWidget(QWidget *parent, PeerData *peer) : TWidget(parent)
_inner.move(0, 0);
_scroll.show();
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSelected()));
connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
@ -1763,8 +1763,8 @@ void ProfileWidget::resizeEvent(QResizeEvent *e) {
}
}
_topShadow.resize(width() - ((cWideMode() && !_inGrab) ? st::lineWidth : 0), st::lineWidth);
_topShadow.moveToLeft((cWideMode() && !_inGrab) ? st::lineWidth : 0, 0);
_topShadow.resize(width() - ((!Adaptive::OneColumn() && !_inGrab) ? st::lineWidth : 0), st::lineWidth);
_topShadow.moveToLeft((!Adaptive::OneColumn() && !_inGrab) ? st::lineWidth : 0, 0);
_sideShadow.resize(st::lineWidth, height());
_sideShadow.moveToLeft(0, 0);
}
@ -1862,7 +1862,7 @@ void ProfileWidget::step_show(float64 ms, bool timer) {
float64 dt = ms / st::slideDuration;
if (dt >= 1) {
_a_show.stop();
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
_topShadow.show();
a_coordUnder.finish();
@ -1914,8 +1914,8 @@ void ProfileWidget::mediaOverviewUpdated(PeerData *peer, MediaOverviewType type)
}
}
void ProfileWidget::updateWideMode() {
_sideShadow.setVisible(cWideMode());
void ProfileWidget::updateAdaptiveLayout() {
_sideShadow.setVisible(!Adaptive::OneColumn());
}
void ProfileWidget::clear() {

View file

@ -245,7 +245,7 @@ public:
void updateNotifySettings();
void mediaOverviewUpdated(PeerData *peer, MediaOverviewType type);
void updateWideMode();
void updateAdaptiveLayout();
void grabStart() {
_sideShadow.hide();
@ -253,7 +253,7 @@ public:
resizeEvent(0);
}
void grabFinish() {
_sideShadow.setVisible(cWideMode());
_sideShadow.setVisible(!Adaptive::OneColumn());
_inGrab = false;
resizeEvent(0);
}

View file

@ -211,7 +211,7 @@ public:
NSNumber *instObj = [[notification userInfo] objectForKey:@"launch"];
unsigned long long instLong = instObj ? [instObj unsignedLongLongValue] : 0;
DEBUG_LOG(("Received notification with instance %1").arg(instLong));
if (instLong != Sandbox::LaunchId()) { // other app instance notification
if (instLong != Global::LaunchId()) { // other app instance notification
return;
}
if (notification.activationType == NSUserNotificationActivationTypeReplied) {
@ -283,8 +283,8 @@ void PsMacWindowPrivate::showNotify(uint64 peer, int32 msgId, const QPixmap &pix
NSUserNotification *notification = [[NSUserNotification alloc] init];
NSImage *img = qt_mac_create_nsimage(pix);
DEBUG_LOG(("Sending notification with userinfo: peer %1, msgId %2 and instance %3").arg(peer).arg(msgId).arg(Sandbox::LaunchId()));
[notification setUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedLongLong:peer],@"peer",[NSNumber numberWithInt:msgId],@"msgid",[NSNumber numberWithUnsignedLongLong:Sandbox::LaunchId()],@"launch",nil]];
DEBUG_LOG(("Sending notification with userinfo: peer %1, msgId %2 and instance %3").arg(peer).arg(msgId).arg(Global::LaunchId()));
[notification setUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedLongLong:peer],@"peer",[NSNumber numberWithInt:msgId],@"msgid",[NSNumber numberWithUnsignedLongLong:Global::LaunchId()],@"launch",nil]];
[notification setTitle:QNSString(title).s()];
[notification setSubtitle:QNSString(subtitle).s()];
@ -352,7 +352,7 @@ void PsMacWindowPrivate::clearNotifies(unsigned long long peer) {
NSArray *notifies = [center deliveredNotifications];
for (id notify in notifies) {
NSDictionary *dict = [notify userInfo];
if ([[dict objectForKey:@"peer"] unsignedLongLongValue] == peer && [[dict objectForKey:@"launch"] unsignedLongLongValue] == Sandbox::LaunchId()) {
if ([[dict objectForKey:@"peer"] unsignedLongLongValue] == peer && [[dict objectForKey:@"launch"] unsignedLongLongValue] == Global::LaunchId()) {
[center removeDeliveredNotification:notify];
}
}

View file

@ -271,7 +271,7 @@ namespace {
return false;
}
QRect avail(Sandboxer::availableGeometry());
QRect avail(Sandbox::availableGeometry());
max_w = avail.width();
if (max_w < st::wndMinWidth) max_w = st::wndMinWidth;
max_h = avail.height();
@ -1194,7 +1194,7 @@ void PsMainWindow::psInitSize() {
setMinimumHeight(st::wndMinHeight);
TWindowPos pos(cWindowPos());
QRect avail(Sandboxer::availableGeometry());
QRect avail(Sandbox::availableGeometry());
bool maximized = false;
QRect geom(avail.x() + (avail.width() - st::wndDefWidth) / 2, avail.y() + (avail.height() - st::wndDefHeight) / 2, st::wndDefWidth, st::wndDefHeight);
if (pos.w && pos.h) {

View file

@ -155,8 +155,6 @@ bool gIsElCapitan = false;
bool gContactsReceived = false;
bool gDialogsReceived = false;
bool gWideMode = true;
int gOnlineUpdatePeriod = 120000;
int gOfflineBlurTimeout = 5000;
int gOfflineIdleTimeout = 30000;

View file

@ -324,8 +324,6 @@ DeclareReadSetting(QUrl, UpdateURL);
DeclareSetting(bool, ContactsReceived);
DeclareSetting(bool, DialogsReceived);
DeclareSetting(bool, WideMode);
DeclareSetting(int, OnlineUpdatePeriod);
DeclareSetting(int, OfflineBlurTimeout);
DeclareSetting(int, OfflineIdleTimeout);

View file

@ -221,7 +221,7 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent)
connect(App::main(), SIGNAL(peerPhotoChanged(PeerData *)), this, SLOT(peerUpdated(PeerData *)));
connect(App::main(), SIGNAL(peerNameChanged(PeerData *, const PeerData::Names &, const PeerData::NameFirstChars &)), this, SLOT(peerUpdated(PeerData *)));
Sandboxer::connect(SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onReloadPassword(Qt::ApplicationState)));
Sandbox::connect(SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onReloadPassword(Qt::ApplicationState)));
}
// profile
@ -269,11 +269,11 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent)
_newVersionWidth = st::linkFont->width(_newVersionText);
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
Sandboxer::connect(SIGNAL(updateChecking()), this, SLOT(onUpdateChecking()));
Sandboxer::connect(SIGNAL(updateLatest()), this, SLOT(onUpdateLatest()));
Sandboxer::connect(SIGNAL(updateProgress(qint64,qint64)), this, SLOT(onUpdateDownloading(qint64,qint64)));
Sandboxer::connect(SIGNAL(updateFailed()), this, SLOT(onUpdateFailed()));
Sandboxer::connect(SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
Sandbox::connect(SIGNAL(updateChecking()), this, SLOT(onUpdateChecking()));
Sandbox::connect(SIGNAL(updateLatest()), this, SLOT(onUpdateLatest()));
Sandbox::connect(SIGNAL(updateProgress(qint64,qint64)), this, SLOT(onUpdateDownloading(qint64,qint64)));
Sandbox::connect(SIGNAL(updateFailed()), this, SLOT(onUpdateFailed()));
Sandbox::connect(SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
#endif
// chat options
@ -330,10 +330,10 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent)
updateOnlineDisplay();
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
switch (Sandboxer::updatingState()) {
switch (Sandbox::updatingState()) {
case Application::UpdatingDownload:
setUpdatingState(UpdatingDownload, true);
setDownloadProgress(Sandboxer::updatingReady(), Sandboxer::updatingSize());
setDownloadProgress(Sandbox::updatingReady(), Sandbox::updatingSize());
break;
case Application::UpdatingReady: setUpdatingState(UpdatingReady, true); break;
default: setUpdatingState(UpdatingNone, true); break;
@ -1261,14 +1261,14 @@ void SettingsInner::onAutoUpdate() {
Local::writeSettings();
resizeEvent(0);
if (cAutoUpdate()) {
Sandboxer::startUpdateCheck();
Sandbox::startUpdateCheck();
if (_updatingState == UpdatingNone) {
_checkNow.show();
} else if (_updatingState == UpdatingReady) {
_restartNow.show();
}
} else {
Sandboxer::stopUpdate();
Sandbox::stopUpdate();
_restartNow.hide();
_checkNow.hide();
}
@ -1279,7 +1279,7 @@ void SettingsInner::onCheckNow() {
if (!cAutoUpdate()) return;
cSetLastUpdateCheck(0);
Sandboxer::startUpdateCheck();
Sandbox::startUpdateCheck();
}
#endif
@ -1867,10 +1867,10 @@ void SettingsWidget::showAll() {
_scroll.show();
_inner.show();
_inner.showAll();
if (cWideMode()) {
_close.show();
} else {
if (Adaptive::OneColumn()) {
_close.hide();
} else {
_close.show();
}
}
@ -1892,11 +1892,11 @@ void SettingsWidget::dragEnterEvent(QDragEnterEvent *e) {
void SettingsWidget::dropEvent(QDropEvent *e) {
}
void SettingsWidget::updateWideMode() {
if (cWideMode()) {
_close.show();
} else {
void SettingsWidget::updateAdaptiveLayout() {
if (Adaptive::OneColumn()) {
_close.hide();
} else {
_close.show();
}
}

View file

@ -316,7 +316,7 @@ public:
void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
void updateWideMode();
void updateAdaptiveLayout();
void animShow(const QPixmap &bgAnimCache, bool back = false);
void step_show(float64 ms, bool timer);

View file

@ -150,7 +150,7 @@ UpdateBtn::UpdateBtn(QWidget *parent, Window *window, const QString &text) : Sys
void UpdateBtn::onClick() {
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
checkReadyUpdate();
if (Sandboxer::updatingState() == Application::UpdatingReady) {
if (Sandbox::updatingState() == Application::UpdatingReady) {
cSetRestartingUpdate(true);
} else
#endif

View file

@ -75,7 +75,7 @@ TitleWidget::TitleWidget(Window *window) : TWidget(window)
_back.hide();
if (
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
Sandboxer::updatingState() == Application::UpdatingReady ||
Sandbox::updatingState() == Application::UpdatingReady ||
#endif
cHasPasscode()
) {
@ -91,7 +91,7 @@ TitleWidget::TitleWidget(Window *window) : TWidget(window)
connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState)));
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
Sandboxer::connect(SIGNAL(updateReady()), this, SLOT(showUpdateBtn()));
Sandbox::connect(SIGNAL(updateReady()), this, SLOT(showUpdateBtn()));
#endif
if (cPlatform() != dbipWindows) {
@ -111,7 +111,7 @@ void TitleWidget::paintEvent(QPaintEvent *e) {
p.drawText(st::titleMenuOffset - st::titleTextButton.width / 2, st::titleTextButton.textTop + st::titleTextButton.font->ascent, lang(lng_forward_choose));
}
p.drawPixmap(st::titleIconPos, App::sprite(), st::titleIconImg);
if (!cWideMode() && !_counter.isNull() && App::main()) {
if (Adaptive::OneColumn() && !_counter.isNull() && App::main()) {
p.drawPixmap(st::titleIconPos.x() + st::titleIconImg.pxWidth() - (_counter.width() / cIntRetinaFactor()), st::titleIconPos.y() + st::titleIconImg.pxHeight() - (_counter.height() / cIntRetinaFactor()), _counter);
}
}
@ -130,10 +130,10 @@ void TitleWidget::setHideLevel(float64 level) {
hider = new TitleHider(this);
hider->move(0, 0);
hider->resize(size());
if (cWideMode()) {
hider->show();
} else {
if (Adaptive::OneColumn()) {
hider->hide();
} else {
hider->show();
}
}
hider->setLevel(hideLevel);
@ -216,7 +216,7 @@ void TitleWidget::updateBackButton() {
_lock.setSysBtnStyle(st::sysUnlock);
} else {
_lock.setSysBtnStyle(st::sysLock);
if (!cWideMode() && App::main() && App::main()->selectingPeer()) {
if (Adaptive::OneColumn() && App::main() && App::main()->selectingPeer()) {
_cancel.show();
if (!_back.isHidden()) _back.hide();
if (!_settings.isHidden()) _settings.hide();
@ -225,12 +225,7 @@ void TitleWidget::updateBackButton() {
} else {
if (!_cancel.isHidden()) _cancel.hide();
bool authed = (MTP::authedId() > 0);
if (cWideMode()) {
if (!_back.isHidden()) _back.hide();
if (_settings.isHidden()) _settings.show();
if (authed && _contacts.isHidden()) _contacts.show();
if (_about.isHidden()) _about.show();
} else {
if (Adaptive::OneColumn()) {
if (App::wnd()->needBackButton()) {
if (_back.isHidden()) _back.show();
if (!_settings.isHidden()) _settings.hide();
@ -242,6 +237,11 @@ void TitleWidget::updateBackButton() {
if (authed && _contacts.isHidden()) _contacts.show();
if (_about.isHidden()) _about.show();
}
} else {
if (!_back.isHidden()) _back.hide();
if (_settings.isHidden()) _settings.show();
if (authed && _contacts.isHidden()) _contacts.show();
if (_about.isHidden()) _about.show();
}
}
}
@ -249,22 +249,22 @@ void TitleWidget::updateBackButton() {
update();
}
void TitleWidget::updateWideMode() {
void TitleWidget::updateAdaptiveLayout() {
updateBackButton();
if (!cWideMode()) {
if (Adaptive::OneColumn()) {
updateCounter();
}
if (hider) {
if (cWideMode()) {
hider->show();
} else {
if (Adaptive::OneColumn()) {
hider->hide();
} else {
hider->show();
}
}
}
void TitleWidget::updateCounter() {
if (cWideMode() || !MTP::authedId()) return;
if (!Adaptive::OneColumn() || !MTP::authedId()) return;
int32 counter = App::histories().unreadFull - (cIncludeMuted() ? 0 : App::histories().unreadMuted);
bool muted = cIncludeMuted() ? (App::histories().unreadMuted >= counter) : false;
@ -313,7 +313,7 @@ void TitleWidget::stateChanged(Qt::WindowState state) {
}
void TitleWidget::showUpdateBtn() {
if (!cWideMode() && App::main() && App::main()->selectingPeer()) {
if (Adaptive::OneColumn() && App::main() && App::main()->selectingPeer()) {
_cancel.show();
_lock.hide();
_update.hide();
@ -329,7 +329,7 @@ void TitleWidget::showUpdateBtn() {
_lock.hide();
}
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
bool updateReady = (Sandboxer::updatingState() == Application::UpdatingReady);
bool updateReady = (Sandbox::updatingState() == Application::UpdatingReady);
#else
bool updateReady = false;
#endif
@ -377,7 +377,7 @@ HitTestType TitleWidget::hitTest(const QPoint &p) {
if (App::wnd() && Ui::isLayerShown()) return HitTestNone;
int x(p.x()), y(p.y()), w(width()), h(height());
if (cWideMode() && hider && x >= App::main()->dlgsWidth()) return HitTestNone;
if (!Adaptive::OneColumn() && hider && x >= App::main()->dlgsWidth()) return HitTestNone;
if (x >= st::titleIconPos.x() && y >= st::titleIconPos.y() && x < st::titleIconPos.x() + st::titleIconImg.pxWidth() && y < st::titleIconPos.y() + st::titleIconImg.pxHeight()) {
return HitTestIcon;

View file

@ -49,7 +49,7 @@ public:
void resizeEvent(QResizeEvent *e);
void updateBackButton();
void updateWideMode();
void updateAdaptiveLayout();
void updateCounter();
void mousePressEvent(QMouseEvent *e);

View file

@ -1214,7 +1214,7 @@ void Window::toggleDisplayNotifyFromTray() {
}
void Window::closeEvent(QCloseEvent *e) {
if (MTP::authedId() && !Sandboxer::isSavingSession() && minimizeToTray()) {
if (MTP::authedId() && !Sandbox::isSavingSession() && minimizeToTray()) {
e->ignore();
} else {
App::quit();
@ -1228,10 +1228,15 @@ TitleWidget *Window::getTitle() {
void Window::resizeEvent(QResizeEvent *e) {
if (!title) return;
bool wideMode = (width() >= st::wideModeWidth);
if (wideMode != cWideMode()) {
cSetWideMode(wideMode);
updateWideMode();
Adaptive::Layout layout = Adaptive::OneColumnLayout;
if (width() >= st::adaptiveWideWidth) {
layout = Adaptive::WideLayout;
} else if (width() >= st::adaptiveNormalWidth) {
layout = Adaptive::NormalLayout;
}
if (layout != Global::AdaptiveLayout()) {
Global::SetAdaptiveLayout(layout);
updateAdaptiveLayout();
}
title->setGeometry(0, 0, width(), st::titleHeight);
if (layerBg) layerBg->resize(width(), height());
@ -1239,12 +1244,12 @@ void Window::resizeEvent(QResizeEvent *e) {
emit resized(QSize(width(), height() - st::titleHeight));
}
void Window::updateWideMode() {
title->updateWideMode();
if (main) main->updateWideMode();
if (settings) settings->updateWideMode();
if (intro) intro->updateWideMode();
if (layerBg) layerBg->updateWideMode();
void Window::updateAdaptiveLayout() {
title->updateAdaptiveLayout();
if (main) main->updateAdaptiveLayout();
if (settings) settings->updateAdaptiveLayout();
if (intro) intro->updateAdaptiveLayout();
if (layerBg) layerBg->updateAdaptiveLayout();
}
bool Window::needBackButton() {
@ -2002,10 +2007,10 @@ LastCrashedWindow::LastCrashedWindow()
, _showReport(this)
, _saveReport(this)
, _getApp(this)
, _reportText(QString::fromUtf8(Global::LastCrashDump()))
, _reportText(QString::fromUtf8(Sandbox::LastCrashDump()))
, _reportShown(false)
, _reportSaved(false)
, _sendingState(((!cDevVersion() && !cBetaVersion()) || Global::LastCrashDump().isEmpty()) ? SendingNoReport : SendingUpdateCheck)
, _sendingState(((!cDevVersion() && !cBetaVersion()) || Sandbox::LastCrashDump().isEmpty()) ? SendingNoReport : SendingUpdateCheck)
, _updating(this)
, _sendingProgress(0)
, _sendingTotal(0)
@ -2078,23 +2083,23 @@ LastCrashedWindow::LastCrashedWindow()
_updatingSkip.setText(qsl("SKIP"));
connect(&_updatingSkip, SIGNAL(clicked()), this, SLOT(onUpdateSkip()));
Sandboxer::connect(SIGNAL(updateChecking()), this, SLOT(onUpdateChecking()));
Sandboxer::connect(SIGNAL(updateLatest()), this, SLOT(onUpdateLatest()));
Sandboxer::connect(SIGNAL(updateProgress(qint64,qint64)), this, SLOT(onUpdateDownloading(qint64,qint64)));
Sandboxer::connect(SIGNAL(updateFailed()), this, SLOT(onUpdateFailed()));
Sandboxer::connect(SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
Sandbox::connect(SIGNAL(updateChecking()), this, SLOT(onUpdateChecking()));
Sandbox::connect(SIGNAL(updateLatest()), this, SLOT(onUpdateLatest()));
Sandbox::connect(SIGNAL(updateProgress(qint64,qint64)), this, SLOT(onUpdateDownloading(qint64,qint64)));
Sandbox::connect(SIGNAL(updateFailed()), this, SLOT(onUpdateFailed()));
Sandbox::connect(SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
switch (Sandboxer::updatingState()) {
switch (Sandbox::updatingState()) {
case Application::UpdatingDownload:
setUpdatingState(UpdatingDownload, true);
setDownloadProgress(Sandboxer::updatingReady(), Sandboxer::updatingSize());
setDownloadProgress(Sandbox::updatingReady(), Sandbox::updatingSize());
break;
case Application::UpdatingReady: setUpdatingState(UpdatingReady, true); break;
default: setUpdatingState(UpdatingCheck, true); break;
}
cSetLastUpdateCheck(0);
Sandboxer::startUpdateCheck();
Sandbox::startUpdateCheck();
#else
_updating.setText(qsl("Please check if there is a new version available."));
if (_sendingState != SendingNoReport) {
@ -2137,7 +2142,7 @@ void LastCrashedWindow::onSaveReport() {
if (!to.isEmpty()) {
QFile file(to);
if (file.open(QIODevice::WriteOnly)) {
file.write(Global::LastCrashDump());
file.write(Sandbox::LastCrashDump());
_reportSaved = true;
updateControls();
}
@ -2321,7 +2326,7 @@ void LastCrashedWindow::onCheckingFinished() {
QHttpPart reportPart;
reportPart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/octet-stream"));
reportPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"report\"; filename=\"report.telegramcrash\""));
reportPart.setBody(Global::LastCrashDump());
reportPart.setBody(Sandbox::LastCrashDump());
multipart->append(reportPart);
QFileInfo dmpFile(_minidumpFull);
@ -2578,22 +2583,22 @@ void LastCrashedWindow::updateControls() {
}
void LastCrashedWindow::onNetworkSettings() {
const ConnectionProxy &p(Global::PreLaunchProxy());
const ConnectionProxy &p(Sandbox::PreLaunchProxy());
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)));
box->show();
}
void LastCrashedWindow::onNetworkSettingsSaved(QString host, quint32 port, QString username, QString password) {
Global::RefPreLaunchProxy().host = host;
Global::RefPreLaunchProxy().port = port ? port : 80;
Global::RefPreLaunchProxy().user = username;
Global::RefPreLaunchProxy().password = password;
Sandbox::RefPreLaunchProxy().host = host;
Sandbox::RefPreLaunchProxy().port = port ? port : 80;
Sandbox::RefPreLaunchProxy().user = username;
Sandbox::RefPreLaunchProxy().password = password;
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
if ((_updatingState == UpdatingFail && (_sendingState == SendingNoReport || _sendingState == SendingUpdateCheck)) || (_updatingState == UpdatingCheck)) {
Sandboxer::stopUpdate();
Sandbox::stopUpdate();
cSetLastUpdateCheck(0);
Sandboxer::startUpdateCheck();
Sandbox::startUpdateCheck();
} else
#endif
if (_sendingState == SendingFail || _sendingState == SendingProgress) {
@ -2650,7 +2655,7 @@ void LastCrashedWindow::setDownloadProgress(qint64 ready, qint64 total) {
void LastCrashedWindow::onUpdateRetry() {
cSetLastUpdateCheck(0);
Sandboxer::startUpdateCheck();
Sandbox::startUpdateCheck();
}
void LastCrashedWindow::onUpdateSkip() {
@ -2658,7 +2663,7 @@ void LastCrashedWindow::onUpdateSkip() {
onContinue();
} else {
if (_updatingState == UpdatingCheck || _updatingState == UpdatingDownload) {
Sandboxer::stopUpdate();
Sandbox::stopUpdate();
setUpdatingState(UpdatingFail);
}
_sendingState = SendingNone;
@ -2692,7 +2697,7 @@ void LastCrashedWindow::onContinue() {
if (SignalHandlers::restart() == SignalHandlers::CantOpen) {
new NotStartedWindow();
} else {
Sandboxer::startSandbox();
Sandbox::launch();
}
close();
}
@ -2909,7 +2914,7 @@ int showCrashReportWindow(const QString &crashdump) {
text = qsl("ERROR: could not read crash dump file '%1'").arg(QFileInfo(crashdump).absoluteFilePath());
}
if (Sandbox::started()) {
if (Global::started()) {
ShowCrashReportWindow *wnd = new ShowCrashReportWindow(text);
return 0;
}

View file

@ -146,7 +146,7 @@ public:
void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *e);
void updateWideMode();
void updateAdaptiveLayout();
bool needBackButton();
void setupPasscode(bool anim);

View file

@ -11,7 +11,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.9.19</string>
<string>0.9.20</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>

View file

@ -34,8 +34,8 @@ IDI_ICON1 ICON "SourceFiles\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,9,19,2
PRODUCTVERSION 0,9,19,2
FILEVERSION 0,9,20,0
PRODUCTVERSION 0,9,20,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.9.19.2"
VALUE "FileVersion", "0.9.20.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.9.19.2"
VALUE "ProductVersion", "0.9.20.0"
END
END
BLOCK "VarFileInfo"

View file

@ -1720,7 +1720,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.9.19;
CURRENT_PROJECT_VERSION = 0.9.20;
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
@ -1739,7 +1739,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 0.9.19;
CURRENT_PROJECT_VERSION = 0.9.20;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast;
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
@ -1768,10 +1768,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.9.19;
CURRENT_PROJECT_VERSION = 0.9.20;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 0.9;
DYLIB_CURRENT_VERSION = 0.9.19;
DYLIB_CURRENT_VERSION = 0.9.20;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
@ -1909,10 +1909,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.9.19;
CURRENT_PROJECT_VERSION = 0.9.20;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 0.9;
DYLIB_CURRENT_VERSION = 0.9.19;
DYLIB_CURRENT_VERSION = 0.9.20;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = "";

View file

@ -1,6 +1,6 @@
AppVersion 9019
AppVersion 9020
AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.19
AppVersionStr 0.9.19
AppVersionStrSmall 0.9.20
AppVersionStr 0.9.20
DevChannel 1
BetaVersion 9019002
BetaVersion 0 9019002