mirror of https://github.com/procxx/kepka.git
				
				
				
			Moved PsMainWindow to Platform::MainWindow, outside of pspecific module.
Currently only MSVC build is Ok, Xcode and QtCreator are broken.
This commit is contained in:
		
							parent
							
								
									84f704448a
								
							
						
					
					
						commit
						fd91893b51
					
				| 
						 | 
				
			
			@ -254,7 +254,7 @@ namespace {
 | 
			
		|||
namespace ThirdParty {
 | 
			
		||||
 | 
			
		||||
	void start() {
 | 
			
		||||
		PlatformSpecific::ThirdParty::start();
 | 
			
		||||
		Platform::ThirdParty::start();
 | 
			
		||||
 | 
			
		||||
		if (!RAND_status()) { // should be always inited in all modern OS
 | 
			
		||||
			char buf[16];
 | 
			
		||||
| 
						 | 
				
			
			@ -293,7 +293,7 @@ namespace ThirdParty {
 | 
			
		|||
		delete[] _sslLocks;
 | 
			
		||||
		_sslLocks = 0;
 | 
			
		||||
 | 
			
		||||
		PlatformSpecific::ThirdParty::finish();
 | 
			
		||||
		Platform::ThirdParty::finish();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,8 +41,8 @@ int main(int argc, char *argv[]) {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	// both are finished in Application::closeApplication
 | 
			
		||||
	Logs::start(); // must be started before PlatformSpecific is started
 | 
			
		||||
	PlatformSpecific::start(); // must be started before QApplication is created
 | 
			
		||||
	Logs::start(); // must be started before Platform is started
 | 
			
		||||
	Platform::start(); // must be started before QApplication is created
 | 
			
		||||
 | 
			
		||||
	// prepare fake args to disable QT_STYLE_OVERRIDE env variable
 | 
			
		||||
	// currently this is required in some desktop environments, including Xubuntu 15.10
 | 
			
		||||
| 
						 | 
				
			
			@ -76,7 +76,7 @@ int main(int argc, char *argv[]) {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	SignalHandlers::finish();
 | 
			
		||||
	PlatformSpecific::finish();
 | 
			
		||||
	Platform::finish();
 | 
			
		||||
	Logs::finish();
 | 
			
		||||
 | 
			
		||||
	return result;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -364,7 +364,7 @@ NotifyWindow::~NotifyWindow() {
 | 
			
		|||
	if (App::wnd()) App::wnd()->notifyShowNext(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MainWindow::MainWindow(QWidget *parent) : PsMainWindow(parent) {
 | 
			
		||||
MainWindow::MainWindow() {
 | 
			
		||||
	icon16 = icon256.scaledToWidth(16, Qt::SmoothTransformation);
 | 
			
		||||
	icon32 = icon256.scaledToWidth(32, Qt::SmoothTransformation);
 | 
			
		||||
	icon64 = icon256.scaledToWidth(64, Qt::SmoothTransformation);
 | 
			
		||||
| 
						 | 
				
			
			@ -1081,7 +1081,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *e) {
 | 
			
		|||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return PsMainWindow::eventFilter(obj, e);
 | 
			
		||||
	return Platform::MainWindow::eventFilter(obj, e);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::mouseMoveEvent(QMouseEvent *e) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,6 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
 | 
			
		|||
#include "title.h"
 | 
			
		||||
#include "pspecific.h"
 | 
			
		||||
#include "ui/boxshadow.h"
 | 
			
		||||
#include "platform/platform_main_window.h"
 | 
			
		||||
 | 
			
		||||
class MediaView;
 | 
			
		||||
class TitleWidget;
 | 
			
		||||
| 
						 | 
				
			
			@ -123,11 +124,11 @@ typedef QList<NotifyWindow*> NotifyWindows;
 | 
			
		|||
 | 
			
		||||
class MediaPreviewWidget;
 | 
			
		||||
 | 
			
		||||
class MainWindow : public PsMainWindow {
 | 
			
		||||
class MainWindow : public Platform::MainWindow {
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	MainWindow(QWidget *parent = 0);
 | 
			
		||||
	MainWindow();
 | 
			
		||||
	~MainWindow();
 | 
			
		||||
 | 
			
		||||
	void init();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,439 @@
 | 
			
		|||
/*
 | 
			
		||||
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 "platform/linux/main_window_linux.h"
 | 
			
		||||
 | 
			
		||||
#include "mainwindow.h"
 | 
			
		||||
#include "application.h"
 | 
			
		||||
#include "lang.h"
 | 
			
		||||
#include "localstorage.h"
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
namespace {
 | 
			
		||||
 | 
			
		||||
} // namespace
 | 
			
		||||
 | 
			
		||||
MainWindow::MainWindow() : QMainWindow(),
 | 
			
		||||
posInited(false), trayIcon(0), trayIconMenu(0), icon256(qsl(":/gui/art/icon256.png")), iconbig256(icon256), wndIcon(QIcon::fromTheme("telegram", QIcon(QPixmap::fromImage(icon256, Qt::ColorOnly)))), _psCheckStatusIconLeft(100), _psLastIndicatorUpdate(0) {
 | 
			
		||||
	connect(&_psCheckStatusIconTimer, SIGNAL(timeout()), this, SLOT(psStatusIconCheck()));
 | 
			
		||||
	_psCheckStatusIconTimer.setSingleShot(false);
 | 
			
		||||
 | 
			
		||||
	connect(&_psUpdateIndicatorTimer, SIGNAL(timeout()), this, SLOT(psUpdateIndicator()));
 | 
			
		||||
	_psUpdateIndicatorTimer.setSingleShot(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool MainWindow::psHasTrayIcon() const {
 | 
			
		||||
	return trayIcon || ((useAppIndicator || (useStatusIcon && trayIconChecked)) && (cWorkMode() != dbiwmWindowOnly));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psStatusIconCheck() {
 | 
			
		||||
	_trayIconCheck(0);
 | 
			
		||||
	if (cSupportTray() || !--_psCheckStatusIconLeft) {
 | 
			
		||||
		_psCheckStatusIconTimer.stop();
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psShowTrayMenu() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psRefreshTaskbarIcon() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psTrayMenuUpdated() {
 | 
			
		||||
	if (noQtTrayIcon && (useAppIndicator || useStatusIcon)) {
 | 
			
		||||
		const QList<QAction*> &actions = trayIconMenu->actions();
 | 
			
		||||
		if (_trayItems.isEmpty()) {
 | 
			
		||||
			DEBUG_LOG(("Creating tray menu!"));
 | 
			
		||||
			for (int32 i = 0, l = actions.size(); i != l; ++i) {
 | 
			
		||||
				GtkWidget *item = ps_gtk_menu_item_new_with_label(actions.at(i)->text().toUtf8());
 | 
			
		||||
				ps_gtk_menu_shell_append(PS_GTK_MENU_SHELL(_trayMenu), item);
 | 
			
		||||
				ps_g_signal_connect(item, "activate", G_CALLBACK(_trayMenuCallback), this);
 | 
			
		||||
				ps_gtk_widget_show(item);
 | 
			
		||||
				ps_gtk_widget_set_sensitive(item, actions.at(i)->isEnabled());
 | 
			
		||||
 | 
			
		||||
				_trayItems.push_back(qMakePair(item, actions.at(i)));
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			DEBUG_LOG(("Updating tray menu!"));
 | 
			
		||||
			for (int32 i = 0, l = actions.size(); i != l; ++i) {
 | 
			
		||||
				if (i < _trayItems.size()) {
 | 
			
		||||
					ps_gtk_menu_item_set_label(reinterpret_cast<GtkMenuItem*>(_trayItems.at(i).first), actions.at(i)->text().toUtf8());
 | 
			
		||||
					ps_gtk_widget_set_sensitive(_trayItems.at(i).first, actions.at(i)->isEnabled());
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psSetupTrayIcon() {
 | 
			
		||||
	if (noQtTrayIcon) {
 | 
			
		||||
		if (!cSupportTray()) return;
 | 
			
		||||
		psUpdateCounter();
 | 
			
		||||
	} else {
 | 
			
		||||
		if (!trayIcon) {
 | 
			
		||||
			trayIcon = new QSystemTrayIcon(this);
 | 
			
		||||
 | 
			
		||||
			QIcon icon(QPixmap::fromImage(App::wnd()->iconLarge(), Qt::ColorOnly));
 | 
			
		||||
 | 
			
		||||
			trayIcon->setIcon(icon);
 | 
			
		||||
			trayIcon->setToolTip(str_const_toString(AppName));
 | 
			
		||||
			connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleTray(QSystemTrayIcon::ActivationReason)), Qt::UniqueConnection);
 | 
			
		||||
			connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showFromTray()));
 | 
			
		||||
			App::wnd()->updateTrayMenu();
 | 
			
		||||
		}
 | 
			
		||||
		psUpdateCounter();
 | 
			
		||||
 | 
			
		||||
		trayIcon->show();
 | 
			
		||||
		psUpdateDelegate();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psUpdateWorkmode() {
 | 
			
		||||
	if (!cSupportTray()) return;
 | 
			
		||||
 | 
			
		||||
	if (cWorkMode() == dbiwmWindowOnly) {
 | 
			
		||||
		if (noQtTrayIcon) {
 | 
			
		||||
			if (useAppIndicator) {
 | 
			
		||||
				ps_app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_PASSIVE);
 | 
			
		||||
			} else if (useStatusIcon) {
 | 
			
		||||
				ps_gtk_status_icon_set_visible(_trayIcon, false);
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			if (trayIcon) {
 | 
			
		||||
				trayIcon->setContextMenu(0);
 | 
			
		||||
				trayIcon->deleteLater();
 | 
			
		||||
			}
 | 
			
		||||
			trayIcon = 0;
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		if (noQtTrayIcon) {
 | 
			
		||||
			if (useAppIndicator) {
 | 
			
		||||
				ps_app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_ACTIVE);
 | 
			
		||||
			} else if (useStatusIcon) {
 | 
			
		||||
				ps_gtk_status_icon_set_visible(_trayIcon, true);
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			psSetupTrayIcon();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psUpdateIndicator() {
 | 
			
		||||
	_psUpdateIndicatorTimer.stop();
 | 
			
		||||
	_psLastIndicatorUpdate = getms();
 | 
			
		||||
	QFileInfo f(_trayIconImageFile());
 | 
			
		||||
	if (f.exists()) {
 | 
			
		||||
		QByteArray path = QFile::encodeName(f.absoluteFilePath()), name = QFile::encodeName(f.fileName());
 | 
			
		||||
		name = name.mid(0, name.size() - 4);
 | 
			
		||||
		ps_app_indicator_set_icon_full(_trayIndicator, path.constData(), name);
 | 
			
		||||
	} else {
 | 
			
		||||
		useAppIndicator = false;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psUpdateCounter() {
 | 
			
		||||
	setWindowIcon(wndIcon);
 | 
			
		||||
 | 
			
		||||
	int32 counter = App::histories().unreadBadge();
 | 
			
		||||
 | 
			
		||||
	setWindowTitle((counter > 0) ? qsl("Telegram (%1)").arg(counter) : qsl("Telegram"));
 | 
			
		||||
	if (_psUnityLauncherEntry) {
 | 
			
		||||
		if (counter > 0) {
 | 
			
		||||
			ps_unity_launcher_entry_set_count(_psUnityLauncherEntry, (counter > 9999) ? 9999 : counter);
 | 
			
		||||
			ps_unity_launcher_entry_set_count_visible(_psUnityLauncherEntry, TRUE);
 | 
			
		||||
		} else {
 | 
			
		||||
			ps_unity_launcher_entry_set_count_visible(_psUnityLauncherEntry, FALSE);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (noQtTrayIcon) {
 | 
			
		||||
		if (useAppIndicator) {
 | 
			
		||||
			if (getms() > _psLastIndicatorUpdate + 1000) {
 | 
			
		||||
				psUpdateIndicator();
 | 
			
		||||
			} else if (!_psUpdateIndicatorTimer.isActive()) {
 | 
			
		||||
				_psUpdateIndicatorTimer.start(100);
 | 
			
		||||
			}
 | 
			
		||||
		} else if (useStatusIcon && trayIconChecked) {
 | 
			
		||||
			loadPixbuf(_trayIconImageGen());
 | 
			
		||||
			ps_gtk_status_icon_set_from_pixbuf(_trayIcon, _trayPixbuf);
 | 
			
		||||
		}
 | 
			
		||||
	} else if (trayIcon) {
 | 
			
		||||
		int32 counter = App::histories().unreadBadge();
 | 
			
		||||
		bool muted = App::histories().unreadOnlyMuted();
 | 
			
		||||
 | 
			
		||||
		style::color bg = muted ? st::counterMuteBG : st::counterBG;
 | 
			
		||||
		QIcon iconSmall;
 | 
			
		||||
		iconSmall.addPixmap(QPixmap::fromImage(iconWithCounter(16, counter, bg, true), Qt::ColorOnly));
 | 
			
		||||
		iconSmall.addPixmap(QPixmap::fromImage(iconWithCounter(32, counter, bg, true), Qt::ColorOnly));
 | 
			
		||||
		trayIcon->setIcon(iconSmall);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psUpdateDelegate() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psInitSize() {
 | 
			
		||||
	setMinimumWidth(st::wndMinWidth);
 | 
			
		||||
	setMinimumHeight(st::wndMinHeight);
 | 
			
		||||
 | 
			
		||||
	TWindowPos pos(cWindowPos());
 | 
			
		||||
	QRect avail(QDesktopWidget().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) {
 | 
			
		||||
		QList<QScreen*> screens = Application::screens();
 | 
			
		||||
		for (QList<QScreen*>::const_iterator i = screens.cbegin(), e = screens.cend(); i != e; ++i) {
 | 
			
		||||
			QByteArray name = (*i)->name().toUtf8();
 | 
			
		||||
			if (pos.moncrc == hashCrc32(name.constData(), name.size())) {
 | 
			
		||||
				QRect screen((*i)->geometry());
 | 
			
		||||
				int32 w = screen.width(), h = screen.height();
 | 
			
		||||
				if (w >= st::wndMinWidth && h >= st::wndMinHeight) {
 | 
			
		||||
					if (pos.w > w) pos.w = w;
 | 
			
		||||
					if (pos.h > h) pos.h = h;
 | 
			
		||||
					pos.x += screen.x();
 | 
			
		||||
					pos.y += screen.y();
 | 
			
		||||
					if (pos.x < screen.x() + screen.width() - 10 && pos.y < screen.y() + screen.height() - 10) {
 | 
			
		||||
						geom = QRect(pos.x, pos.y, pos.w, pos.h);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (pos.y < 0) pos.y = 0;
 | 
			
		||||
		maximized = pos.maximized;
 | 
			
		||||
	}
 | 
			
		||||
	setGeometry(geom);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psInitFrameless() {
 | 
			
		||||
	psUpdatedPositionTimer.setSingleShot(true);
 | 
			
		||||
	connect(&psUpdatedPositionTimer, SIGNAL(timeout()), this, SLOT(psSavePosition()));
 | 
			
		||||
 | 
			
		||||
	if (frameless) {
 | 
			
		||||
		//setWindowFlags(Qt::FramelessWindowHint);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psSavePosition(Qt::WindowState state) {
 | 
			
		||||
	if (state == Qt::WindowActive) state = windowHandle()->windowState();
 | 
			
		||||
	if (state == Qt::WindowMinimized || !posInited) return;
 | 
			
		||||
 | 
			
		||||
	TWindowPos pos(cWindowPos()), curPos = pos;
 | 
			
		||||
 | 
			
		||||
	if (state == Qt::WindowMaximized) {
 | 
			
		||||
		curPos.maximized = 1;
 | 
			
		||||
	} else {
 | 
			
		||||
		QRect r(geometry());
 | 
			
		||||
		curPos.x = r.x();
 | 
			
		||||
		curPos.y = r.y();
 | 
			
		||||
		curPos.w = r.width();
 | 
			
		||||
		curPos.h = r.height();
 | 
			
		||||
		curPos.maximized = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	int px = curPos.x + curPos.w / 2, py = curPos.y + curPos.h / 2, d = 0;
 | 
			
		||||
	QScreen *chosen = 0;
 | 
			
		||||
	QList<QScreen*> screens = Application::screens();
 | 
			
		||||
	for (QList<QScreen*>::const_iterator i = screens.cbegin(), e = screens.cend(); i != e; ++i) {
 | 
			
		||||
		int dx = (*i)->geometry().x() + (*i)->geometry().width() / 2 - px; if (dx < 0) dx = -dx;
 | 
			
		||||
		int dy = (*i)->geometry().y() + (*i)->geometry().height() / 2 - py; if (dy < 0) dy = -dy;
 | 
			
		||||
		if (!chosen || dx + dy < d) {
 | 
			
		||||
			d = dx + dy;
 | 
			
		||||
			chosen = *i;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (chosen) {
 | 
			
		||||
		curPos.x -= chosen->geometry().x();
 | 
			
		||||
		curPos.y -= chosen->geometry().y();
 | 
			
		||||
		QByteArray name = chosen->name().toUtf8();
 | 
			
		||||
		curPos.moncrc = hashCrc32(name.constData(), name.size());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (curPos.w >= st::wndMinWidth && curPos.h >= st::wndMinHeight) {
 | 
			
		||||
		if (curPos.x != pos.x || curPos.y != pos.y || curPos.w != pos.w || curPos.h != pos.h || curPos.moncrc != pos.moncrc || curPos.maximized != pos.maximized) {
 | 
			
		||||
			cSetWindowPos(curPos);
 | 
			
		||||
			Local::writeSettings();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psUpdatedPosition() {
 | 
			
		||||
	psUpdatedPositionTimer.start(SaveWindowPositionTimeout);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psCreateTrayIcon() {
 | 
			
		||||
	if (!noQtTrayIcon) {
 | 
			
		||||
		cSetSupportTray(QSystemTrayIcon::isSystemTrayAvailable());
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (useAppIndicator) {
 | 
			
		||||
		DEBUG_LOG(("Trying to create AppIndicator"));
 | 
			
		||||
		_trayMenu = ps_gtk_menu_new();
 | 
			
		||||
		if (_trayMenu) {
 | 
			
		||||
			DEBUG_LOG(("Created gtk menu for appindicator!"));
 | 
			
		||||
			QFileInfo f(_trayIconImageFile());
 | 
			
		||||
			if (f.exists()) {
 | 
			
		||||
				QByteArray path = QFile::encodeName(f.absoluteFilePath());
 | 
			
		||||
				_trayIndicator = ps_app_indicator_new("Telegram Desktop", path.constData(), APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
 | 
			
		||||
				if (_trayIndicator) {
 | 
			
		||||
					DEBUG_LOG(("Created appindicator!"));
 | 
			
		||||
				} else {
 | 
			
		||||
					DEBUG_LOG(("Failed to app_indicator_new()!"));
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				useAppIndicator = false;
 | 
			
		||||
				DEBUG_LOG(("Failed to create image file!"));
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			DEBUG_LOG(("Failed to gtk_menu_new()!"));
 | 
			
		||||
		}
 | 
			
		||||
		if (_trayMenu && _trayIndicator) {
 | 
			
		||||
			ps_app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_ACTIVE);
 | 
			
		||||
			ps_app_indicator_set_menu(_trayIndicator, PS_GTK_MENU(_trayMenu));
 | 
			
		||||
			useStatusIcon = false;
 | 
			
		||||
		} else {
 | 
			
		||||
			DEBUG_LOG(("AppIndicator failed!"));
 | 
			
		||||
			useAppIndicator = false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (useStatusIcon) {
 | 
			
		||||
		if (ps_gdk_init_check(0, 0)) {
 | 
			
		||||
			if (!_trayMenu) _trayMenu = ps_gtk_menu_new();
 | 
			
		||||
			if (_trayMenu) {
 | 
			
		||||
				loadPixbuf(_trayIconImageGen());
 | 
			
		||||
				_trayIcon = ps_gtk_status_icon_new_from_pixbuf(_trayPixbuf);
 | 
			
		||||
				if (_trayIcon) {
 | 
			
		||||
					ps_g_signal_connect(_trayIcon, "popup-menu", GCallback(_trayIconPopup), _trayMenu);
 | 
			
		||||
					ps_g_signal_connect(_trayIcon, "activate", GCallback(_trayIconActivate), _trayMenu);
 | 
			
		||||
					ps_g_signal_connect(_trayIcon, "size-changed", GCallback(_trayIconResized), _trayMenu);
 | 
			
		||||
 | 
			
		||||
					ps_gtk_status_icon_set_title(_trayIcon, "Telegram Desktop");
 | 
			
		||||
					ps_gtk_status_icon_set_tooltip_text(_trayIcon, "Telegram Desktop");
 | 
			
		||||
					ps_gtk_status_icon_set_visible(_trayIcon, true);
 | 
			
		||||
				} else {
 | 
			
		||||
					useStatusIcon = false;
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				useStatusIcon = false;
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			useStatusIcon = false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (!useStatusIcon && !useAppIndicator) {
 | 
			
		||||
		if (_trayMenu) {
 | 
			
		||||
			ps_g_object_ref_sink(_trayMenu);
 | 
			
		||||
			ps_g_object_unref(_trayMenu);
 | 
			
		||||
			_trayMenu = 0;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	cSetSupportTray(useAppIndicator);
 | 
			
		||||
	if (useStatusIcon) {
 | 
			
		||||
		ps_g_idle_add((GSourceFunc)_trayIconCheck, 0);
 | 
			
		||||
		_psCheckStatusIconTimer.start(100);
 | 
			
		||||
	} else {
 | 
			
		||||
		psUpdateWorkmode();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psFirstShow() {
 | 
			
		||||
	psCreateTrayIcon();
 | 
			
		||||
 | 
			
		||||
	if (useUnityCount) {
 | 
			
		||||
		_psUnityLauncherEntry = ps_unity_launcher_entry_get_for_desktop_id("telegramdesktop.desktop");
 | 
			
		||||
		if (_psUnityLauncherEntry) {
 | 
			
		||||
			LOG(("Found Unity Launcher entry telegramdesktop.desktop!"));
 | 
			
		||||
		} else {
 | 
			
		||||
			_psUnityLauncherEntry = ps_unity_launcher_entry_get_for_desktop_id("Telegram.desktop");
 | 
			
		||||
			if (_psUnityLauncherEntry) {
 | 
			
		||||
				LOG(("Found Unity Launcher entry Telegram.desktop!"));
 | 
			
		||||
			} else {
 | 
			
		||||
				LOG(("Could not get Unity Launcher entry!"));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		LOG(("Not using Unity Launcher count."));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	finished = false;
 | 
			
		||||
 | 
			
		||||
	psUpdateMargins();
 | 
			
		||||
 | 
			
		||||
	bool showShadows = true;
 | 
			
		||||
 | 
			
		||||
	show();
 | 
			
		||||
	//_private.enableShadow(winId());
 | 
			
		||||
	if (cWindowPos().maximized) {
 | 
			
		||||
		setWindowState(Qt::WindowMaximized);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((cLaunchMode() == LaunchModeAutoStart && cStartMinimized()) || cStartInTray()) {
 | 
			
		||||
		setWindowState(Qt::WindowMinimized);
 | 
			
		||||
		if (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray) {
 | 
			
		||||
			hide();
 | 
			
		||||
		} else {
 | 
			
		||||
			show();
 | 
			
		||||
		}
 | 
			
		||||
		showShadows = false;
 | 
			
		||||
	} else {
 | 
			
		||||
		show();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	posInited = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool MainWindow::psHandleTitle() {
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psInitSysMenu() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psUpdateSysMenu(Qt::WindowState state) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psUpdateMargins() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::psFlash() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MainWindow::~MainWindow() {
 | 
			
		||||
	if (_trayIcon) {
 | 
			
		||||
		ps_g_object_unref(_trayIcon);
 | 
			
		||||
		_trayIcon = 0;
 | 
			
		||||
	}
 | 
			
		||||
	if (_trayPixbuf) {
 | 
			
		||||
		ps_g_object_unref(_trayPixbuf);
 | 
			
		||||
		_trayPixbuf = 0;
 | 
			
		||||
	}
 | 
			
		||||
	if (_trayMenu) {
 | 
			
		||||
		ps_g_object_ref_sink(_trayMenu);
 | 
			
		||||
		ps_g_object_unref(_trayMenu);
 | 
			
		||||
		_trayMenu = 0;
 | 
			
		||||
	}
 | 
			
		||||
	finished = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,110 @@
 | 
			
		|||
/*
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
#include "window/main_window.h"
 | 
			
		||||
 | 
			
		||||
class NotifyWindow;
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
 | 
			
		||||
class MainWindow : public Window::MainWindow {
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	MainWindow();
 | 
			
		||||
 | 
			
		||||
	int32 psResizeRowWidth() const {
 | 
			
		||||
		return 0;//st::wndResizeAreaWidth;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void psInitFrameless();
 | 
			
		||||
	void psInitSize();
 | 
			
		||||
 | 
			
		||||
	void psFirstShow();
 | 
			
		||||
	void psInitSysMenu();
 | 
			
		||||
	void psUpdateSysMenu(Qt::WindowState state);
 | 
			
		||||
	void psUpdateMargins();
 | 
			
		||||
	void psUpdatedPosition();
 | 
			
		||||
 | 
			
		||||
	bool psHandleTitle();
 | 
			
		||||
 | 
			
		||||
	void psFlash();
 | 
			
		||||
	void psNotifySettingGot();
 | 
			
		||||
 | 
			
		||||
	void psUpdateWorkmode();
 | 
			
		||||
 | 
			
		||||
	void psRefreshTaskbarIcon();
 | 
			
		||||
 | 
			
		||||
	bool psPosInited() const {
 | 
			
		||||
		return posInited;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void psActivateNotify(NotifyWindow *w);
 | 
			
		||||
	void psClearNotifies(PeerId peerId = 0);
 | 
			
		||||
	void psNotifyShown(NotifyWindow *w);
 | 
			
		||||
	void psPlatformNotify(HistoryItem *item, int32 fwdCount);
 | 
			
		||||
 | 
			
		||||
	void psUpdateCounter();
 | 
			
		||||
 | 
			
		||||
	bool psHasNativeNotifications() {
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	virtual QImage iconWithCounter(int size, int count, style::color bg, bool smallIcon) = 0;
 | 
			
		||||
 | 
			
		||||
	~MainWindow();
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
 | 
			
		||||
	void psUpdateDelegate();
 | 
			
		||||
	void psSavePosition(Qt::WindowState state = Qt::WindowActive);
 | 
			
		||||
	void psShowTrayMenu();
 | 
			
		||||
 | 
			
		||||
	void psStatusIconCheck();
 | 
			
		||||
	void psUpdateIndicator();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
 | 
			
		||||
	bool psHasTrayIcon() const;
 | 
			
		||||
 | 
			
		||||
	bool posInited;
 | 
			
		||||
	QSystemTrayIcon *trayIcon;
 | 
			
		||||
	QMenu *trayIconMenu;
 | 
			
		||||
	QImage icon256, iconbig256;
 | 
			
		||||
	QIcon wndIcon;
 | 
			
		||||
 | 
			
		||||
	void psTrayMenuUpdated();
 | 
			
		||||
	void psSetupTrayIcon();
 | 
			
		||||
 | 
			
		||||
	QTimer psUpdatedPositionTimer;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	void psCreateTrayIcon();
 | 
			
		||||
 | 
			
		||||
	QTimer _psCheckStatusIconTimer;
 | 
			
		||||
	int _psCheckStatusIconLeft;
 | 
			
		||||
 | 
			
		||||
	QTimer _psUpdateIndicatorTimer;
 | 
			
		||||
	uint64 _psLastIndicatorUpdate;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,140 @@
 | 
			
		|||
/*
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
#include "window/main_window.h"
 | 
			
		||||
#include "pspecific_mac_p.h"
 | 
			
		||||
 | 
			
		||||
class NotifyWindow;
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
 | 
			
		||||
class MacPrivate : public PsMacWindowPrivate {
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
	void activeSpaceChanged();
 | 
			
		||||
	void darkModeChanged();
 | 
			
		||||
	void notifyClicked(unsigned long long peer, int msgid);
 | 
			
		||||
	void notifyReplied(unsigned long long peer, int msgid, const char *str);
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class MainWindow : public Window::MainWindow {
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	MainWindow();
 | 
			
		||||
 | 
			
		||||
	int32 psResizeRowWidth() const {
 | 
			
		||||
		return 0;//st::wndResizeAreaWidth;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void psInitFrameless();
 | 
			
		||||
	void psInitSize();
 | 
			
		||||
 | 
			
		||||
	void psFirstShow();
 | 
			
		||||
	void psInitSysMenu();
 | 
			
		||||
	void psUpdateSysMenu(Qt::WindowState state);
 | 
			
		||||
	void psUpdateMargins();
 | 
			
		||||
	void psUpdatedPosition();
 | 
			
		||||
 | 
			
		||||
	bool psHandleTitle();
 | 
			
		||||
 | 
			
		||||
	void psFlash();
 | 
			
		||||
 | 
			
		||||
	void psUpdateWorkmode();
 | 
			
		||||
 | 
			
		||||
	void psRefreshTaskbarIcon();
 | 
			
		||||
 | 
			
		||||
	bool psPosInited() const {
 | 
			
		||||
		return posInited;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	bool psFilterNativeEvent(void *event);
 | 
			
		||||
 | 
			
		||||
	void psActivateNotify(NotifyWindow *w);
 | 
			
		||||
	void psClearNotifies(PeerId peerId = 0);
 | 
			
		||||
	void psNotifyShown(NotifyWindow *w);
 | 
			
		||||
	void psPlatformNotify(HistoryItem *item, int32 fwdCount);
 | 
			
		||||
 | 
			
		||||
	bool eventFilter(QObject *obj, QEvent *evt);
 | 
			
		||||
 | 
			
		||||
	void psUpdateCounter();
 | 
			
		||||
 | 
			
		||||
	bool psHasNativeNotifications() {
 | 
			
		||||
		return !(QSysInfo::macVersion() < QSysInfo::MV_10_8);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	virtual QImage iconWithCounter(int size, int count, style::color bg, bool smallIcon) = 0;
 | 
			
		||||
 | 
			
		||||
	~MainWindow();
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
 | 
			
		||||
	void psUpdateDelegate();
 | 
			
		||||
	void psSavePosition(Qt::WindowState state = Qt::WindowActive);
 | 
			
		||||
	void psShowTrayMenu();
 | 
			
		||||
 | 
			
		||||
	void psMacUndo();
 | 
			
		||||
	void psMacRedo();
 | 
			
		||||
	void psMacCut();
 | 
			
		||||
	void psMacCopy();
 | 
			
		||||
	void psMacPaste();
 | 
			
		||||
	void psMacDelete();
 | 
			
		||||
	void psMacSelectAll();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
 | 
			
		||||
	void psNotIdle() const;
 | 
			
		||||
	QImage psTrayIcon(bool selected = false) const;
 | 
			
		||||
	bool psHasTrayIcon() const {
 | 
			
		||||
		return trayIcon;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void psMacUpdateMenu();
 | 
			
		||||
 | 
			
		||||
	bool posInited;
 | 
			
		||||
	QSystemTrayIcon *trayIcon;
 | 
			
		||||
	QMenu *trayIconMenu;
 | 
			
		||||
	QImage icon256, iconbig256;
 | 
			
		||||
	QIcon wndIcon;
 | 
			
		||||
 | 
			
		||||
	QImage trayImg, trayImgSel;
 | 
			
		||||
 | 
			
		||||
	void psTrayMenuUpdated();
 | 
			
		||||
	void psSetupTrayIcon();
 | 
			
		||||
	virtual void placeSmallCounter(QImage &img, int size, int count, style::color bg, const QPoint &shift, style::color color) = 0;
 | 
			
		||||
 | 
			
		||||
	QTimer psUpdatedPositionTimer;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	struct PrivateData;
 | 
			
		||||
	std_::unique_ptr<PrivateData> _private;
 | 
			
		||||
 | 
			
		||||
	mutable bool psIdle;
 | 
			
		||||
	mutable QTimer psIdleTimer;
 | 
			
		||||
 | 
			
		||||
	QMenuBar psMainMenu;
 | 
			
		||||
	QAction *psLogout, *psUndo, *psRedo, *psCut, *psCopy, *psPaste, *psDelete, *psSelectAll, *psContacts, *psAddContact, *psNewGroup, *psNewChannel, *psShowTelegram;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
/*
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
#ifdef Q_OS_MAC
 | 
			
		||||
#include "platform/mac/main_window_mac.h"
 | 
			
		||||
#elif defined Q_OS_LINUX // Q_OS_MAC
 | 
			
		||||
#include "platform/linux/main_window_linux.h"
 | 
			
		||||
#elif defined Q_OS_WINRT // Q_OS_MAC || Q_OS_LINUX
 | 
			
		||||
#include "platform/winrt/main_window_winrt.h"
 | 
			
		||||
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT
 | 
			
		||||
#include "platform/win/main_window_win.h"
 | 
			
		||||
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,157 @@
 | 
			
		|||
/*
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
#include "window/main_window.h"
 | 
			
		||||
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
 | 
			
		||||
class NotifyWindow;
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
 | 
			
		||||
class MainWindow : public Window::MainWindow {
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	MainWindow();
 | 
			
		||||
 | 
			
		||||
	int32 psResizeRowWidth() const {
 | 
			
		||||
		return 0;//st::wndResizeAreaWidth;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void psInitFrameless();
 | 
			
		||||
	void psInitSize();
 | 
			
		||||
	HWND psHwnd() const;
 | 
			
		||||
	HMENU psMenu() const;
 | 
			
		||||
 | 
			
		||||
	void psFirstShow();
 | 
			
		||||
	void psInitSysMenu();
 | 
			
		||||
	void psUpdateSysMenu(Qt::WindowState state);
 | 
			
		||||
	void psUpdateMargins();
 | 
			
		||||
	void psUpdatedPosition();
 | 
			
		||||
 | 
			
		||||
	bool psHandleTitle();
 | 
			
		||||
 | 
			
		||||
	void psFlash();
 | 
			
		||||
	void psNotifySettingGot();
 | 
			
		||||
 | 
			
		||||
	void psUpdateWorkmode();
 | 
			
		||||
 | 
			
		||||
	void psRefreshTaskbarIcon();
 | 
			
		||||
 | 
			
		||||
	bool psPosInited() const {
 | 
			
		||||
		return posInited;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void psActivateNotify(NotifyWindow *w);
 | 
			
		||||
	void psClearNotifies(PeerId peerId = 0);
 | 
			
		||||
	void psNotifyShown(NotifyWindow *w);
 | 
			
		||||
	void psPlatformNotify(HistoryItem *item, int32 fwdCount);
 | 
			
		||||
 | 
			
		||||
	void psUpdateCounter();
 | 
			
		||||
 | 
			
		||||
	bool psHasNativeNotifications();
 | 
			
		||||
	void psCleanNotifyPhotosIn(int32 dt);
 | 
			
		||||
 | 
			
		||||
	virtual QImage iconWithCounter(int size, int count, style::color bg, bool smallIcon) = 0;
 | 
			
		||||
 | 
			
		||||
	static UINT TaskbarCreatedMsgId() {
 | 
			
		||||
		return _taskbarCreatedMsgId;
 | 
			
		||||
	}
 | 
			
		||||
	static void TaskbarCreated();
 | 
			
		||||
 | 
			
		||||
	// Custom shadows.
 | 
			
		||||
	enum class ShadowsChange {
 | 
			
		||||
		Moved    = 0x01,
 | 
			
		||||
		Resized  = 0x02,
 | 
			
		||||
		Shown    = 0x04,
 | 
			
		||||
		Hidden   = 0x08,
 | 
			
		||||
		Activate = 0x10,
 | 
			
		||||
	};
 | 
			
		||||
	Q_DECLARE_FLAGS(ShadowsChanges, ShadowsChange);
 | 
			
		||||
 | 
			
		||||
	bool shadowsWorking() const {
 | 
			
		||||
		return _shadowsWorking;
 | 
			
		||||
	}
 | 
			
		||||
	void shadowsActivate();
 | 
			
		||||
	void shadowsDeactivate();
 | 
			
		||||
	void shadowsUpdate(ShadowsChanges changes, WINDOWPOS *position = nullptr);
 | 
			
		||||
 | 
			
		||||
	int deltaLeft() const {
 | 
			
		||||
		return _deltaLeft;
 | 
			
		||||
	}
 | 
			
		||||
	int deltaTop() const {
 | 
			
		||||
		return _deltaTop;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	~MainWindow();
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
 | 
			
		||||
	void psUpdateDelegate();
 | 
			
		||||
	void psSavePosition(Qt::WindowState state = Qt::WindowActive);
 | 
			
		||||
	void psShowTrayMenu();
 | 
			
		||||
 | 
			
		||||
	void psCleanNotifyPhotos();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
 | 
			
		||||
	bool psHasTrayIcon() const {
 | 
			
		||||
		return trayIcon;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	bool posInited = false;
 | 
			
		||||
	QSystemTrayIcon *trayIcon = nullptr;
 | 
			
		||||
	PopupMenu *trayIconMenu = nullptr;
 | 
			
		||||
	QImage icon256, iconbig256;
 | 
			
		||||
	QIcon wndIcon;
 | 
			
		||||
 | 
			
		||||
	void psTrayMenuUpdated();
 | 
			
		||||
	void psSetupTrayIcon();
 | 
			
		||||
 | 
			
		||||
	QTimer psUpdatedPositionTimer;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	void psDestroyIcons();
 | 
			
		||||
 | 
			
		||||
	static UINT _taskbarCreatedMsgId;
 | 
			
		||||
 | 
			
		||||
	bool _shadowsWorking = false;
 | 
			
		||||
	bool _themeInited = false;
 | 
			
		||||
 | 
			
		||||
	HWND ps_hWnd = nullptr;
 | 
			
		||||
	HWND ps_tbHider_hWnd = nullptr;
 | 
			
		||||
	HMENU ps_menu = nullptr;
 | 
			
		||||
	HICON ps_iconBig = nullptr;
 | 
			
		||||
	HICON ps_iconSmall = nullptr;
 | 
			
		||||
	HICON ps_iconOverlay = nullptr;
 | 
			
		||||
 | 
			
		||||
	SingleTimer ps_cleanNotifyPhotosTimer;
 | 
			
		||||
 | 
			
		||||
	int _deltaLeft = 0;
 | 
			
		||||
	int _deltaTop = 0;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Q_DECLARE_OPERATORS_FOR_FLAGS(MainWindow::ShadowsChanges);
 | 
			
		||||
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,331 @@
 | 
			
		|||
/*
 | 
			
		||||
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 "platform/win/windows_app_user_model_id.h"
 | 
			
		||||
 | 
			
		||||
#include "platform/win/windows_dlls.h"
 | 
			
		||||
#include <propvarutil.h>
 | 
			
		||||
#include <propkey.h>
 | 
			
		||||
 | 
			
		||||
#include <roapi.h>
 | 
			
		||||
#include <wrl\client.h>
 | 
			
		||||
#include <wrl\implements.h>
 | 
			
		||||
#include <windows.ui.notifications.h>
 | 
			
		||||
 | 
			
		||||
using namespace Microsoft::WRL;
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
namespace AppUserModelId {
 | 
			
		||||
namespace {
 | 
			
		||||
 | 
			
		||||
const PROPERTYKEY pkey_AppUserModel_ID = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 5 };
 | 
			
		||||
const PROPERTYKEY pkey_AppUserModel_StartPinOption = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 12 };
 | 
			
		||||
 | 
			
		||||
const WCHAR AppUserModelIdRelease[] = L"Telegram.TelegramDesktop";
 | 
			
		||||
const WCHAR AppUserModelIdBeta[] = L"Telegram.TelegramDesktop.Beta";
 | 
			
		||||
 | 
			
		||||
} // namespace
 | 
			
		||||
 | 
			
		||||
QString pinnedPath() {
 | 
			
		||||
	static const int maxFileLen = MAX_PATH * 10;
 | 
			
		||||
	WCHAR wstrPath[maxFileLen];
 | 
			
		||||
	if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) {
 | 
			
		||||
		QDir appData(QString::fromStdWString(std::wstring(wstrPath)));
 | 
			
		||||
		return appData.absolutePath() + qsl("/Microsoft/Internet Explorer/Quick Launch/User Pinned/TaskBar/");
 | 
			
		||||
	}
 | 
			
		||||
	return QString();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void checkPinned() {
 | 
			
		||||
	if (!Dlls::PropVariantToString) return;
 | 
			
		||||
 | 
			
		||||
	static const int maxFileLen = MAX_PATH * 10;
 | 
			
		||||
 | 
			
		||||
	HRESULT hr = CoInitialize(0);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return;
 | 
			
		||||
 | 
			
		||||
	QString path = pinnedPath();
 | 
			
		||||
	std::wstring p = QDir::toNativeSeparators(path).toStdWString();
 | 
			
		||||
 | 
			
		||||
	WCHAR src[MAX_PATH];
 | 
			
		||||
	GetModuleFileName(GetModuleHandle(0), src, MAX_PATH);
 | 
			
		||||
	BY_HANDLE_FILE_INFORMATION srcinfo = { 0 };
 | 
			
		||||
	HANDLE srcfile = CreateFile(src, 0x00, 0x00, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
 | 
			
		||||
	if (srcfile == INVALID_HANDLE_VALUE) return;
 | 
			
		||||
	BOOL srcres = GetFileInformationByHandle(srcfile, &srcinfo);
 | 
			
		||||
	CloseHandle(srcfile);
 | 
			
		||||
	if (!srcres) return;
 | 
			
		||||
	LOG(("Checking..."));
 | 
			
		||||
	WIN32_FIND_DATA findData;
 | 
			
		||||
	HANDLE findHandle = FindFirstFileEx((p + L"*").c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, 0, 0);
 | 
			
		||||
	if (findHandle == INVALID_HANDLE_VALUE) {
 | 
			
		||||
		LOG(("Init Error: could not find files in pinned folder"));
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	do {
 | 
			
		||||
		std::wstring fname = p + findData.cFileName;
 | 
			
		||||
		LOG(("Checking %1").arg(QString::fromStdWString(fname)));
 | 
			
		||||
		if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
 | 
			
		||||
			continue;
 | 
			
		||||
		} else {
 | 
			
		||||
			DWORD attributes = GetFileAttributes(fname.c_str());
 | 
			
		||||
			if (attributes >= 0xFFFFFFF) continue; // file does not exist
 | 
			
		||||
 | 
			
		||||
			ComPtr<IShellLink> shellLink;
 | 
			
		||||
			HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink));
 | 
			
		||||
			if (!SUCCEEDED(hr)) continue;
 | 
			
		||||
 | 
			
		||||
			ComPtr<IPersistFile> persistFile;
 | 
			
		||||
			hr = shellLink.As(&persistFile);
 | 
			
		||||
			if (!SUCCEEDED(hr)) continue;
 | 
			
		||||
 | 
			
		||||
			hr = persistFile->Load(fname.c_str(), STGM_READWRITE);
 | 
			
		||||
			if (!SUCCEEDED(hr)) continue;
 | 
			
		||||
 | 
			
		||||
			WCHAR dst[MAX_PATH];
 | 
			
		||||
			hr = shellLink->GetPath(dst, MAX_PATH, 0, 0);
 | 
			
		||||
			if (!SUCCEEDED(hr)) continue;
 | 
			
		||||
 | 
			
		||||
			BY_HANDLE_FILE_INFORMATION dstinfo = { 0 };
 | 
			
		||||
			HANDLE dstfile = CreateFile(dst, 0x00, 0x00, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
 | 
			
		||||
			if (dstfile == INVALID_HANDLE_VALUE) continue;
 | 
			
		||||
			BOOL dstres = GetFileInformationByHandle(dstfile, &dstinfo);
 | 
			
		||||
			CloseHandle(dstfile);
 | 
			
		||||
			if (!dstres) continue;
 | 
			
		||||
 | 
			
		||||
			if (srcinfo.dwVolumeSerialNumber == dstinfo.dwVolumeSerialNumber && srcinfo.nFileIndexLow == dstinfo.nFileIndexLow && srcinfo.nFileIndexHigh == dstinfo.nFileIndexHigh) {
 | 
			
		||||
				ComPtr<IPropertyStore> propertyStore;
 | 
			
		||||
				hr = shellLink.As(&propertyStore);
 | 
			
		||||
				if (!SUCCEEDED(hr)) return;
 | 
			
		||||
 | 
			
		||||
				PROPVARIANT appIdPropVar;
 | 
			
		||||
				hr = propertyStore->GetValue(getKey(), &appIdPropVar);
 | 
			
		||||
				if (!SUCCEEDED(hr)) return;
 | 
			
		||||
				LOG(("Reading..."));
 | 
			
		||||
				WCHAR already[MAX_PATH];
 | 
			
		||||
				hr = Dlls::PropVariantToString(appIdPropVar, already, MAX_PATH);
 | 
			
		||||
				if (SUCCEEDED(hr)) {
 | 
			
		||||
					if (std::wstring(getId()) == already) {
 | 
			
		||||
						LOG(("Already!"));
 | 
			
		||||
						PropVariantClear(&appIdPropVar);
 | 
			
		||||
						return;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				if (appIdPropVar.vt != VT_EMPTY) {
 | 
			
		||||
					PropVariantClear(&appIdPropVar);
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
				PropVariantClear(&appIdPropVar);
 | 
			
		||||
 | 
			
		||||
				hr = InitPropVariantFromString(getId(), &appIdPropVar);
 | 
			
		||||
				if (!SUCCEEDED(hr)) return;
 | 
			
		||||
 | 
			
		||||
				hr = propertyStore->SetValue(getKey(), appIdPropVar);
 | 
			
		||||
				PropVariantClear(&appIdPropVar);
 | 
			
		||||
				if (!SUCCEEDED(hr)) return;
 | 
			
		||||
 | 
			
		||||
				hr = propertyStore->Commit();
 | 
			
		||||
				if (!SUCCEEDED(hr)) return;
 | 
			
		||||
 | 
			
		||||
				if (persistFile->IsDirty() == S_OK) {
 | 
			
		||||
					persistFile->Save(fname.c_str(), TRUE);
 | 
			
		||||
				}
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} while (FindNextFile(findHandle, &findData));
 | 
			
		||||
	DWORD errorCode = GetLastError();
 | 
			
		||||
	if (errorCode && errorCode != ERROR_NO_MORE_FILES) { // everything is found
 | 
			
		||||
		LOG(("Init Error: could not find some files in pinned folder"));
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	FindClose(findHandle);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString systemShortcutPath() {
 | 
			
		||||
	static const int maxFileLen = MAX_PATH * 10;
 | 
			
		||||
	WCHAR wstrPath[maxFileLen];
 | 
			
		||||
	if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) {
 | 
			
		||||
		QDir appData(QString::fromStdWString(std::wstring(wstrPath)));
 | 
			
		||||
		return appData.absolutePath() + qsl("/Microsoft/Windows/Start Menu/Programs/");
 | 
			
		||||
	}
 | 
			
		||||
	return QString();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cleanupShortcut() {
 | 
			
		||||
	static const int maxFileLen = MAX_PATH * 10;
 | 
			
		||||
 | 
			
		||||
	QString path = systemShortcutPath() + qsl("Telegram.lnk");
 | 
			
		||||
	std::wstring p = QDir::toNativeSeparators(path).toStdWString();
 | 
			
		||||
 | 
			
		||||
	DWORD attributes = GetFileAttributes(p.c_str());
 | 
			
		||||
	if (attributes >= 0xFFFFFFF) return; // file does not exist
 | 
			
		||||
 | 
			
		||||
	ComPtr<IShellLink> shellLink;
 | 
			
		||||
	HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink));
 | 
			
		||||
	if (!SUCCEEDED(hr)) return;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IPersistFile> persistFile;
 | 
			
		||||
	hr = shellLink.As(&persistFile);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return;
 | 
			
		||||
 | 
			
		||||
	hr = persistFile->Load(p.c_str(), STGM_READWRITE);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return;
 | 
			
		||||
 | 
			
		||||
	WCHAR szGotPath[MAX_PATH];
 | 
			
		||||
	WIN32_FIND_DATA wfd;
 | 
			
		||||
	hr = shellLink->GetPath(szGotPath, MAX_PATH, (WIN32_FIND_DATA*)&wfd, SLGP_SHORTPATH);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return;
 | 
			
		||||
 | 
			
		||||
	if (QDir::toNativeSeparators(cExeDir() + cExeName()).toStdWString() == szGotPath) {
 | 
			
		||||
		QFile().remove(path);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool validateShortcutAt(const QString &path) {
 | 
			
		||||
	static const int maxFileLen = MAX_PATH * 10;
 | 
			
		||||
 | 
			
		||||
	std::wstring p = QDir::toNativeSeparators(path).toStdWString();
 | 
			
		||||
 | 
			
		||||
	DWORD attributes = GetFileAttributes(p.c_str());
 | 
			
		||||
	if (attributes >= 0xFFFFFFF) return false; // file does not exist
 | 
			
		||||
 | 
			
		||||
	ComPtr<IShellLink> shellLink;
 | 
			
		||||
	HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink));
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IPersistFile> persistFile;
 | 
			
		||||
	hr = shellLink.As(&persistFile);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = persistFile->Load(p.c_str(), STGM_READWRITE);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IPropertyStore> propertyStore;
 | 
			
		||||
	hr = shellLink.As(&propertyStore);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	PROPVARIANT appIdPropVar;
 | 
			
		||||
	hr = propertyStore->GetValue(getKey(), &appIdPropVar);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	WCHAR already[MAX_PATH];
 | 
			
		||||
	hr = Dlls::PropVariantToString(appIdPropVar, already, MAX_PATH);
 | 
			
		||||
	if (SUCCEEDED(hr)) {
 | 
			
		||||
		if (std::wstring(getId()) == already) {
 | 
			
		||||
			PropVariantClear(&appIdPropVar);
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (appIdPropVar.vt != VT_EMPTY) {
 | 
			
		||||
		PropVariantClear(&appIdPropVar);
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	PropVariantClear(&appIdPropVar);
 | 
			
		||||
 | 
			
		||||
	hr = InitPropVariantFromString(getId(), &appIdPropVar);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = propertyStore->SetValue(getKey(), appIdPropVar);
 | 
			
		||||
	PropVariantClear(&appIdPropVar);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = propertyStore->Commit();
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	if (persistFile->IsDirty() == S_OK) {
 | 
			
		||||
		persistFile->Save(p.c_str(), TRUE);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool validateShortcut() {
 | 
			
		||||
	QString path = systemShortcutPath();
 | 
			
		||||
	if (path.isEmpty()) return false;
 | 
			
		||||
 | 
			
		||||
	if (cBetaVersion()) {
 | 
			
		||||
		path += qsl("TelegramBeta.lnk");
 | 
			
		||||
		if (validateShortcutAt(path)) return true;
 | 
			
		||||
	} else {
 | 
			
		||||
		if (validateShortcutAt(path + qsl("Telegram Desktop/Telegram.lnk"))) return true;
 | 
			
		||||
		if (validateShortcutAt(path + qsl("Telegram Win (Unofficial)/Telegram.lnk"))) return true;
 | 
			
		||||
 | 
			
		||||
		path += qsl("Telegram.lnk");
 | 
			
		||||
		if (validateShortcutAt(path)) return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ComPtr<IShellLink> shellLink;
 | 
			
		||||
	HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink));
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = shellLink->SetPath(QDir::toNativeSeparators(cExeDir() + cExeName()).toStdWString().c_str());
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = shellLink->SetArguments(L"");
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = shellLink->SetWorkingDirectory(QDir::toNativeSeparators(QDir(cWorkingDir()).absolutePath()).toStdWString().c_str());
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IPropertyStore> propertyStore;
 | 
			
		||||
	hr = shellLink.As(&propertyStore);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	PROPVARIANT appIdPropVar;
 | 
			
		||||
	hr = InitPropVariantFromString(getId(), &appIdPropVar);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = propertyStore->SetValue(getKey(), appIdPropVar);
 | 
			
		||||
	PropVariantClear(&appIdPropVar);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	PROPVARIANT startPinPropVar;
 | 
			
		||||
	hr = InitPropVariantFromUInt32(APPUSERMODEL_STARTPINOPTION_NOPINONINSTALL, &startPinPropVar);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = propertyStore->SetValue(pkey_AppUserModel_StartPinOption, startPinPropVar);
 | 
			
		||||
	PropVariantClear(&startPinPropVar);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = propertyStore->Commit();
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IPersistFile> persistFile;
 | 
			
		||||
	hr = shellLink.As(&persistFile);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = persistFile->Save(QDir::toNativeSeparators(path).toStdWString().c_str(), TRUE);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const WCHAR *getId() {
 | 
			
		||||
	return cBetaVersion() ? AppUserModelIdBeta : AppUserModelIdRelease;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const PROPERTYKEY &getKey() {
 | 
			
		||||
	return pkey_AppUserModel_ID;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace AppUserModelId
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
/*
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
namespace AppUserModelId {
 | 
			
		||||
 | 
			
		||||
void cleanupShortcut();
 | 
			
		||||
void checkPinned();
 | 
			
		||||
 | 
			
		||||
const WCHAR *getId();
 | 
			
		||||
bool validateShortcut();
 | 
			
		||||
 | 
			
		||||
const PROPERTYKEY &getKey();
 | 
			
		||||
 | 
			
		||||
} // namespace AppUserModelId
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,76 @@
 | 
			
		|||
/*
 | 
			
		||||
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 "platform/win/windows_dlls.h"
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
namespace Dlls {
 | 
			
		||||
 | 
			
		||||
f_SetWindowTheme SetWindowTheme;
 | 
			
		||||
f_OpenAs_RunDLL OpenAs_RunDLL;
 | 
			
		||||
f_SHOpenWithDialog SHOpenWithDialog;
 | 
			
		||||
f_SHAssocEnumHandlers SHAssocEnumHandlers;
 | 
			
		||||
f_SHCreateItemFromParsingName SHCreateItemFromParsingName;
 | 
			
		||||
f_WTSRegisterSessionNotification WTSRegisterSessionNotification;
 | 
			
		||||
f_WTSUnRegisterSessionNotification WTSUnRegisterSessionNotification;
 | 
			
		||||
f_SHQueryUserNotificationState SHQueryUserNotificationState;
 | 
			
		||||
f_SetCurrentProcessExplicitAppUserModelID SetCurrentProcessExplicitAppUserModelID;
 | 
			
		||||
f_RoGetActivationFactory RoGetActivationFactory;
 | 
			
		||||
f_WindowsCreateStringReference WindowsCreateStringReference;
 | 
			
		||||
f_WindowsDeleteString WindowsDeleteString;
 | 
			
		||||
f_PropVariantToString PropVariantToString;
 | 
			
		||||
 | 
			
		||||
HINSTANCE LibUxTheme;
 | 
			
		||||
HINSTANCE LibShell32;
 | 
			
		||||
HINSTANCE LibWtsApi32;
 | 
			
		||||
HINSTANCE LibPropSys;
 | 
			
		||||
HINSTANCE LibComBase;
 | 
			
		||||
HINSTANCE LibWinRtString;
 | 
			
		||||
 | 
			
		||||
void start() {
 | 
			
		||||
	LibUxTheme = LoadLibrary(L"UXTHEME.DLL");
 | 
			
		||||
	load(LibUxTheme, "SetWindowTheme", SetWindowTheme);
 | 
			
		||||
 | 
			
		||||
	LibShell32 = LoadLibrary(L"SHELL32.DLL");
 | 
			
		||||
	load(LibShell32, "SHAssocEnumHandlers", SHAssocEnumHandlers);
 | 
			
		||||
	load(LibShell32, "SHCreateItemFromParsingName", SHCreateItemFromParsingName);
 | 
			
		||||
	load(LibShell32, "SHOpenWithDialog", SHOpenWithDialog);
 | 
			
		||||
	load(LibShell32, "OpenAs_RunDLLW", OpenAs_RunDLL);
 | 
			
		||||
	load(LibShell32, "SHQueryUserNotificationState", SHQueryUserNotificationState);
 | 
			
		||||
	load(LibShell32, "SetCurrentProcessExplicitAppUserModelID", SetCurrentProcessExplicitAppUserModelID);
 | 
			
		||||
 | 
			
		||||
	LibWtsApi32 = LoadLibrary(L"WTSAPI32.DLL");
 | 
			
		||||
	load(LibWtsApi32, "WTSRegisterSessionNotification", WTSRegisterSessionNotification);
 | 
			
		||||
	load(LibWtsApi32, "WTSUnRegisterSessionNotification", WTSUnRegisterSessionNotification);
 | 
			
		||||
 | 
			
		||||
	LibPropSys = LoadLibrary(L"PROPSYS.DLL");
 | 
			
		||||
	load(LibPropSys, "PropVariantToString", PropVariantToString);
 | 
			
		||||
 | 
			
		||||
	LibComBase = LoadLibrary(L"COMBASE.DLL");
 | 
			
		||||
	load(LibComBase, "RoGetActivationFactory", RoGetActivationFactory);
 | 
			
		||||
 | 
			
		||||
	LibWinRtString = LoadLibrary(L"api-ms-win-core-winrt-string-l1-1-0.dll");
 | 
			
		||||
	load(LibWinRtString, "WindowsCreateStringReference", WindowsCreateStringReference);
 | 
			
		||||
	load(LibWinRtString, "WindowsDeleteString", WindowsDeleteString);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace Dlls
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
*/
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#include <shlobj.h>
 | 
			
		||||
#include <roapi.h>
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
namespace Dlls {
 | 
			
		||||
 | 
			
		||||
void start();
 | 
			
		||||
 | 
			
		||||
template <typename Function>
 | 
			
		||||
bool load(HINSTANCE library, LPCSTR name, Function &func) {
 | 
			
		||||
	if (!library) return false;
 | 
			
		||||
 | 
			
		||||
	func = reinterpret_cast<Function>(GetProcAddress(library, name));
 | 
			
		||||
	return (func != nullptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UXTHEME.DLL
 | 
			
		||||
typedef HRESULT (FAR STDAPICALLTYPE *f_SetWindowTheme)(HWND hWnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList);
 | 
			
		||||
extern f_SetWindowTheme SetWindowTheme;
 | 
			
		||||
 | 
			
		||||
// SHELL32.DLL
 | 
			
		||||
typedef HRESULT (FAR STDAPICALLTYPE *f_SHAssocEnumHandlers)(PCWSTR pszExtra, ASSOC_FILTER afFilter, IEnumAssocHandlers **ppEnumHandler);
 | 
			
		||||
extern f_SHAssocEnumHandlers SHAssocEnumHandlers;
 | 
			
		||||
 | 
			
		||||
typedef HRESULT (FAR STDAPICALLTYPE *f_SHCreateItemFromParsingName)(PCWSTR pszPath, IBindCtx *pbc, REFIID riid, void **ppv);
 | 
			
		||||
extern f_SHCreateItemFromParsingName SHCreateItemFromParsingName;
 | 
			
		||||
 | 
			
		||||
typedef HRESULT (FAR STDAPICALLTYPE *f_SHOpenWithDialog)(HWND hwndParent, const OPENASINFO *poainfo);
 | 
			
		||||
extern f_SHOpenWithDialog SHOpenWithDialog;
 | 
			
		||||
 | 
			
		||||
typedef HRESULT (FAR STDAPICALLTYPE *f_OpenAs_RunDLL)(HWND hWnd, HINSTANCE hInstance, LPCWSTR lpszCmdLine, int nCmdShow);
 | 
			
		||||
extern f_OpenAs_RunDLL OpenAs_RunDLL;
 | 
			
		||||
 | 
			
		||||
typedef HRESULT (FAR STDAPICALLTYPE *f_SHQueryUserNotificationState)(QUERY_USER_NOTIFICATION_STATE *pquns);
 | 
			
		||||
extern f_SHQueryUserNotificationState SHQueryUserNotificationState;
 | 
			
		||||
 | 
			
		||||
typedef HRESULT (FAR STDAPICALLTYPE *f_SetCurrentProcessExplicitAppUserModelID)(__in PCWSTR AppID);
 | 
			
		||||
extern f_SetCurrentProcessExplicitAppUserModelID SetCurrentProcessExplicitAppUserModelID;
 | 
			
		||||
 | 
			
		||||
// WTSAPI32.DLL
 | 
			
		||||
 | 
			
		||||
typedef BOOL (FAR STDAPICALLTYPE *f_WTSRegisterSessionNotification)(HWND hWnd, DWORD dwFlags);
 | 
			
		||||
extern f_WTSRegisterSessionNotification WTSRegisterSessionNotification;
 | 
			
		||||
 | 
			
		||||
typedef BOOL (FAR STDAPICALLTYPE *f_WTSUnRegisterSessionNotification)(HWND hWnd);
 | 
			
		||||
extern f_WTSUnRegisterSessionNotification WTSUnRegisterSessionNotification;
 | 
			
		||||
 | 
			
		||||
// PROPSYS.DLL
 | 
			
		||||
 | 
			
		||||
typedef HRESULT (FAR STDAPICALLTYPE *f_PropVariantToString)(_In_ REFPROPVARIANT propvar, _Out_writes_(cch) PWSTR psz, _In_ UINT cch);
 | 
			
		||||
extern f_PropVariantToString PropVariantToString;
 | 
			
		||||
 | 
			
		||||
// COMBASE.DLL
 | 
			
		||||
 | 
			
		||||
typedef HRESULT (FAR STDAPICALLTYPE *f_RoGetActivationFactory)(_In_ HSTRING activatableClassId, _In_ REFIID iid, _COM_Outptr_ void ** factory);
 | 
			
		||||
extern f_RoGetActivationFactory RoGetActivationFactory;
 | 
			
		||||
 | 
			
		||||
// api-ms-win-core-winrt-string-l1-1-0.dll
 | 
			
		||||
 | 
			
		||||
typedef HRESULT (FAR STDAPICALLTYPE *f_WindowsCreateStringReference)(_In_reads_opt_(length + 1) PCWSTR sourceString, UINT32 length, _Out_ HSTRING_HEADER * hstringHeader, _Outptr_result_maybenull_ _Result_nullonfailure_ HSTRING * string);
 | 
			
		||||
extern f_WindowsCreateStringReference WindowsCreateStringReference;
 | 
			
		||||
 | 
			
		||||
typedef HRESULT (FAR STDAPICALLTYPE *f_WindowsDeleteString)(_In_opt_ HSTRING string);
 | 
			
		||||
extern f_WindowsDeleteString WindowsDeleteString;
 | 
			
		||||
 | 
			
		||||
} // namespace Dlls
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,260 @@
 | 
			
		|||
/*
 | 
			
		||||
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 "platform/win/windows_event_filter.h"
 | 
			
		||||
 | 
			
		||||
#include "mainwindow.h"
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
namespace {
 | 
			
		||||
 | 
			
		||||
EventFilter *instance = nullptr;
 | 
			
		||||
 | 
			
		||||
int menuShown = 0, menuHidden = 0;
 | 
			
		||||
 | 
			
		||||
} // namespace
 | 
			
		||||
 | 
			
		||||
EventFilter *EventFilter::createInstance() {
 | 
			
		||||
	destroy();
 | 
			
		||||
	instance = new EventFilter();
 | 
			
		||||
	return getInstance();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
EventFilter *EventFilter::getInstance() {
 | 
			
		||||
	return instance;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EventFilter::destroy() {
 | 
			
		||||
	delete instance;
 | 
			
		||||
	instance = nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result) {
 | 
			
		||||
	auto wnd = App::wnd();
 | 
			
		||||
	if (!wnd) return false;
 | 
			
		||||
 | 
			
		||||
	MSG *msg = (MSG*)message;
 | 
			
		||||
	if (msg->message == WM_ENDSESSION) {
 | 
			
		||||
		App::quit();
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	if (msg->hwnd == wnd->psHwnd() || msg->hwnd && !wnd->psHwnd()) {
 | 
			
		||||
		return mainWindowEvent(msg->hwnd, msg->message, msg->wParam, msg->lParam, (LRESULT*)result);
 | 
			
		||||
	}
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool EventFilter::mainWindowEvent(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) {
 | 
			
		||||
	using ShadowsChange = MainWindow::ShadowsChange;
 | 
			
		||||
 | 
			
		||||
	if (auto tbCreatedMsgId = Platform::MainWindow::TaskbarCreatedMsgId()) {
 | 
			
		||||
		if (msg == tbCreatedMsgId) {
 | 
			
		||||
			Platform::MainWindow::TaskbarCreated();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	switch (msg) {
 | 
			
		||||
 | 
			
		||||
	case WM_TIMECHANGE: {
 | 
			
		||||
		App::wnd()->checkAutoLockIn(100);
 | 
			
		||||
	} return false;
 | 
			
		||||
 | 
			
		||||
	case WM_WTSSESSION_CHANGE: {
 | 
			
		||||
		if (wParam == WTS_SESSION_LOGOFF || wParam == WTS_SESSION_LOCK) {
 | 
			
		||||
			setSessionLoggedOff(true);
 | 
			
		||||
		} else if (wParam == WTS_SESSION_LOGON || wParam == WTS_SESSION_UNLOCK) {
 | 
			
		||||
			setSessionLoggedOff(false);
 | 
			
		||||
		}
 | 
			
		||||
	} return false;
 | 
			
		||||
 | 
			
		||||
	case WM_DESTROY: {
 | 
			
		||||
		App::quit();
 | 
			
		||||
	} return false;
 | 
			
		||||
 | 
			
		||||
	case WM_ACTIVATE: {
 | 
			
		||||
		if (LOWORD(wParam) == WA_CLICKACTIVE) {
 | 
			
		||||
			App::wnd()->inactivePress(true);
 | 
			
		||||
		}
 | 
			
		||||
		if (LOWORD(wParam) != WA_INACTIVE) {
 | 
			
		||||
			App::wnd()->shadowsActivate();
 | 
			
		||||
		} else {
 | 
			
		||||
			App::wnd()->shadowsDeactivate();
 | 
			
		||||
		}
 | 
			
		||||
		if (Global::started()) {
 | 
			
		||||
			App::wnd()->update();
 | 
			
		||||
		}
 | 
			
		||||
	} return false;
 | 
			
		||||
 | 
			
		||||
	case WM_NCPAINT: if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8) return false; *result = 0; return true;
 | 
			
		||||
 | 
			
		||||
	case WM_NCCALCSIZE: {
 | 
			
		||||
		WINDOWPLACEMENT wp;
 | 
			
		||||
		wp.length = sizeof(WINDOWPLACEMENT);
 | 
			
		||||
		if (GetWindowPlacement(hWnd, &wp) && wp.showCmd == SW_SHOWMAXIMIZED) {
 | 
			
		||||
			LPNCCALCSIZE_PARAMS params = (LPNCCALCSIZE_PARAMS)lParam;
 | 
			
		||||
			LPRECT r = (wParam == TRUE) ? ¶ms->rgrc[0] : (LPRECT)lParam;
 | 
			
		||||
			HMONITOR hMonitor = MonitorFromPoint({ (r->left + r->right) / 2, (r->top + r->bottom) / 2 }, MONITOR_DEFAULTTONEAREST);
 | 
			
		||||
			if (hMonitor) {
 | 
			
		||||
				MONITORINFO mi;
 | 
			
		||||
				mi.cbSize = sizeof(mi);
 | 
			
		||||
				if (GetMonitorInfo(hMonitor, &mi)) {
 | 
			
		||||
					*r = mi.rcWork;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		*result = 0;
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	case WM_NCACTIVATE: {
 | 
			
		||||
		*result = DefWindowProc(hWnd, msg, wParam, -1);
 | 
			
		||||
	} return true;
 | 
			
		||||
 | 
			
		||||
	case WM_WINDOWPOSCHANGING:
 | 
			
		||||
	case WM_WINDOWPOSCHANGED: {
 | 
			
		||||
		WINDOWPLACEMENT wp;
 | 
			
		||||
		wp.length = sizeof(WINDOWPLACEMENT);
 | 
			
		||||
		if (GetWindowPlacement(hWnd, &wp) && (wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED)) {
 | 
			
		||||
			App::wnd()->shadowsUpdate(ShadowsChange::Hidden);
 | 
			
		||||
		} else {
 | 
			
		||||
			App::wnd()->shadowsUpdate(ShadowsChange::Moved | ShadowsChange::Resized, (WINDOWPOS*)lParam);
 | 
			
		||||
		}
 | 
			
		||||
	} return false;
 | 
			
		||||
 | 
			
		||||
	case WM_SIZE: {
 | 
			
		||||
		if (App::wnd()) {
 | 
			
		||||
			if (wParam == SIZE_MAXIMIZED || wParam == SIZE_RESTORED || wParam == SIZE_MINIMIZED) {
 | 
			
		||||
				if (wParam != SIZE_RESTORED || App::wnd()->windowState() != Qt::WindowNoState) {
 | 
			
		||||
					Qt::WindowState state = Qt::WindowNoState;
 | 
			
		||||
					if (wParam == SIZE_MAXIMIZED) {
 | 
			
		||||
						state = Qt::WindowMaximized;
 | 
			
		||||
					} else if (wParam == SIZE_MINIMIZED) {
 | 
			
		||||
						state = Qt::WindowMinimized;
 | 
			
		||||
					}
 | 
			
		||||
					emit App::wnd()->windowHandle()->windowStateChanged(state);
 | 
			
		||||
				} else {
 | 
			
		||||
					App::wnd()->psUpdatedPosition();
 | 
			
		||||
				}
 | 
			
		||||
				App::wnd()->psUpdateMargins();
 | 
			
		||||
				MainWindow::ShadowsChanges changes = (wParam == SIZE_MINIMIZED || wParam == SIZE_MAXIMIZED) ? ShadowsChange::Hidden : (ShadowsChange::Resized | ShadowsChange::Shown);
 | 
			
		||||
				App::wnd()->shadowsUpdate(changes);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} return false;
 | 
			
		||||
 | 
			
		||||
	case WM_SHOWWINDOW: {
 | 
			
		||||
		LONG style = GetWindowLong(hWnd, GWL_STYLE);
 | 
			
		||||
		auto changes = ShadowsChange::Resized | ((wParam && !(style & (WS_MAXIMIZE | WS_MINIMIZE))) ? ShadowsChange::Shown : ShadowsChange::Hidden);
 | 
			
		||||
		App::wnd()->shadowsUpdate(changes);
 | 
			
		||||
	} return false;
 | 
			
		||||
 | 
			
		||||
	case WM_MOVE: {
 | 
			
		||||
		App::wnd()->shadowsUpdate(ShadowsChange::Moved);
 | 
			
		||||
		App::wnd()->psUpdatedPosition();
 | 
			
		||||
	} return false;
 | 
			
		||||
 | 
			
		||||
	case WM_NCHITTEST: {
 | 
			
		||||
		POINTS p = MAKEPOINTS(lParam);
 | 
			
		||||
		RECT r;
 | 
			
		||||
		GetWindowRect(hWnd, &r);
 | 
			
		||||
		HitTestType res = App::wnd()->hitTest(QPoint(p.x - r.left + App::wnd()->deltaLeft(), p.y - r.top + App::wnd()->deltaTop()));
 | 
			
		||||
		switch (res) {
 | 
			
		||||
		case HitTestClient:
 | 
			
		||||
		case HitTestSysButton:   *result = HTCLIENT; break;
 | 
			
		||||
		case HitTestIcon:        *result = HTCAPTION; break;
 | 
			
		||||
		case HitTestCaption:     *result = HTCAPTION; break;
 | 
			
		||||
		case HitTestTop:         *result = HTTOP; break;
 | 
			
		||||
		case HitTestTopRight:    *result = HTTOPRIGHT; break;
 | 
			
		||||
		case HitTestRight:       *result = HTRIGHT; break;
 | 
			
		||||
		case HitTestBottomRight: *result = HTBOTTOMRIGHT; break;
 | 
			
		||||
		case HitTestBottom:      *result = HTBOTTOM; break;
 | 
			
		||||
		case HitTestBottomLeft:  *result = HTBOTTOMLEFT; break;
 | 
			
		||||
		case HitTestLeft:        *result = HTLEFT; break;
 | 
			
		||||
		case HitTestTopLeft:     *result = HTTOPLEFT; break;
 | 
			
		||||
		case HitTestNone:
 | 
			
		||||
		default:                 *result = HTTRANSPARENT; break;
 | 
			
		||||
		};
 | 
			
		||||
	} return true;
 | 
			
		||||
 | 
			
		||||
	case WM_NCRBUTTONUP: {
 | 
			
		||||
		SendMessage(hWnd, WM_SYSCOMMAND, SC_MOUSEMENU, lParam);
 | 
			
		||||
	} return true;
 | 
			
		||||
 | 
			
		||||
	case WM_NCLBUTTONDOWN: {
 | 
			
		||||
		POINTS p = MAKEPOINTS(lParam);
 | 
			
		||||
		RECT r;
 | 
			
		||||
		GetWindowRect(hWnd, &r);
 | 
			
		||||
		HitTestType res = App::wnd()->hitTest(QPoint(p.x - r.left + App::wnd()->deltaLeft(), p.y - r.top + App::wnd()->deltaTop()));
 | 
			
		||||
		switch (res) {
 | 
			
		||||
		case HitTestIcon:
 | 
			
		||||
		if (menuHidden && getms() < menuHidden + 10) {
 | 
			
		||||
			menuHidden = 0;
 | 
			
		||||
			if (getms() < menuShown + GetDoubleClickTime()) {
 | 
			
		||||
				App::wnd()->close();
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			QRect icon = App::wnd()->iconRect();
 | 
			
		||||
			p.x = r.left - App::wnd()->deltaLeft() + icon.left();
 | 
			
		||||
			p.y = r.top - App::wnd()->deltaTop() + icon.top() + icon.height();
 | 
			
		||||
			App::wnd()->psUpdateSysMenu(App::wnd()->windowHandle()->windowState());
 | 
			
		||||
			menuShown = getms();
 | 
			
		||||
			menuHidden = 0;
 | 
			
		||||
			TrackPopupMenu(App::wnd()->psMenu(), TPM_LEFTALIGN | TPM_TOPALIGN | TPM_LEFTBUTTON, p.x, p.y, 0, hWnd, 0);
 | 
			
		||||
			menuHidden = getms();
 | 
			
		||||
		}
 | 
			
		||||
		return true;
 | 
			
		||||
		};
 | 
			
		||||
	} return false;
 | 
			
		||||
 | 
			
		||||
	case WM_NCLBUTTONDBLCLK: {
 | 
			
		||||
		POINTS p = MAKEPOINTS(lParam);
 | 
			
		||||
		RECT r;
 | 
			
		||||
		GetWindowRect(hWnd, &r);
 | 
			
		||||
		HitTestType res = App::wnd()->hitTest(QPoint(p.x - r.left + App::wnd()->deltaLeft(), p.y - r.top + App::wnd()->deltaTop()));
 | 
			
		||||
		switch (res) {
 | 
			
		||||
		case HitTestIcon: App::wnd()->close(); return true;
 | 
			
		||||
		};
 | 
			
		||||
	} return false;
 | 
			
		||||
 | 
			
		||||
	case WM_SYSCOMMAND: {
 | 
			
		||||
		if (wParam == SC_MOUSEMENU) {
 | 
			
		||||
			POINTS p = MAKEPOINTS(lParam);
 | 
			
		||||
			App::wnd()->psUpdateSysMenu(App::wnd()->windowHandle()->windowState());
 | 
			
		||||
			TrackPopupMenu(App::wnd()->psMenu(), TPM_LEFTALIGN | TPM_TOPALIGN | TPM_LEFTBUTTON, p.x, p.y, 0, hWnd, 0);
 | 
			
		||||
		}
 | 
			
		||||
	} return false;
 | 
			
		||||
 | 
			
		||||
	case WM_COMMAND: {
 | 
			
		||||
		if (HIWORD(wParam)) return false;
 | 
			
		||||
		int cmd = LOWORD(wParam);
 | 
			
		||||
		switch (cmd) {
 | 
			
		||||
		case SC_CLOSE: App::wnd()->close(); return true;
 | 
			
		||||
		case SC_MINIMIZE: App::wnd()->setWindowState(Qt::WindowMinimized); return true;
 | 
			
		||||
		case SC_MAXIMIZE: App::wnd()->setWindowState(Qt::WindowMaximized); return true;
 | 
			
		||||
		case SC_RESTORE: App::wnd()->setWindowState(Qt::WindowNoState); return true;
 | 
			
		||||
		}
 | 
			
		||||
	} return true;
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,51 @@
 | 
			
		|||
/*
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
 | 
			
		||||
class EventFilter : public QAbstractNativeEventFilter {
 | 
			
		||||
public:
 | 
			
		||||
	bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
 | 
			
		||||
	bool mainWindowEvent(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result);
 | 
			
		||||
 | 
			
		||||
	bool sessionLoggedOff() const {
 | 
			
		||||
		return _sessionLoggedOff;
 | 
			
		||||
	}
 | 
			
		||||
	void setSessionLoggedOff(bool loggedOff) {
 | 
			
		||||
		_sessionLoggedOff = loggedOff;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	static EventFilter *createInstance();
 | 
			
		||||
	static EventFilter *getInstance();
 | 
			
		||||
	static void destroy();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	EventFilter() {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	bool _sessionLoggedOff = false;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,554 @@
 | 
			
		|||
/*
 | 
			
		||||
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 "platform/win/windows_toasts.h"
 | 
			
		||||
 | 
			
		||||
#include "platform/win/windows_app_user_model_id.h"
 | 
			
		||||
#include "platform/win/windows_dlls.h"
 | 
			
		||||
#include "mainwindow.h"
 | 
			
		||||
 | 
			
		||||
#include <Shobjidl.h>
 | 
			
		||||
#include <shellapi.h>
 | 
			
		||||
 | 
			
		||||
#include <roapi.h>
 | 
			
		||||
#include <wrl\client.h>
 | 
			
		||||
#include <wrl\implements.h>
 | 
			
		||||
#include <windows.ui.notifications.h>
 | 
			
		||||
 | 
			
		||||
#include <strsafe.h>
 | 
			
		||||
#include <intsafe.h>
 | 
			
		||||
 | 
			
		||||
HICON qt_pixmapToWinHICON(const QPixmap &);
 | 
			
		||||
 | 
			
		||||
using namespace Microsoft::WRL;
 | 
			
		||||
using namespace ABI::Windows::UI::Notifications;
 | 
			
		||||
using namespace ABI::Windows::Data::Xml::Dom;
 | 
			
		||||
using namespace Windows::Foundation;
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
namespace Toasts {
 | 
			
		||||
namespace {
 | 
			
		||||
 | 
			
		||||
bool _supported = false;
 | 
			
		||||
 | 
			
		||||
ComPtr<IToastNotificationManagerStatics> _notificationManager;
 | 
			
		||||
ComPtr<IToastNotifier> _notifier;
 | 
			
		||||
ComPtr<IToastNotificationFactory> _notificationFactory;
 | 
			
		||||
 | 
			
		||||
struct NotificationPtr {
 | 
			
		||||
	NotificationPtr() {
 | 
			
		||||
	}
 | 
			
		||||
	NotificationPtr(const ComPtr<IToastNotification> &ptr) : p(ptr) {
 | 
			
		||||
	}
 | 
			
		||||
	ComPtr<IToastNotification> p;
 | 
			
		||||
};
 | 
			
		||||
using Notifications = QMap<PeerId, QMap<MsgId, NotificationPtr>>;
 | 
			
		||||
Notifications _notifications;
 | 
			
		||||
struct Image {
 | 
			
		||||
	uint64 until;
 | 
			
		||||
	QString path;
 | 
			
		||||
};
 | 
			
		||||
using Images = QMap<StorageKey, Image>;
 | 
			
		||||
Images _images;
 | 
			
		||||
bool _imageSavedFlag = false;
 | 
			
		||||
 | 
			
		||||
class StringReferenceWrapper {
 | 
			
		||||
public:
 | 
			
		||||
	StringReferenceWrapper(_In_reads_(length) PCWSTR stringRef, _In_ UINT32 length) throw() {
 | 
			
		||||
		HRESULT hr = Dlls::WindowsCreateStringReference(stringRef, length, &_header, &_hstring);
 | 
			
		||||
		if (!SUCCEEDED(hr)) {
 | 
			
		||||
			RaiseException(static_cast<DWORD>(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	~StringReferenceWrapper() {
 | 
			
		||||
		Dlls::WindowsDeleteString(_hstring);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	template <size_t N>
 | 
			
		||||
	StringReferenceWrapper(_In_reads_(N) wchar_t const (&stringRef)[N]) throw() {
 | 
			
		||||
		UINT32 length = N - 1;
 | 
			
		||||
		HRESULT hr = Dlls::WindowsCreateStringReference(stringRef, length, &_header, &_hstring);
 | 
			
		||||
		if (!SUCCEEDED(hr)) {
 | 
			
		||||
			RaiseException(static_cast<DWORD>(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	template <size_t _>
 | 
			
		||||
	StringReferenceWrapper(_In_reads_(_) wchar_t(&stringRef)[_]) throw() {
 | 
			
		||||
		UINT32 length;
 | 
			
		||||
		HRESULT hr = SizeTToUInt32(wcslen(stringRef), &length);
 | 
			
		||||
		if (!SUCCEEDED(hr)) {
 | 
			
		||||
			RaiseException(static_cast<DWORD>(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Dlls::WindowsCreateStringReference(stringRef, length, &_header, &_hstring);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	HSTRING Get() const throw() {
 | 
			
		||||
		return _hstring;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	HSTRING _hstring;
 | 
			
		||||
	HSTRING_HEADER _header;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
template<class T>
 | 
			
		||||
_Check_return_ __inline HRESULT _1_GetActivationFactory(_In_ HSTRING activatableClassId, _COM_Outptr_ T** factory) {
 | 
			
		||||
	return Dlls::RoGetActivationFactory(activatableClassId, IID_INS_ARGS(factory));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<typename T>
 | 
			
		||||
inline HRESULT wrap_GetActivationFactory(_In_ HSTRING activatableClassId, _Inout_ Details::ComPtrRef<T> factory) throw() {
 | 
			
		||||
	return _1_GetActivationFactory(activatableClassId, factory.ReleaseAndGetAddressOf());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool init() {
 | 
			
		||||
	if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS8) {
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	if ((Dlls::SetCurrentProcessExplicitAppUserModelID == nullptr)
 | 
			
		||||
		|| (Dlls::PropVariantToString == nullptr)
 | 
			
		||||
		|| (Dlls::RoGetActivationFactory == nullptr)
 | 
			
		||||
		|| (Dlls::WindowsCreateStringReference == nullptr)
 | 
			
		||||
		|| (Dlls::WindowsDeleteString == nullptr)) {
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!AppUserModelId::validateShortcut()) {
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	auto appUserModelId = AppUserModelId::getId();
 | 
			
		||||
	if (!SUCCEEDED(Dlls::SetCurrentProcessExplicitAppUserModelID(appUserModelId))) {
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	if (!SUCCEEDED(wrap_GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(), &_notificationManager))) {
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	if (!SUCCEEDED(_notificationManager->CreateToastNotifierWithId(StringReferenceWrapper(appUserModelId, wcslen(appUserModelId)).Get(), &_notifier))) {
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	if (!SUCCEEDED(wrap_GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotification).Get(), &_notificationFactory))) {
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	QDir().mkpath(cWorkingDir() + qsl("tdata/temp"));
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace
 | 
			
		||||
 | 
			
		||||
void start() {
 | 
			
		||||
	_supported = init();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool supported() {
 | 
			
		||||
	return _supported;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint64 clearImages(uint64 ms) {
 | 
			
		||||
	uint64 result = 0;
 | 
			
		||||
	for (auto i = _images.begin(); i != _images.end();) {
 | 
			
		||||
		if (!i->until) {
 | 
			
		||||
			++i;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		if (i->until <= ms) {
 | 
			
		||||
			QFile(i->path).remove();
 | 
			
		||||
			i = _images.erase(i);
 | 
			
		||||
		} else {
 | 
			
		||||
			if (!result) {
 | 
			
		||||
				result = i->until;
 | 
			
		||||
			} else {
 | 
			
		||||
				accumulate_min(result, i->until);
 | 
			
		||||
			}
 | 
			
		||||
			++i;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void clearNotifies(PeerId peerId) {
 | 
			
		||||
	if (!_notifier) return;
 | 
			
		||||
 | 
			
		||||
	if (peerId) {
 | 
			
		||||
		auto i = _notifications.find(peerId);
 | 
			
		||||
		if (i != _notifications.cend()) {
 | 
			
		||||
			auto temp = createAndSwap(i.value());
 | 
			
		||||
			_notifications.erase(i);
 | 
			
		||||
 | 
			
		||||
			for (auto j = temp.cbegin(), e = temp.cend(); j != e; ++j) {
 | 
			
		||||
				_notifier->Hide(j->p.Get());
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		auto temp = createAndSwap(_notifications);
 | 
			
		||||
		for_const (auto ¬ifications, temp) {
 | 
			
		||||
			for_const (auto ¬ification, notifications) {
 | 
			
		||||
				_notifier->Hide(notification.p.Get());
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void finish() {
 | 
			
		||||
	_notifications.clear();
 | 
			
		||||
	if (_notificationManager) _notificationManager.Reset();
 | 
			
		||||
	if (_notifier) _notifier.Reset();
 | 
			
		||||
	if (_notificationFactory) _notificationFactory.Reset();
 | 
			
		||||
 | 
			
		||||
	if (_imageSavedFlag) {
 | 
			
		||||
		psDeleteDir(cWorkingDir() + qsl("tdata/temp"));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
HRESULT SetNodeValueString(_In_ HSTRING inputString, _In_ IXmlNode *node, _In_ IXmlDocument *xml) {
 | 
			
		||||
	ComPtr<IXmlText> inputText;
 | 
			
		||||
 | 
			
		||||
	HRESULT hr = xml->CreateTextNode(inputString, &inputText);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
	ComPtr<IXmlNode> inputTextNode;
 | 
			
		||||
 | 
			
		||||
	hr = inputText.As(&inputTextNode);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IXmlNode> pAppendedChild;
 | 
			
		||||
	return node->AppendChild(inputTextNode.Get(), &pAppendedChild);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
HRESULT SetAudioSilent(_In_ IXmlDocument *toastXml) {
 | 
			
		||||
	ComPtr<IXmlNodeList> nodeList;
 | 
			
		||||
	HRESULT hr = toastXml->GetElementsByTagName(StringReferenceWrapper(L"audio").Get(), &nodeList);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IXmlNode> audioNode;
 | 
			
		||||
	hr = nodeList->Item(0, &audioNode);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
	if (audioNode) {
 | 
			
		||||
		ComPtr<IXmlElement> audioElement;
 | 
			
		||||
		hr = audioNode.As(&audioElement);
 | 
			
		||||
		if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
		hr = audioElement->SetAttribute(StringReferenceWrapper(L"silent").Get(), StringReferenceWrapper(L"true").Get());
 | 
			
		||||
		if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
	} else {
 | 
			
		||||
		ComPtr<IXmlElement> audioElement;
 | 
			
		||||
		hr = toastXml->CreateElement(StringReferenceWrapper(L"audio").Get(), &audioElement);
 | 
			
		||||
		if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
		hr = audioElement->SetAttribute(StringReferenceWrapper(L"silent").Get(), StringReferenceWrapper(L"true").Get());
 | 
			
		||||
		if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
		ComPtr<IXmlNode> audioNode;
 | 
			
		||||
		hr = audioElement.As(&audioNode);
 | 
			
		||||
		if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
		ComPtr<IXmlNodeList> nodeList;
 | 
			
		||||
		hr = toastXml->GetElementsByTagName(StringReferenceWrapper(L"toast").Get(), &nodeList);
 | 
			
		||||
		if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
		ComPtr<IXmlNode> toastNode;
 | 
			
		||||
		hr = nodeList->Item(0, &toastNode);
 | 
			
		||||
		if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
		ComPtr<IXmlNode> appendedNode;
 | 
			
		||||
		hr = toastNode->AppendChild(audioNode.Get(), &appendedNode);
 | 
			
		||||
	}
 | 
			
		||||
	return hr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
HRESULT SetImageSrc(_In_z_ const wchar_t *imagePath, _In_ IXmlDocument *toastXml) {
 | 
			
		||||
	wchar_t imageSrc[MAX_PATH] = L"file:///";
 | 
			
		||||
	HRESULT hr = StringCchCat(imageSrc, ARRAYSIZE(imageSrc), imagePath);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IXmlNodeList> nodeList;
 | 
			
		||||
	hr = toastXml->GetElementsByTagName(StringReferenceWrapper(L"image").Get(), &nodeList);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IXmlNode> imageNode;
 | 
			
		||||
	hr = nodeList->Item(0, &imageNode);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IXmlNamedNodeMap> attributes;
 | 
			
		||||
	hr = imageNode->get_Attributes(&attributes);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IXmlNode> srcAttribute;
 | 
			
		||||
	hr = attributes->GetNamedItem(StringReferenceWrapper(L"src").Get(), &srcAttribute);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return hr;
 | 
			
		||||
 | 
			
		||||
	return SetNodeValueString(StringReferenceWrapper(imageSrc).Get(), srcAttribute.Get(), toastXml);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
typedef ABI::Windows::Foundation::ITypedEventHandler<ToastNotification*, ::IInspectable *> DesktopToastActivatedEventHandler;
 | 
			
		||||
typedef ABI::Windows::Foundation::ITypedEventHandler<ToastNotification*, ToastDismissedEventArgs*> DesktopToastDismissedEventHandler;
 | 
			
		||||
typedef ABI::Windows::Foundation::ITypedEventHandler<ToastNotification*, ToastFailedEventArgs*> DesktopToastFailedEventHandler;
 | 
			
		||||
 | 
			
		||||
class ToastEventHandler : public Implements<DesktopToastActivatedEventHandler, DesktopToastDismissedEventHandler, DesktopToastFailedEventHandler> {
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
	ToastEventHandler::ToastEventHandler(const PeerId &peer, MsgId msg) : _ref(1), _peerId(peer), _msgId(msg) {
 | 
			
		||||
	}
 | 
			
		||||
	~ToastEventHandler() {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// DesktopToastActivatedEventHandler
 | 
			
		||||
	IFACEMETHODIMP Invoke(_In_ IToastNotification *sender, _In_ IInspectable* args) {
 | 
			
		||||
		auto i = _notifications.find(_peerId);
 | 
			
		||||
		if (i != _notifications.cend()) {
 | 
			
		||||
			i.value().remove(_msgId);
 | 
			
		||||
			if (i.value().isEmpty()) {
 | 
			
		||||
				_notifications.erase(i);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (App::wnd()) {
 | 
			
		||||
			History *history = App::history(_peerId);
 | 
			
		||||
 | 
			
		||||
			App::wnd()->showFromTray();
 | 
			
		||||
			if (App::passcoded()) {
 | 
			
		||||
				App::wnd()->setInnerFocus();
 | 
			
		||||
				App::wnd()->notifyClear();
 | 
			
		||||
			} else {
 | 
			
		||||
				App::wnd()->hideSettings();
 | 
			
		||||
				bool tomsg = !history->peer->isUser() && (_msgId > 0);
 | 
			
		||||
				if (tomsg) {
 | 
			
		||||
					HistoryItem *item = App::histItemById(peerToChannel(_peerId), _msgId);
 | 
			
		||||
					if (!item || !item->mentionsMe()) {
 | 
			
		||||
						tomsg = false;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				Ui::showPeerHistory(history, tomsg ? _msgId : ShowAtUnreadMsgId);
 | 
			
		||||
				App::wnd()->notifyClear(history);
 | 
			
		||||
			}
 | 
			
		||||
			SetForegroundWindow(App::wnd()->psHwnd());
 | 
			
		||||
		}
 | 
			
		||||
		return S_OK;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// DesktopToastDismissedEventHandler
 | 
			
		||||
	IFACEMETHODIMP Invoke(_In_ IToastNotification *sender, _In_ IToastDismissedEventArgs *e) {
 | 
			
		||||
		ToastDismissalReason tdr;
 | 
			
		||||
		if (SUCCEEDED(e->get_Reason(&tdr))) {
 | 
			
		||||
			switch (tdr) {
 | 
			
		||||
			case ToastDismissalReason_ApplicationHidden:
 | 
			
		||||
			break;
 | 
			
		||||
			case ToastDismissalReason_UserCanceled:
 | 
			
		||||
			case ToastDismissalReason_TimedOut:
 | 
			
		||||
			default:
 | 
			
		||||
			auto i = _notifications.find(_peerId);
 | 
			
		||||
			if (i != _notifications.cend()) {
 | 
			
		||||
				i.value().remove(_msgId);
 | 
			
		||||
				if (i.value().isEmpty()) {
 | 
			
		||||
					_notifications.erase(i);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return S_OK;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// DesktopToastFailedEventHandler
 | 
			
		||||
	IFACEMETHODIMP Invoke(_In_ IToastNotification *sender, _In_ IToastFailedEventArgs *e) {
 | 
			
		||||
		auto i = _notifications.find(_peerId);
 | 
			
		||||
		if (i != _notifications.cend()) {
 | 
			
		||||
			i.value().remove(_msgId);
 | 
			
		||||
			if (i.value().isEmpty()) {
 | 
			
		||||
				_notifications.erase(i);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return S_OK;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// IUnknown
 | 
			
		||||
	IFACEMETHODIMP_(ULONG) AddRef() {
 | 
			
		||||
		return InterlockedIncrement(&_ref);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	IFACEMETHODIMP_(ULONG) Release() {
 | 
			
		||||
		ULONG l = InterlockedDecrement(&_ref);
 | 
			
		||||
		if (l == 0) delete this;
 | 
			
		||||
		return l;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	IFACEMETHODIMP QueryInterface(_In_ REFIID riid, _COM_Outptr_ void **ppv) {
 | 
			
		||||
		if (IsEqualIID(riid, IID_IUnknown))
 | 
			
		||||
			*ppv = static_cast<IUnknown*>(static_cast<DesktopToastActivatedEventHandler*>(this));
 | 
			
		||||
		else if (IsEqualIID(riid, __uuidof(DesktopToastActivatedEventHandler)))
 | 
			
		||||
			*ppv = static_cast<DesktopToastActivatedEventHandler*>(this);
 | 
			
		||||
		else if (IsEqualIID(riid, __uuidof(DesktopToastDismissedEventHandler)))
 | 
			
		||||
			*ppv = static_cast<DesktopToastDismissedEventHandler*>(this);
 | 
			
		||||
		else if (IsEqualIID(riid, __uuidof(DesktopToastFailedEventHandler)))
 | 
			
		||||
			*ppv = static_cast<DesktopToastFailedEventHandler*>(this);
 | 
			
		||||
		else *ppv = nullptr;
 | 
			
		||||
 | 
			
		||||
		if (*ppv) {
 | 
			
		||||
			reinterpret_cast<IUnknown*>(*ppv)->AddRef();
 | 
			
		||||
			return S_OK;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return E_NOINTERFACE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
	ULONG _ref;
 | 
			
		||||
	PeerId _peerId;
 | 
			
		||||
	MsgId _msgId;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
QString getImage(const StorageKey &key, PeerData *peer) {
 | 
			
		||||
	uint64 ms = getms(true);
 | 
			
		||||
	auto i = _images.find(key);
 | 
			
		||||
	if (i != _images.cend()) {
 | 
			
		||||
		if (i->until) {
 | 
			
		||||
			i->until = ms + NotifyDeletePhotoAfter;
 | 
			
		||||
			if (App::wnd()) App::wnd()->psCleanNotifyPhotosIn(-NotifyDeletePhotoAfter);
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		Image v;
 | 
			
		||||
		if (key.first) {
 | 
			
		||||
			v.until = ms + NotifyDeletePhotoAfter;
 | 
			
		||||
			if (App::wnd()) App::wnd()->psCleanNotifyPhotosIn(-NotifyDeletePhotoAfter);
 | 
			
		||||
		} else {
 | 
			
		||||
			v.until = 0;
 | 
			
		||||
		}
 | 
			
		||||
		v.path = cWorkingDir() + qsl("tdata/temp/") + QString::number(rand_value<uint64>(), 16) + qsl(".png");
 | 
			
		||||
		if (key.first || key.second) {
 | 
			
		||||
			peer->saveUserpic(v.path);
 | 
			
		||||
		} else {
 | 
			
		||||
			App::wnd()->iconLarge().save(v.path, "PNG");
 | 
			
		||||
		}
 | 
			
		||||
		i = _images.insert(key, v);
 | 
			
		||||
		_imageSavedFlag = true;
 | 
			
		||||
	}
 | 
			
		||||
	return i->path;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool create(PeerData *peer, int32 msgId, bool showpix, const QString &title, const QString &subtitle, const QString &msg) {
 | 
			
		||||
	if (!supported() || !_notificationManager || !_notifier || !_notificationFactory) return false;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IXmlDocument> toastXml;
 | 
			
		||||
	bool withSubtitle = !subtitle.isEmpty();
 | 
			
		||||
 | 
			
		||||
	HRESULT hr = _notificationManager->GetTemplateContent(withSubtitle ? ToastTemplateType_ToastImageAndText04 : ToastTemplateType_ToastImageAndText02, &toastXml);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = SetAudioSilent(toastXml.Get());
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	StorageKey key;
 | 
			
		||||
	QString imagePath;
 | 
			
		||||
	if (showpix) {
 | 
			
		||||
		key = peer->userpicUniqueKey();
 | 
			
		||||
	} else {
 | 
			
		||||
		key = StorageKey(0, 0);
 | 
			
		||||
	}
 | 
			
		||||
	QString image = getImage(key, peer);
 | 
			
		||||
	std::wstring wimage = QDir::toNativeSeparators(image).toStdWString();
 | 
			
		||||
 | 
			
		||||
	hr = SetImageSrc(wimage.c_str(), toastXml.Get());
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	ComPtr<IXmlNodeList> nodeList;
 | 
			
		||||
	hr = toastXml->GetElementsByTagName(StringReferenceWrapper(L"text").Get(), &nodeList);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	UINT32 nodeListLength;
 | 
			
		||||
	hr = nodeList->get_Length(&nodeListLength);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	if (nodeListLength < (withSubtitle ? 3U : 2U)) return false;
 | 
			
		||||
 | 
			
		||||
	{
 | 
			
		||||
		ComPtr<IXmlNode> textNode;
 | 
			
		||||
		hr = nodeList->Item(0, &textNode);
 | 
			
		||||
		if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
		std::wstring wtitle = title.toStdWString();
 | 
			
		||||
		hr = SetNodeValueString(StringReferenceWrapper(wtitle.data(), wtitle.size()).Get(), textNode.Get(), toastXml.Get());
 | 
			
		||||
		if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
	}
 | 
			
		||||
	if (withSubtitle) {
 | 
			
		||||
		ComPtr<IXmlNode> textNode;
 | 
			
		||||
		hr = nodeList->Item(1, &textNode);
 | 
			
		||||
		if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
		std::wstring wsubtitle = subtitle.toStdWString();
 | 
			
		||||
		hr = SetNodeValueString(StringReferenceWrapper(wsubtitle.data(), wsubtitle.size()).Get(), textNode.Get(), toastXml.Get());
 | 
			
		||||
		if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
	}
 | 
			
		||||
	{
 | 
			
		||||
		ComPtr<IXmlNode> textNode;
 | 
			
		||||
		hr = nodeList->Item(withSubtitle ? 2 : 1, &textNode);
 | 
			
		||||
		if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
		std::wstring wmsg = msg.toStdWString();
 | 
			
		||||
		hr = SetNodeValueString(StringReferenceWrapper(wmsg.data(), wmsg.size()).Get(), textNode.Get(), toastXml.Get());
 | 
			
		||||
		if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ComPtr<IToastNotification> toast;
 | 
			
		||||
	hr = _notificationFactory->CreateToastNotification(toastXml.Get(), &toast);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	EventRegistrationToken activatedToken, dismissedToken, failedToken;
 | 
			
		||||
	ComPtr<ToastEventHandler> eventHandler(new ToastEventHandler(peer->id, msgId));
 | 
			
		||||
 | 
			
		||||
	hr = toast->add_Activated(eventHandler.Get(), &activatedToken);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = toast->add_Dismissed(eventHandler.Get(), &dismissedToken);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	hr = toast->add_Failed(eventHandler.Get(), &failedToken);
 | 
			
		||||
	if (!SUCCEEDED(hr)) return false;
 | 
			
		||||
 | 
			
		||||
	auto i = _notifications.find(peer->id);
 | 
			
		||||
	if (i != _notifications.cend()) {
 | 
			
		||||
		auto j = i->find(msgId);
 | 
			
		||||
		if (j != i->cend()) {
 | 
			
		||||
			ComPtr<IToastNotification> notify = j->p;
 | 
			
		||||
			i->erase(j);
 | 
			
		||||
			_notifier->Hide(notify.Get());
 | 
			
		||||
			i = _notifications.find(peer->id);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (i == _notifications.cend()) {
 | 
			
		||||
		i = _notifications.insert(peer->id, QMap<MsgId, NotificationPtr>());
 | 
			
		||||
	}
 | 
			
		||||
	hr = _notifier->Show(toast.Get());
 | 
			
		||||
	if (!SUCCEEDED(hr)) {
 | 
			
		||||
		i = _notifications.find(peer->id);
 | 
			
		||||
		if (i != _notifications.cend() && i->isEmpty()) _notifications.erase(i);
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	_notifications[peer->id].insert(msgId, toast);
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace Toasts
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
/*
 | 
			
		||||
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 Platform {
 | 
			
		||||
namespace Toasts {
 | 
			
		||||
 | 
			
		||||
void start();
 | 
			
		||||
void finish();
 | 
			
		||||
 | 
			
		||||
bool supported();
 | 
			
		||||
bool create(PeerData *peer, int32 msgId, bool showpix, const QString &title, const QString &subtitle, const QString &msg);
 | 
			
		||||
 | 
			
		||||
// Returns the next ms when clearImages() should be called.
 | 
			
		||||
uint64 clearImages(uint64 ms);
 | 
			
		||||
 | 
			
		||||
void clearNotifies(PeerId peerId);
 | 
			
		||||
 | 
			
		||||
} // namespace Toasts
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,29 @@
 | 
			
		|||
/*
 | 
			
		||||
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 "platform/win/main_window_winrt.h"
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
namespace {
 | 
			
		||||
 | 
			
		||||
} // namespace
 | 
			
		||||
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
/*
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
#include "window/main_window.h"
 | 
			
		||||
 | 
			
		||||
namespace Platform {
 | 
			
		||||
 | 
			
		||||
class MainWindow : public Window::MainWindow {
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			@ -26,26 +26,23 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
 | 
			
		|||
 | 
			
		||||
#ifdef Q_OS_MAC
 | 
			
		||||
#include "pspecific_mac.h"
 | 
			
		||||
#endif // Q_OS_MAC
 | 
			
		||||
 | 
			
		||||
#ifdef Q_OS_LINUX
 | 
			
		||||
#elif defined Q_OS_LINUX // Q_OS_MAC
 | 
			
		||||
#include "pspecific_linux.h"
 | 
			
		||||
#endif // Q_OS_LINUX
 | 
			
		||||
 | 
			
		||||
#ifdef Q_OS_WINRT
 | 
			
		||||
#elif defined Q_OS_WINRT // Q_OS_MAC || Q_OS_LINUX
 | 
			
		||||
#include "pspecific_winrt.h"
 | 
			
		||||
#elif defined Q_OS_WIN // Q_OS_WINRT
 | 
			
		||||
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT
 | 
			
		||||
#include "pspecific_win.h"
 | 
			
		||||
#endif // Q_OS_WIN*
 | 
			
		||||
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
 | 
			
		||||
 | 
			
		||||
namespace PlatformSpecific {
 | 
			
		||||
namespace Platform {
 | 
			
		||||
 | 
			
		||||
	void start();
 | 
			
		||||
	void finish();
 | 
			
		||||
void start();
 | 
			
		||||
void finish();
 | 
			
		||||
 | 
			
		||||
	namespace ThirdParty {
 | 
			
		||||
		void start();
 | 
			
		||||
		void finish();
 | 
			
		||||
	}
 | 
			
		||||
namespace ThirdParty {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
void start();
 | 
			
		||||
void finish();
 | 
			
		||||
 | 
			
		||||
} // namespace ThirdParty
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -499,412 +499,6 @@ namespace {
 | 
			
		|||
    UnityLauncherEntry *_psUnityLauncherEntry = 0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
PsMainWindow::PsMainWindow(QWidget *parent) : QMainWindow(parent),
 | 
			
		||||
posInited(false), trayIcon(0), trayIconMenu(0), icon256(qsl(":/gui/art/icon256.png")), iconbig256(icon256), wndIcon(QIcon::fromTheme("telegram", QIcon(QPixmap::fromImage(icon256, Qt::ColorOnly)))), _psCheckStatusIconLeft(100), _psLastIndicatorUpdate(0) {
 | 
			
		||||
    connect(&_psCheckStatusIconTimer, SIGNAL(timeout()), this, SLOT(psStatusIconCheck()));
 | 
			
		||||
    _psCheckStatusIconTimer.setSingleShot(false);
 | 
			
		||||
 | 
			
		||||
    connect(&_psUpdateIndicatorTimer, SIGNAL(timeout()), this, SLOT(psUpdateIndicator()));
 | 
			
		||||
    _psUpdateIndicatorTimer.setSingleShot(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool PsMainWindow::psHasTrayIcon() const {
 | 
			
		||||
    return trayIcon || ((useAppIndicator || (useStatusIcon && trayIconChecked)) && (cWorkMode() != dbiwmWindowOnly));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psStatusIconCheck() {
 | 
			
		||||
    _trayIconCheck(0);
 | 
			
		||||
    if (cSupportTray() || !--_psCheckStatusIconLeft) {
 | 
			
		||||
        _psCheckStatusIconTimer.stop();
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psShowTrayMenu() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psRefreshTaskbarIcon() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psTrayMenuUpdated() {
 | 
			
		||||
    if (noQtTrayIcon && (useAppIndicator || useStatusIcon)) {
 | 
			
		||||
        const QList<QAction*> &actions = trayIconMenu->actions();
 | 
			
		||||
        if (_trayItems.isEmpty()) {
 | 
			
		||||
            DEBUG_LOG(("Creating tray menu!"));
 | 
			
		||||
            for (int32 i = 0, l = actions.size(); i != l; ++i) {
 | 
			
		||||
                GtkWidget *item = ps_gtk_menu_item_new_with_label(actions.at(i)->text().toUtf8());
 | 
			
		||||
                ps_gtk_menu_shell_append(PS_GTK_MENU_SHELL(_trayMenu), item);
 | 
			
		||||
                ps_g_signal_connect(item, "activate", G_CALLBACK(_trayMenuCallback), this);
 | 
			
		||||
                ps_gtk_widget_show(item);
 | 
			
		||||
                ps_gtk_widget_set_sensitive(item, actions.at(i)->isEnabled());
 | 
			
		||||
 | 
			
		||||
                _trayItems.push_back(qMakePair(item, actions.at(i)));
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            DEBUG_LOG(("Updating tray menu!"));
 | 
			
		||||
            for (int32 i = 0, l = actions.size(); i != l; ++i) {
 | 
			
		||||
                if (i < _trayItems.size()) {
 | 
			
		||||
                    ps_gtk_menu_item_set_label(reinterpret_cast<GtkMenuItem*>(_trayItems.at(i).first), actions.at(i)->text().toUtf8());
 | 
			
		||||
                    ps_gtk_widget_set_sensitive(_trayItems.at(i).first, actions.at(i)->isEnabled());
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psSetupTrayIcon() {
 | 
			
		||||
    if (noQtTrayIcon) {
 | 
			
		||||
        if (!cSupportTray()) return;
 | 
			
		||||
        psUpdateCounter();
 | 
			
		||||
    } else {
 | 
			
		||||
        if (!trayIcon) {
 | 
			
		||||
            trayIcon = new QSystemTrayIcon(this);
 | 
			
		||||
 | 
			
		||||
            QIcon icon(QPixmap::fromImage(App::wnd()->iconLarge(), Qt::ColorOnly));
 | 
			
		||||
 | 
			
		||||
            trayIcon->setIcon(icon);
 | 
			
		||||
            trayIcon->setToolTip(str_const_toString(AppName));
 | 
			
		||||
            connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleTray(QSystemTrayIcon::ActivationReason)), Qt::UniqueConnection);
 | 
			
		||||
            connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showFromTray()));
 | 
			
		||||
            App::wnd()->updateTrayMenu();
 | 
			
		||||
        }
 | 
			
		||||
        psUpdateCounter();
 | 
			
		||||
 | 
			
		||||
        trayIcon->show();
 | 
			
		||||
        psUpdateDelegate();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psUpdateWorkmode() {
 | 
			
		||||
    if (!cSupportTray()) return;
 | 
			
		||||
 | 
			
		||||
    if (cWorkMode() == dbiwmWindowOnly) {
 | 
			
		||||
        if (noQtTrayIcon) {
 | 
			
		||||
            if (useAppIndicator) {
 | 
			
		||||
                ps_app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_PASSIVE);
 | 
			
		||||
            } else if (useStatusIcon) {
 | 
			
		||||
                ps_gtk_status_icon_set_visible(_trayIcon, false);
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            if (trayIcon) {
 | 
			
		||||
                trayIcon->setContextMenu(0);
 | 
			
		||||
                trayIcon->deleteLater();
 | 
			
		||||
            }
 | 
			
		||||
            trayIcon = 0;
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        if (noQtTrayIcon) {
 | 
			
		||||
            if (useAppIndicator) {
 | 
			
		||||
                ps_app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_ACTIVE);
 | 
			
		||||
            } else if (useStatusIcon) {
 | 
			
		||||
                ps_gtk_status_icon_set_visible(_trayIcon, true);
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            psSetupTrayIcon();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psUpdateIndicator() {
 | 
			
		||||
    _psUpdateIndicatorTimer.stop();
 | 
			
		||||
    _psLastIndicatorUpdate = getms();
 | 
			
		||||
    QFileInfo f(_trayIconImageFile());
 | 
			
		||||
    if (f.exists()) {
 | 
			
		||||
        QByteArray path = QFile::encodeName(f.absoluteFilePath()), name = QFile::encodeName(f.fileName());
 | 
			
		||||
        name = name.mid(0, name.size() - 4);
 | 
			
		||||
        ps_app_indicator_set_icon_full(_trayIndicator, path.constData(), name);
 | 
			
		||||
    } else {
 | 
			
		||||
        useAppIndicator = false;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psUpdateCounter() {
 | 
			
		||||
    setWindowIcon(wndIcon);
 | 
			
		||||
 | 
			
		||||
	int32 counter = App::histories().unreadBadge();
 | 
			
		||||
 | 
			
		||||
    setWindowTitle((counter > 0) ? qsl("Telegram (%1)").arg(counter) : qsl("Telegram"));
 | 
			
		||||
    if (_psUnityLauncherEntry) {
 | 
			
		||||
        if (counter > 0) {
 | 
			
		||||
            ps_unity_launcher_entry_set_count(_psUnityLauncherEntry, (counter > 9999) ? 9999 : counter);
 | 
			
		||||
            ps_unity_launcher_entry_set_count_visible(_psUnityLauncherEntry, TRUE);
 | 
			
		||||
        } else {
 | 
			
		||||
            ps_unity_launcher_entry_set_count_visible(_psUnityLauncherEntry, FALSE);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (noQtTrayIcon) {
 | 
			
		||||
        if (useAppIndicator) {
 | 
			
		||||
            if (getms() > _psLastIndicatorUpdate + 1000) {
 | 
			
		||||
                psUpdateIndicator();
 | 
			
		||||
            } else if (!_psUpdateIndicatorTimer.isActive()) {
 | 
			
		||||
                _psUpdateIndicatorTimer.start(100);
 | 
			
		||||
            }
 | 
			
		||||
        } else if (useStatusIcon && trayIconChecked) {
 | 
			
		||||
            loadPixbuf(_trayIconImageGen());
 | 
			
		||||
            ps_gtk_status_icon_set_from_pixbuf(_trayIcon, _trayPixbuf);
 | 
			
		||||
        }
 | 
			
		||||
    } else if (trayIcon) {
 | 
			
		||||
		int32 counter = App::histories().unreadBadge();
 | 
			
		||||
		bool muted = App::histories().unreadOnlyMuted();
 | 
			
		||||
 | 
			
		||||
		style::color bg = muted ? st::counterMuteBG : st::counterBG;
 | 
			
		||||
        QIcon iconSmall;
 | 
			
		||||
        iconSmall.addPixmap(QPixmap::fromImage(iconWithCounter(16, counter, bg, true), Qt::ColorOnly));
 | 
			
		||||
        iconSmall.addPixmap(QPixmap::fromImage(iconWithCounter(32, counter, bg, true), Qt::ColorOnly));
 | 
			
		||||
        trayIcon->setIcon(iconSmall);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psUpdateDelegate() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psInitSize() {
 | 
			
		||||
	setMinimumWidth(st::wndMinWidth);
 | 
			
		||||
	setMinimumHeight(st::wndMinHeight);
 | 
			
		||||
 | 
			
		||||
	TWindowPos pos(cWindowPos());
 | 
			
		||||
	QRect avail(QDesktopWidget().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) {
 | 
			
		||||
		QList<QScreen*> screens = Application::screens();
 | 
			
		||||
		for (QList<QScreen*>::const_iterator i = screens.cbegin(), e = screens.cend(); i != e; ++i) {
 | 
			
		||||
			QByteArray name = (*i)->name().toUtf8();
 | 
			
		||||
			if (pos.moncrc == hashCrc32(name.constData(), name.size())) {
 | 
			
		||||
				QRect screen((*i)->geometry());
 | 
			
		||||
				int32 w = screen.width(), h = screen.height();
 | 
			
		||||
				if (w >= st::wndMinWidth && h >= st::wndMinHeight) {
 | 
			
		||||
					if (pos.w > w) pos.w = w;
 | 
			
		||||
					if (pos.h > h) pos.h = h;
 | 
			
		||||
					pos.x += screen.x();
 | 
			
		||||
					pos.y += screen.y();
 | 
			
		||||
					if (pos.x < screen.x() + screen.width() - 10 && pos.y < screen.y() + screen.height() - 10) {
 | 
			
		||||
						geom = QRect(pos.x, pos.y, pos.w, pos.h);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (pos.y < 0) pos.y = 0;
 | 
			
		||||
		maximized = pos.maximized;
 | 
			
		||||
	}
 | 
			
		||||
	setGeometry(geom);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psInitFrameless() {
 | 
			
		||||
    psUpdatedPositionTimer.setSingleShot(true);
 | 
			
		||||
	connect(&psUpdatedPositionTimer, SIGNAL(timeout()), this, SLOT(psSavePosition()));
 | 
			
		||||
 | 
			
		||||
	if (frameless) {
 | 
			
		||||
		//setWindowFlags(Qt::FramelessWindowHint);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psSavePosition(Qt::WindowState state) {
 | 
			
		||||
    if (state == Qt::WindowActive) state = windowHandle()->windowState();
 | 
			
		||||
	if (state == Qt::WindowMinimized || !posInited) return;
 | 
			
		||||
 | 
			
		||||
	TWindowPos pos(cWindowPos()), curPos = pos;
 | 
			
		||||
 | 
			
		||||
	if (state == Qt::WindowMaximized) {
 | 
			
		||||
		curPos.maximized = 1;
 | 
			
		||||
	} else {
 | 
			
		||||
		QRect r(geometry());
 | 
			
		||||
		curPos.x = r.x();
 | 
			
		||||
		curPos.y = r.y();
 | 
			
		||||
		curPos.w = r.width();
 | 
			
		||||
		curPos.h = r.height();
 | 
			
		||||
		curPos.maximized = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	int px = curPos.x + curPos.w / 2, py = curPos.y + curPos.h / 2, d = 0;
 | 
			
		||||
	QScreen *chosen = 0;
 | 
			
		||||
	QList<QScreen*> screens = Application::screens();
 | 
			
		||||
	for (QList<QScreen*>::const_iterator i = screens.cbegin(), e = screens.cend(); i != e; ++i) {
 | 
			
		||||
		int dx = (*i)->geometry().x() + (*i)->geometry().width() / 2 - px; if (dx < 0) dx = -dx;
 | 
			
		||||
		int dy = (*i)->geometry().y() + (*i)->geometry().height() / 2 - py; if (dy < 0) dy = -dy;
 | 
			
		||||
		if (!chosen || dx + dy < d) {
 | 
			
		||||
			d = dx + dy;
 | 
			
		||||
			chosen = *i;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (chosen) {
 | 
			
		||||
		curPos.x -= chosen->geometry().x();
 | 
			
		||||
		curPos.y -= chosen->geometry().y();
 | 
			
		||||
		QByteArray name = chosen->name().toUtf8();
 | 
			
		||||
		curPos.moncrc = hashCrc32(name.constData(), name.size());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (curPos.w >= st::wndMinWidth && curPos.h >= st::wndMinHeight) {
 | 
			
		||||
		if (curPos.x != pos.x || curPos.y != pos.y || curPos.w != pos.w || curPos.h != pos.h || curPos.moncrc != pos.moncrc || curPos.maximized != pos.maximized) {
 | 
			
		||||
			cSetWindowPos(curPos);
 | 
			
		||||
			Local::writeSettings();
 | 
			
		||||
		}
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psUpdatedPosition() {
 | 
			
		||||
    psUpdatedPositionTimer.start(SaveWindowPositionTimeout);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psCreateTrayIcon() {
 | 
			
		||||
    if (!noQtTrayIcon) {
 | 
			
		||||
        cSetSupportTray(QSystemTrayIcon::isSystemTrayAvailable());
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (useAppIndicator) {
 | 
			
		||||
        DEBUG_LOG(("Trying to create AppIndicator"));
 | 
			
		||||
        _trayMenu = ps_gtk_menu_new();
 | 
			
		||||
        if (_trayMenu) {
 | 
			
		||||
            DEBUG_LOG(("Created gtk menu for appindicator!"));
 | 
			
		||||
            QFileInfo f(_trayIconImageFile());
 | 
			
		||||
            if (f.exists()) {
 | 
			
		||||
                QByteArray path = QFile::encodeName(f.absoluteFilePath());
 | 
			
		||||
                _trayIndicator = ps_app_indicator_new("Telegram Desktop", path.constData(), APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
 | 
			
		||||
                if (_trayIndicator) {
 | 
			
		||||
                    DEBUG_LOG(("Created appindicator!"));
 | 
			
		||||
                } else {
 | 
			
		||||
                    DEBUG_LOG(("Failed to app_indicator_new()!"));
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                useAppIndicator = false;
 | 
			
		||||
                DEBUG_LOG(("Failed to create image file!"));
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            DEBUG_LOG(("Failed to gtk_menu_new()!"));
 | 
			
		||||
        }
 | 
			
		||||
        if (_trayMenu && _trayIndicator) {
 | 
			
		||||
            ps_app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_ACTIVE);
 | 
			
		||||
            ps_app_indicator_set_menu(_trayIndicator, PS_GTK_MENU(_trayMenu));
 | 
			
		||||
            useStatusIcon = false;
 | 
			
		||||
        } else {
 | 
			
		||||
            DEBUG_LOG(("AppIndicator failed!"));
 | 
			
		||||
            useAppIndicator = false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    if (useStatusIcon) {
 | 
			
		||||
        if (ps_gdk_init_check(0, 0)) {
 | 
			
		||||
            if (!_trayMenu) _trayMenu = ps_gtk_menu_new();
 | 
			
		||||
            if (_trayMenu) {
 | 
			
		||||
                loadPixbuf(_trayIconImageGen());
 | 
			
		||||
                _trayIcon = ps_gtk_status_icon_new_from_pixbuf(_trayPixbuf);
 | 
			
		||||
                if (_trayIcon) {
 | 
			
		||||
                    ps_g_signal_connect(_trayIcon, "popup-menu", GCallback(_trayIconPopup), _trayMenu);
 | 
			
		||||
                    ps_g_signal_connect(_trayIcon, "activate", GCallback(_trayIconActivate), _trayMenu);
 | 
			
		||||
                    ps_g_signal_connect(_trayIcon, "size-changed", GCallback(_trayIconResized), _trayMenu);
 | 
			
		||||
 | 
			
		||||
                    ps_gtk_status_icon_set_title(_trayIcon, "Telegram Desktop");
 | 
			
		||||
                    ps_gtk_status_icon_set_tooltip_text(_trayIcon, "Telegram Desktop");
 | 
			
		||||
                    ps_gtk_status_icon_set_visible(_trayIcon, true);
 | 
			
		||||
                } else {
 | 
			
		||||
                    useStatusIcon = false;
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                useStatusIcon = false;
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            useStatusIcon = false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    if (!useStatusIcon && !useAppIndicator) {
 | 
			
		||||
        if (_trayMenu) {
 | 
			
		||||
            ps_g_object_ref_sink(_trayMenu);
 | 
			
		||||
            ps_g_object_unref(_trayMenu);
 | 
			
		||||
            _trayMenu = 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    cSetSupportTray(useAppIndicator);
 | 
			
		||||
    if (useStatusIcon) {
 | 
			
		||||
        ps_g_idle_add((GSourceFunc)_trayIconCheck, 0);
 | 
			
		||||
        _psCheckStatusIconTimer.start(100);
 | 
			
		||||
    } else {
 | 
			
		||||
        psUpdateWorkmode();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psFirstShow() {
 | 
			
		||||
    psCreateTrayIcon();
 | 
			
		||||
 | 
			
		||||
    if (useUnityCount) {
 | 
			
		||||
        _psUnityLauncherEntry = ps_unity_launcher_entry_get_for_desktop_id("telegramdesktop.desktop");
 | 
			
		||||
        if (_psUnityLauncherEntry) {
 | 
			
		||||
            LOG(("Found Unity Launcher entry telegramdesktop.desktop!"));
 | 
			
		||||
        } else {
 | 
			
		||||
            _psUnityLauncherEntry = ps_unity_launcher_entry_get_for_desktop_id("Telegram.desktop");
 | 
			
		||||
            if (_psUnityLauncherEntry) {
 | 
			
		||||
                LOG(("Found Unity Launcher entry Telegram.desktop!"));
 | 
			
		||||
            } else {
 | 
			
		||||
                LOG(("Could not get Unity Launcher entry!"));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        LOG(("Not using Unity Launcher count."));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    finished = false;
 | 
			
		||||
 | 
			
		||||
    psUpdateMargins();
 | 
			
		||||
 | 
			
		||||
	bool showShadows = true;
 | 
			
		||||
 | 
			
		||||
	show();
 | 
			
		||||
    //_private.enableShadow(winId());
 | 
			
		||||
	if (cWindowPos().maximized) {
 | 
			
		||||
		setWindowState(Qt::WindowMaximized);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((cLaunchMode() == LaunchModeAutoStart && cStartMinimized()) || cStartInTray()) {
 | 
			
		||||
		setWindowState(Qt::WindowMinimized);
 | 
			
		||||
		if (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray) {
 | 
			
		||||
			hide();
 | 
			
		||||
		} else {
 | 
			
		||||
			show();
 | 
			
		||||
		}
 | 
			
		||||
		showShadows = false;
 | 
			
		||||
	} else {
 | 
			
		||||
		show();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	posInited = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool PsMainWindow::psHandleTitle() {
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psInitSysMenu() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psUpdateSysMenu(Qt::WindowState state) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psUpdateMargins() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PsMainWindow::psFlash() {
 | 
			
		||||
    //_private.startBounce();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
PsMainWindow::~PsMainWindow() {
 | 
			
		||||
    if (_trayIcon) {
 | 
			
		||||
        ps_g_object_unref(_trayIcon);
 | 
			
		||||
        _trayIcon = 0;
 | 
			
		||||
    }
 | 
			
		||||
    if (_trayPixbuf) {
 | 
			
		||||
        ps_g_object_unref(_trayPixbuf);
 | 
			
		||||
        _trayPixbuf = 0;
 | 
			
		||||
    }
 | 
			
		||||
    if (_trayMenu) {
 | 
			
		||||
        ps_g_object_ref_sink(_trayMenu);
 | 
			
		||||
        ps_g_object_unref(_trayMenu);
 | 
			
		||||
        _trayMenu = 0;
 | 
			
		||||
    }
 | 
			
		||||
    finished = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace {
 | 
			
		||||
    QRect _monitorRect;
 | 
			
		||||
    uint64 _monitorLastGot = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -1235,36 +829,38 @@ void psShowInFolder(const QString &name) {
 | 
			
		|||
    system(("xdg-open " + escapeShell(QFile::encodeName(QFileInfo(name).absoluteDir().absolutePath()))).constData());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace PlatformSpecific {
 | 
			
		||||
 | 
			
		||||
	void start() {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void finish() {
 | 
			
		||||
		delete _psEventFilter;
 | 
			
		||||
		_psEventFilter = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	namespace ThirdParty {
 | 
			
		||||
		void start() {
 | 
			
		||||
			QString cdesktop = QString(getenv("XDG_CURRENT_DESKTOP")).toLower();
 | 
			
		||||
			noQtTrayIcon = (cdesktop == qstr("pantheon")) || (cdesktop == qstr("gnome"));
 | 
			
		||||
			tryAppIndicator = (cdesktop == qstr("xfce"));
 | 
			
		||||
			noTryUnity = (cdesktop != qstr("unity"));
 | 
			
		||||
 | 
			
		||||
			if (noQtTrayIcon) cSetSupportTray(false);
 | 
			
		||||
 | 
			
		||||
			DEBUG_LOG(("Loading libraries"));
 | 
			
		||||
			setupGtk();
 | 
			
		||||
			setupUnity();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		void finish() {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
namespace Platform {
 | 
			
		||||
 | 
			
		||||
void start() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void finish() {
 | 
			
		||||
	delete _psEventFilter;
 | 
			
		||||
	_psEventFilter = nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace ThirdParty {
 | 
			
		||||
 | 
			
		||||
void start() {
 | 
			
		||||
	QString cdesktop = QString(getenv("XDG_CURRENT_DESKTOP")).toLower();
 | 
			
		||||
	noQtTrayIcon = (cdesktop == qstr("pantheon")) || (cdesktop == qstr("gnome"));
 | 
			
		||||
	tryAppIndicator = (cdesktop == qstr("xfce"));
 | 
			
		||||
	noTryUnity = (cdesktop != qstr("unity"));
 | 
			
		||||
 | 
			
		||||
	if (noQtTrayIcon) cSetSupportTray(false);
 | 
			
		||||
 | 
			
		||||
	DEBUG_LOG(("Loading libraries"));
 | 
			
		||||
	setupGtk();
 | 
			
		||||
	setupUnity();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void finish() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace ThirdParty
 | 
			
		||||
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
 | 
			
		||||
namespace {
 | 
			
		||||
    bool _psRunCommand(const QByteArray &command) {
 | 
			
		||||
        int result = system(command.constData());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,89 +30,6 @@ inline void psCheckLocalSocket(const QString &serverName) {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class NotifyWindow;
 | 
			
		||||
 | 
			
		||||
class PsMainWindow : public QMainWindow {
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	PsMainWindow(QWidget *parent = 0);
 | 
			
		||||
 | 
			
		||||
	int32 psResizeRowWidth() const {
 | 
			
		||||
		return 0;//st::wndResizeAreaWidth;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void psInitFrameless();
 | 
			
		||||
	void psInitSize();
 | 
			
		||||
 | 
			
		||||
	void psFirstShow();
 | 
			
		||||
	void psInitSysMenu();
 | 
			
		||||
	void psUpdateSysMenu(Qt::WindowState state);
 | 
			
		||||
	void psUpdateMargins();
 | 
			
		||||
	void psUpdatedPosition();
 | 
			
		||||
 | 
			
		||||
	bool psHandleTitle();
 | 
			
		||||
 | 
			
		||||
	void psFlash();
 | 
			
		||||
    void psNotifySettingGot();
 | 
			
		||||
 | 
			
		||||
	void psUpdateWorkmode();
 | 
			
		||||
 | 
			
		||||
	void psRefreshTaskbarIcon();
 | 
			
		||||
 | 
			
		||||
	bool psPosInited() const {
 | 
			
		||||
		return posInited;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    void psActivateNotify(NotifyWindow *w);
 | 
			
		||||
    void psClearNotifies(PeerId peerId = 0);
 | 
			
		||||
    void psNotifyShown(NotifyWindow *w);
 | 
			
		||||
    void psPlatformNotify(HistoryItem *item, int32 fwdCount);
 | 
			
		||||
 | 
			
		||||
	void psUpdateCounter();
 | 
			
		||||
 | 
			
		||||
	bool psHasNativeNotifications() {
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	virtual QImage iconWithCounter(int size, int count, style::color bg, bool smallIcon) = 0;
 | 
			
		||||
 | 
			
		||||
	~PsMainWindow();
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
 | 
			
		||||
	void psUpdateDelegate();
 | 
			
		||||
	void psSavePosition(Qt::WindowState state = Qt::WindowActive);
 | 
			
		||||
	void psShowTrayMenu();
 | 
			
		||||
 | 
			
		||||
    void psStatusIconCheck();
 | 
			
		||||
    void psUpdateIndicator();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
 | 
			
		||||
    bool psHasTrayIcon() const;
 | 
			
		||||
 | 
			
		||||
	bool posInited;
 | 
			
		||||
    QSystemTrayIcon *trayIcon;
 | 
			
		||||
    QMenu *trayIconMenu;
 | 
			
		||||
    QImage icon256, iconbig256;
 | 
			
		||||
	QIcon wndIcon;
 | 
			
		||||
 | 
			
		||||
    void psTrayMenuUpdated();
 | 
			
		||||
    void psSetupTrayIcon();
 | 
			
		||||
 | 
			
		||||
    QTimer psUpdatedPositionTimer;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    void psCreateTrayIcon();
 | 
			
		||||
 | 
			
		||||
    QTimer _psCheckStatusIconTimer;
 | 
			
		||||
    int _psCheckStatusIconLeft;
 | 
			
		||||
 | 
			
		||||
    QTimer _psUpdateIndicatorTimer;
 | 
			
		||||
    uint64 _psLastIndicatorUpdate;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void psWriteDump();
 | 
			
		||||
QString psPrepareCrashDump(const QByteArray &crashdump, QString dumpfile);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -854,29 +854,30 @@ void psShowInFolder(const QString &name) {
 | 
			
		|||
    objc_showInFinder(name, QFileInfo(name).absolutePath());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace PlatformSpecific {
 | 
			
		||||
 | 
			
		||||
	void start() {
 | 
			
		||||
		objc_start();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void finish() {
 | 
			
		||||
		delete _psEventFilter;
 | 
			
		||||
		_psEventFilter = 0;
 | 
			
		||||
 | 
			
		||||
		objc_finish();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    namespace ThirdParty {
 | 
			
		||||
        void start() {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void finish() {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
namespace Platform {
 | 
			
		||||
 | 
			
		||||
void start() {
 | 
			
		||||
	objc_start();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void finish() {
 | 
			
		||||
	delete _psEventFilter;
 | 
			
		||||
	_psEventFilter = nullptr;
 | 
			
		||||
 | 
			
		||||
	objc_finish();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace ThirdParty {
 | 
			
		||||
 | 
			
		||||
void start() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void finish() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace ThirdParty
 | 
			
		||||
} // namespace Platform
 | 
			
		||||
 | 
			
		||||
void psNewVersion() {
 | 
			
		||||
	objc_registerCustomScheme();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,117 +29,6 @@ inline void psCheckLocalSocket(const QString &serverName) {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class MacPrivate : public PsMacWindowPrivate {
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
    void activeSpaceChanged();
 | 
			
		||||
	void darkModeChanged();
 | 
			
		||||
    void notifyClicked(unsigned long long peer, int msgid);
 | 
			
		||||
    void notifyReplied(unsigned long long peer, int msgid, const char *str);
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class NotifyWindow;
 | 
			
		||||
 | 
			
		||||
class PsMainWindow : public QMainWindow {
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	PsMainWindow(QWidget *parent = 0);
 | 
			
		||||
 | 
			
		||||
	int32 psResizeRowWidth() const {
 | 
			
		||||
		return 0;//st::wndResizeAreaWidth;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void psInitFrameless();
 | 
			
		||||
	void psInitSize();
 | 
			
		||||
 | 
			
		||||
	void psFirstShow();
 | 
			
		||||
	void psInitSysMenu();
 | 
			
		||||
	void psUpdateSysMenu(Qt::WindowState state);
 | 
			
		||||
	void psUpdateMargins();
 | 
			
		||||
	void psUpdatedPosition();
 | 
			
		||||
 | 
			
		||||
	bool psHandleTitle();
 | 
			
		||||
 | 
			
		||||
	void psFlash();
 | 
			
		||||
 | 
			
		||||
	void psUpdateWorkmode();
 | 
			
		||||
 | 
			
		||||
	void psRefreshTaskbarIcon();
 | 
			
		||||
 | 
			
		||||
	bool psPosInited() const {
 | 
			
		||||
		return posInited;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	bool psFilterNativeEvent(void *event);
 | 
			
		||||
 | 
			
		||||
	void psActivateNotify(NotifyWindow *w);
 | 
			
		||||
	void psClearNotifies(PeerId peerId = 0);
 | 
			
		||||
	void psNotifyShown(NotifyWindow *w);
 | 
			
		||||
	void psPlatformNotify(HistoryItem *item, int32 fwdCount);
 | 
			
		||||
 | 
			
		||||
	bool eventFilter(QObject *obj, QEvent *evt);
 | 
			
		||||
 | 
			
		||||
	void psUpdateCounter();
 | 
			
		||||
 | 
			
		||||
	bool psHasNativeNotifications() {
 | 
			
		||||
		return !(QSysInfo::macVersion() < QSysInfo::MV_10_8);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	virtual QImage iconWithCounter(int size, int count, style::color bg, bool smallIcon) = 0;
 | 
			
		||||
 | 
			
		||||
	~PsMainWindow();
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
 | 
			
		||||
	void psUpdateDelegate();
 | 
			
		||||
	void psSavePosition(Qt::WindowState state = Qt::WindowActive);
 | 
			
		||||
    void psShowTrayMenu();
 | 
			
		||||
 | 
			
		||||
	void psMacUndo();
 | 
			
		||||
	void psMacRedo();
 | 
			
		||||
	void psMacCut();
 | 
			
		||||
	void psMacCopy();
 | 
			
		||||
	void psMacPaste();
 | 
			
		||||
	void psMacDelete();
 | 
			
		||||
	void psMacSelectAll();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
 | 
			
		||||
	void psNotIdle() const;
 | 
			
		||||
	QImage psTrayIcon(bool selected = false) const;
 | 
			
		||||
    bool psHasTrayIcon() const {
 | 
			
		||||
        return trayIcon;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	void psMacUpdateMenu();
 | 
			
		||||
 | 
			
		||||
	bool posInited;
 | 
			
		||||
    QSystemTrayIcon *trayIcon;
 | 
			
		||||
    QMenu *trayIconMenu;
 | 
			
		||||
	QImage icon256, iconbig256;
 | 
			
		||||
	QIcon wndIcon;
 | 
			
		||||
 | 
			
		||||
	QImage trayImg, trayImgSel;
 | 
			
		||||
 | 
			
		||||
    void psTrayMenuUpdated();
 | 
			
		||||
    void psSetupTrayIcon();
 | 
			
		||||
	virtual void placeSmallCounter(QImage &img, int size, int count, style::color bg, const QPoint &shift, style::color color) = 0;
 | 
			
		||||
 | 
			
		||||
    QTimer psUpdatedPositionTimer;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    MacPrivate _private;
 | 
			
		||||
 | 
			
		||||
	mutable bool psIdle;
 | 
			
		||||
	mutable QTimer psIdleTimer;
 | 
			
		||||
 | 
			
		||||
	QMenuBar psMainMenu;
 | 
			
		||||
	QAction *psLogout, *psUndo, *psRedo, *psCut, *psCopy, *psPaste, *psDelete, *psSelectAll, *psContacts, *psAddContact, *psNewGroup, *psNewChannel, *psShowTelegram;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void psWriteDump();
 | 
			
		||||
QString psPrepareCrashDump(const QByteArray &crashdump, QString dumpfile);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -1,4 +1,3 @@
 | 
			
		|||
 | 
			
		||||
/*
 | 
			
		||||
This file is part of Telegram Desktop,
 | 
			
		||||
the official desktop version of Telegram messaging app, see https://telegram.org
 | 
			
		||||
| 
						 | 
				
			
			@ -29,92 +28,6 @@ inline QString psServerPrefix() {
 | 
			
		|||
inline void psCheckLocalSocket(const QString &) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class NotifyWindow;
 | 
			
		||||
 | 
			
		||||
class PsMainWindow : public QMainWindow {
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	PsMainWindow(QWidget *parent = 0);
 | 
			
		||||
 | 
			
		||||
	int32 psResizeRowWidth() const {
 | 
			
		||||
		return 0;//st::wndResizeAreaWidth;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void psInitFrameless();
 | 
			
		||||
	void psInitSize();
 | 
			
		||||
	HWND psHwnd() const;
 | 
			
		||||
	HMENU psMenu() const;
 | 
			
		||||
 | 
			
		||||
	void psFirstShow();
 | 
			
		||||
	void psInitSysMenu();
 | 
			
		||||
	void psUpdateSysMenu(Qt::WindowState state);
 | 
			
		||||
	void psUpdateMargins();
 | 
			
		||||
	void psUpdatedPosition();
 | 
			
		||||
 | 
			
		||||
	bool psHandleTitle();
 | 
			
		||||
 | 
			
		||||
	void psFlash();
 | 
			
		||||
	void psNotifySettingGot();
 | 
			
		||||
 | 
			
		||||
	void psUpdateWorkmode();
 | 
			
		||||
 | 
			
		||||
	void psRefreshTaskbarIcon();
 | 
			
		||||
 | 
			
		||||
	bool psPosInited() const {
 | 
			
		||||
		return posInited;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void psActivateNotify(NotifyWindow *w);
 | 
			
		||||
	void psClearNotifies(PeerId peerId = 0);
 | 
			
		||||
	void psNotifyShown(NotifyWindow *w);
 | 
			
		||||
	void psPlatformNotify(HistoryItem *item, int32 fwdCount);
 | 
			
		||||
 | 
			
		||||
	void psUpdateCounter();
 | 
			
		||||
 | 
			
		||||
	bool psHasNativeNotifications();
 | 
			
		||||
	void psCleanNotifyPhotosIn(int32 dt);
 | 
			
		||||
 | 
			
		||||
	virtual QImage iconWithCounter(int size, int count, style::color bg, bool smallIcon) = 0;
 | 
			
		||||
 | 
			
		||||
	~PsMainWindow();
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
 | 
			
		||||
	void psUpdateDelegate();
 | 
			
		||||
	void psSavePosition(Qt::WindowState state = Qt::WindowActive);
 | 
			
		||||
    void psShowTrayMenu();
 | 
			
		||||
 | 
			
		||||
	void psCleanNotifyPhotos();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
 | 
			
		||||
    bool psHasTrayIcon() const {
 | 
			
		||||
        return trayIcon;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	bool posInited;
 | 
			
		||||
	QSystemTrayIcon *trayIcon;
 | 
			
		||||
	PopupMenu *trayIconMenu;
 | 
			
		||||
	QImage icon256, iconbig256;
 | 
			
		||||
	QIcon wndIcon;
 | 
			
		||||
 | 
			
		||||
    void psTrayMenuUpdated();
 | 
			
		||||
    void psSetupTrayIcon();
 | 
			
		||||
 | 
			
		||||
	QTimer psUpdatedPositionTimer;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	HWND ps_hWnd;
 | 
			
		||||
	HWND ps_tbHider_hWnd;
 | 
			
		||||
	HMENU ps_menu;
 | 
			
		||||
	HICON ps_iconBig, ps_iconSmall, ps_iconOverlay;
 | 
			
		||||
 | 
			
		||||
	SingleTimer ps_cleanNotifyPhotosTimer;
 | 
			
		||||
 | 
			
		||||
	void psDestroyIcons();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void psWriteDump();
 | 
			
		||||
void psWriteStackTrace();
 | 
			
		||||
QString psPrepareCrashDump(const QByteArray &crashdump, QString dumpfile);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,36 @@
 | 
			
		|||
/*
 | 
			
		||||
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/main_window.h"
 | 
			
		||||
 | 
			
		||||
namespace Window {
 | 
			
		||||
 | 
			
		||||
MainWindow::MainWindow() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MainWindow::~MainWindow() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::closeWithoutDestroy() {
 | 
			
		||||
	hide();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace Window
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,36 @@
 | 
			
		|||
/*
 | 
			
		||||
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 {
 | 
			
		||||
 | 
			
		||||
class MainWindow : public QMainWindow {
 | 
			
		||||
public:
 | 
			
		||||
	MainWindow();
 | 
			
		||||
 | 
			
		||||
	virtual ~MainWindow();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
	virtual void closeWithoutDestroy();
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace Window
 | 
			
		||||
| 
						 | 
				
			
			@ -354,6 +354,15 @@
 | 
			
		|||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_main_window_linux.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_main_window_win.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_mediaview.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
| 
						 | 
				
			
			@ -422,25 +431,6 @@
 | 
			
		|||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_pspecific_linux.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_pspecific_mac.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_pspecific_win.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_pspecific_winrt.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_report_box.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
| 
						 | 
				
			
			@ -685,6 +675,20 @@
 | 
			
		|||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_main_window_linux.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_main_window_mac.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_main_window_win.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_mediaview.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
| 
						 | 
				
			
			@ -753,20 +757,6 @@
 | 
			
		|||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_pspecific_linux.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_pspecific_mac.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_pspecific_win.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_pspecific_winrt.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
| 
						 | 
				
			
			@ -1042,6 +1032,20 @@
 | 
			
		|||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_main_window_linux.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_main_window_mac.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_main_window_win.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_mediaview.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
| 
						 | 
				
			
			@ -1110,20 +1114,6 @@
 | 
			
		|||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_pspecific_linux.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_pspecific_mac.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_pspecific_win.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_pspecific_winrt.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
| 
						 | 
				
			
			@ -1266,6 +1256,37 @@
 | 
			
		|||
    <ClCompile Include="SourceFiles\overviewwidget.cpp" />
 | 
			
		||||
    <ClCompile Include="SourceFiles\overview\overview_layout.cpp" />
 | 
			
		||||
    <ClCompile Include="SourceFiles\passcodewidget.cpp" />
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\linux\main_window_linux.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\winrt\main_window_winrt.cpp">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\win\main_window_win.cpp">
 | 
			
		||||
      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
			
		||||
      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
			
		||||
      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\win\windows_app_user_model_id.cpp">
 | 
			
		||||
      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
			
		||||
      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
			
		||||
      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\win\windows_dlls.cpp">
 | 
			
		||||
      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
			
		||||
      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
			
		||||
      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\win\windows_event_filter.cpp" />
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\win\windows_toasts.cpp">
 | 
			
		||||
      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
			
		||||
      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
			
		||||
      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;C:\Program Files (x86)\Windows Kits\8.1\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\playerwidget.cpp" />
 | 
			
		||||
    <ClCompile Include="SourceFiles\profile\profile_actions_widget.cpp" />
 | 
			
		||||
    <ClCompile Include="SourceFiles\profile\profile_block_widget.cpp" />
 | 
			
		||||
| 
						 | 
				
			
			@ -1345,6 +1366,7 @@
 | 
			
		|||
    <ClCompile Include="SourceFiles\ui\toast\toast_widget.cpp" />
 | 
			
		||||
    <ClCompile Include="SourceFiles\ui\twidget.cpp" />
 | 
			
		||||
    <ClCompile Include="SourceFiles\mainwindow.cpp" />
 | 
			
		||||
    <ClCompile Include="SourceFiles\window\main_window.cpp" />
 | 
			
		||||
    <ClCompile Include="SourceFiles\window\section_widget.cpp" />
 | 
			
		||||
    <ClCompile Include="SourceFiles\window\slide_animation.cpp" />
 | 
			
		||||
    <ClCompile Include="SourceFiles\window\top_bar_widget.cpp" />
 | 
			
		||||
| 
						 | 
				
			
			@ -1657,6 +1679,64 @@
 | 
			
		|||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/profile/profile_actions_widget.h"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include"</Command>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
    <CustomBuild Include="SourceFiles\platform\mac\main_window_mac.h">
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Moc%27ing main_window_mac.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/platform/mac/main_window_mac.h"  -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include"</Command>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing main_window_mac.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/platform/mac/main_window_mac.h"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl_debug\Debug\include"</Command>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing main_window_mac.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/platform/mac/main_window_mac.h"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include"</Command>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
    <CustomBuild Include="SourceFiles\platform\linux\main_window_linux.h">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Moc%27ing main_window_linux.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/platform/linux/main_window_linux.h"  -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include"</Command>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing main_window_linux.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/platform/linux/main_window_linux.h"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl_debug\Debug\include"</Command>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing main_window_linux.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/platform/linux/main_window_linux.h"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include"</Command>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
    <ClInclude Include="SourceFiles\platform\platform_main_window.h" />
 | 
			
		||||
    <CustomBuild Include="SourceFiles\platform\win\main_window_win.h">
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Moc%27ing main_window_win.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS  "-IC:\Program Files (x86)\Windows Kits\8.1\Include\winrt" "-IC:\Program Files (x86)\Windows Kits\8.1\Include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\Include\um" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include" "-fstdafx.h" "-f../../SourceFiles/platform/win/main_window_win.h"</Command>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing main_window_win.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS  "-IC:\Program Files (x86)\Windows Kits\8.1\Include\winrt" "-IC:\Program Files (x86)\Windows Kits\8.1\Include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\Include\um" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-fstdafx.h" "-f../../SourceFiles/platform/win/main_window_win.h"</Command>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing main_window_win.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS  "-IC:\Program Files (x86)\Windows Kits\8.1\Include\winrt" "-IC:\Program Files (x86)\Windows Kits\8.1\Include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\Include\um" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include" "-fstdafx.h" "-f../../SourceFiles/platform/win/main_window_win.h"</Command>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
    <ClInclude Include="SourceFiles\platform\winrt\main_window_winrt.h">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </ClInclude>
 | 
			
		||||
    <ClInclude Include="SourceFiles\platform\win\windows_app_user_model_id.h" />
 | 
			
		||||
    <ClInclude Include="SourceFiles\platform\win\windows_dlls.h" />
 | 
			
		||||
    <ClInclude Include="SourceFiles\platform\win\windows_event_filter.h" />
 | 
			
		||||
    <ClInclude Include="SourceFiles\platform\win\windows_toasts.h" />
 | 
			
		||||
    <ClInclude Include="SourceFiles\profile\profile_cover_drop_area.h" />
 | 
			
		||||
    <ClInclude Include="SourceFiles\profile\profile_info_widget.h" />
 | 
			
		||||
    <ClInclude Include="SourceFiles\profile\profile_invite_link_widget.h" />
 | 
			
		||||
| 
						 | 
				
			
			@ -1921,6 +2001,7 @@
 | 
			
		|||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/window/section_widget.h"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include"</Command>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
    <CustomBuild Include="SourceFiles\window\main_window.h" />
 | 
			
		||||
    <ClInclude Include="SourceFiles\window\section_memento.h" />
 | 
			
		||||
    <ClInclude Include="SourceFiles\window\slide_animation.h" />
 | 
			
		||||
    <ClInclude Include="ThirdParty\minizip\crypt.h" />
 | 
			
		||||
| 
						 | 
				
			
			@ -2493,18 +2574,24 @@
 | 
			
		|||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
    <CustomBuild Include="SourceFiles\pspecific_win.h">
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing pspecific_win.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS  "-IC:\Program Files (x86)\Windows Kits\8.1\Include\winrt" "-IC:\Program Files (x86)\Windows Kits\8.1\Include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\Include\um" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-fstdafx.h" "-f../../SourceFiles/pspecific_win.h"</Command>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing pspecific_win.h...</Message>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Moc%27ing pspecific_win.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS  "-IC:\Program Files (x86)\Windows Kits\8.1\Include\winrt" "-IC:\Program Files (x86)\Windows Kits\8.1\Include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\Include\um" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include" "-fstdafx.h" "-f../../SourceFiles/pspecific_win.h"</Command>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS  "-IC:\Program Files (x86)\Windows Kits\8.1\Include\winrt" "-IC:\Program Files (x86)\Windows Kits\8.1\Include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\Include\um" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include" "-fstdafx.h" "-f../../SourceFiles/pspecific_win.h"</Command>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 | 
			
		||||
      </Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 | 
			
		||||
      </Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 | 
			
		||||
      </Command>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 | 
			
		||||
      </Message>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">
 | 
			
		||||
      </Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 | 
			
		||||
      </Outputs>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">
 | 
			
		||||
      </Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 | 
			
		||||
      </Command>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">
 | 
			
		||||
      </Command>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
    <CustomBuild Include="SourceFiles\overviewwidget.h">
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
| 
						 | 
				
			
			@ -2550,35 +2637,47 @@
 | 
			
		|||
    </CustomBuild>
 | 
			
		||||
    <ClInclude Include="SourceFiles\pspecific.h" />
 | 
			
		||||
    <CustomBuild Include="SourceFiles\pspecific_linux.h">
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Moc%27ing pspecific_linux.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS  "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include" "-fstdafx.h" "-f../../SourceFiles/pspecific_linux.h"</Command>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing pspecific_linux.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS  "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-fstdafx.h" "-f../../SourceFiles/pspecific_linux.h"</Command>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing pspecific_linux.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS  "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include" "-fstdafx.h" "-f../../SourceFiles/pspecific_linux.h"</Command>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">
 | 
			
		||||
      </Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">
 | 
			
		||||
      </Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">
 | 
			
		||||
      </Command>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 | 
			
		||||
      </Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 | 
			
		||||
      </Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 | 
			
		||||
      </Command>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 | 
			
		||||
      </Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 | 
			
		||||
      </Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 | 
			
		||||
      </Command>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
    <CustomBuild Include="SourceFiles\pspecific_mac.h">
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Moc%27ing pspecific_mac.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS  "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include" "-fstdafx.h" "-f../../SourceFiles/pspecific_mac.h"</Command>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing pspecific_mac.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS  "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-fstdafx.h" "-f../../SourceFiles/pspecific_mac.h"</Command>
 | 
			
		||||
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing pspecific_mac.h...</Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe"  "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp"  -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS  "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include" "-fstdafx.h" "-f../../SourceFiles/pspecific_mac.h"</Command>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">
 | 
			
		||||
      </Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">
 | 
			
		||||
      </Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">
 | 
			
		||||
      </Command>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 | 
			
		||||
      </Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 | 
			
		||||
      </Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 | 
			
		||||
      </Command>
 | 
			
		||||
      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 | 
			
		||||
      </Message>
 | 
			
		||||
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 | 
			
		||||
      </Outputs>
 | 
			
		||||
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 | 
			
		||||
      </Command>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
| 
						 | 
				
			
			@ -2706,6 +2805,11 @@
 | 
			
		|||
    <None Include="Resources\langs\upload.sh" />
 | 
			
		||||
    <None Include="SourceFiles\mtproto\generate.py" />
 | 
			
		||||
    <None Include="SourceFiles\mtproto\scheme.tl" />
 | 
			
		||||
    <None Include="SourceFiles\platform\mac\main_window_mac.mm">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
    </None>
 | 
			
		||||
    <None Include="SourceFiles\pspecific_mac_p.mm">
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -97,6 +97,21 @@
 | 
			
		|||
    <Filter Include="SourceFiles\profile">
 | 
			
		||||
      <UniqueIdentifier>{b761f2a4-0e8c-4e52-b179-7a3185c046c4}</UniqueIdentifier>
 | 
			
		||||
    </Filter>
 | 
			
		||||
    <Filter Include="SourceFiles\platform">
 | 
			
		||||
      <UniqueIdentifier>{a2724cb3-028c-43a8-ad3d-5176b63c7998}</UniqueIdentifier>
 | 
			
		||||
    </Filter>
 | 
			
		||||
    <Filter Include="SourceFiles\platform\win">
 | 
			
		||||
      <UniqueIdentifier>{64f57f23-7eb4-4949-8fc8-4a5db87a31c8}</UniqueIdentifier>
 | 
			
		||||
    </Filter>
 | 
			
		||||
    <Filter Include="SourceFiles\platform\mac">
 | 
			
		||||
      <UniqueIdentifier>{c3de8600-519e-489c-8b25-14137dda87c6}</UniqueIdentifier>
 | 
			
		||||
    </Filter>
 | 
			
		||||
    <Filter Include="SourceFiles\platform\linux">
 | 
			
		||||
      <UniqueIdentifier>{920a21f5-22df-47da-bffd-de23e6b4ede1}</UniqueIdentifier>
 | 
			
		||||
    </Filter>
 | 
			
		||||
    <Filter Include="SourceFiles\platform\winrt">
 | 
			
		||||
      <UniqueIdentifier>{385d4cd5-f702-41b7-9e39-707d16b118d5}</UniqueIdentifier>
 | 
			
		||||
    </Filter>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ClCompile Include="SourceFiles\main.cpp">
 | 
			
		||||
| 
						 | 
				
			
			@ -498,27 +513,9 @@
 | 
			
		|||
    <ClCompile Include="SourceFiles\pspecific_linux.cpp">
 | 
			
		||||
      <Filter>SourceFiles</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_pspecific_linux.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Deploy</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_pspecific_linux.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Debug</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_pspecific_linux.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Release</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\pspecific_mac.cpp">
 | 
			
		||||
      <Filter>SourceFiles</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_pspecific_mac.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Deploy</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_pspecific_mac.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Debug</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_pspecific_mac.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Release</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_passcodewidget.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Deploy</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
| 
						 | 
				
			
			@ -681,15 +678,6 @@
 | 
			
		|||
    <ClCompile Include="SourceFiles\intro\introwidget.cpp">
 | 
			
		||||
      <Filter>SourceFiles\intro</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_pspecific_win.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Deploy</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_pspecific_win.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Debug</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_pspecific_win.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Release</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\pspecific_win.cpp">
 | 
			
		||||
      <Filter>SourceFiles</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
| 
						 | 
				
			
			@ -699,9 +687,6 @@
 | 
			
		|||
    <ClCompile Include="GeneratedFiles\Deploy\moc_pspecific_winrt.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Deploy</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_pspecific_winrt.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Debug</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_pspecific_winrt.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Release</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
| 
						 | 
				
			
			@ -1296,6 +1281,54 @@
 | 
			
		|||
    <ClCompile Include="SourceFiles\data\data_abstract_structure.cpp">
 | 
			
		||||
      <Filter>SourceFiles\data</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_main_window_win.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Deploy</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_main_window_win.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Debug</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_main_window_win.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Release</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\win\main_window_win.cpp">
 | 
			
		||||
      <Filter>SourceFiles\platform\win</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\window\main_window.cpp">
 | 
			
		||||
      <Filter>SourceFiles\window</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\win\windows_toasts.cpp">
 | 
			
		||||
      <Filter>SourceFiles\platform\win</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\win\windows_app_user_model_id.cpp">
 | 
			
		||||
      <Filter>SourceFiles\platform\win</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\win\windows_dlls.cpp">
 | 
			
		||||
      <Filter>SourceFiles\platform\win</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\win\windows_event_filter.cpp">
 | 
			
		||||
      <Filter>SourceFiles\platform\win</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\winrt\main_window_winrt.cpp">
 | 
			
		||||
      <Filter>SourceFiles\platform\winrt</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_main_window_mac.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Deploy</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_main_window_mac.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Release</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="SourceFiles\platform\linux\main_window_linux.cpp">
 | 
			
		||||
      <Filter>SourceFiles\platform\linux</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Deploy\moc_main_window_linux.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Deploy</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Debug\moc_main_window_linux.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Debug</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="GeneratedFiles\Release\moc_main_window_linux.cpp">
 | 
			
		||||
      <Filter>GeneratedFiles\Release</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ClInclude Include="SourceFiles\stdafx.h">
 | 
			
		||||
| 
						 | 
				
			
			@ -1526,6 +1559,24 @@
 | 
			
		|||
    <ClInclude Include="SourceFiles\data\data_drafts.h">
 | 
			
		||||
      <Filter>SourceFiles\data</Filter>
 | 
			
		||||
    </ClInclude>
 | 
			
		||||
    <ClInclude Include="SourceFiles\platform\platform_main_window.h">
 | 
			
		||||
      <Filter>SourceFiles\platform</Filter>
 | 
			
		||||
    </ClInclude>
 | 
			
		||||
    <ClInclude Include="SourceFiles\platform\win\windows_toasts.h">
 | 
			
		||||
      <Filter>SourceFiles\platform\win</Filter>
 | 
			
		||||
    </ClInclude>
 | 
			
		||||
    <ClInclude Include="SourceFiles\platform\win\windows_app_user_model_id.h">
 | 
			
		||||
      <Filter>SourceFiles\platform\win</Filter>
 | 
			
		||||
    </ClInclude>
 | 
			
		||||
    <ClInclude Include="SourceFiles\platform\win\windows_dlls.h">
 | 
			
		||||
      <Filter>SourceFiles\platform\win</Filter>
 | 
			
		||||
    </ClInclude>
 | 
			
		||||
    <ClInclude Include="SourceFiles\platform\win\windows_event_filter.h">
 | 
			
		||||
      <Filter>SourceFiles\platform\win</Filter>
 | 
			
		||||
    </ClInclude>
 | 
			
		||||
    <ClInclude Include="SourceFiles\platform\winrt\main_window_winrt.h">
 | 
			
		||||
      <Filter>SourceFiles\platform\winrt</Filter>
 | 
			
		||||
    </ClInclude>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <CustomBuild Include="SourceFiles\application.h">
 | 
			
		||||
| 
						 | 
				
			
			@ -1801,6 +1852,18 @@
 | 
			
		|||
    <CustomBuild Include="SourceFiles\boxes\report_box.h">
 | 
			
		||||
      <Filter>SourceFiles\boxes</Filter>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
    <CustomBuild Include="SourceFiles\platform\win\main_window_win.h">
 | 
			
		||||
      <Filter>SourceFiles\platform\win</Filter>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
    <CustomBuild Include="SourceFiles\window\main_window.h">
 | 
			
		||||
      <Filter>SourceFiles\window</Filter>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
    <CustomBuild Include="SourceFiles\platform\mac\main_window_mac.h">
 | 
			
		||||
      <Filter>SourceFiles\platform\mac</Filter>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
    <CustomBuild Include="SourceFiles\platform\linux\main_window_linux.h">
 | 
			
		||||
      <Filter>SourceFiles\platform\linux</Filter>
 | 
			
		||||
    </CustomBuild>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <None Include="Resources\langs\lang_it.strings">
 | 
			
		||||
| 
						 | 
				
			
			@ -1851,6 +1914,9 @@
 | 
			
		|||
    <None Include="Resources\langs\upload.sh">
 | 
			
		||||
      <Filter>Resources\langs</Filter>
 | 
			
		||||
    </None>
 | 
			
		||||
    <None Include="SourceFiles\platform\mac\main_window_mac.mm">
 | 
			
		||||
      <Filter>SourceFiles\platform\mac</Filter>
 | 
			
		||||
    </None>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Image Include="Resources\art\icon256.ico">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue