2014-09-26 16:48:19 -07:00
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2014-12-01 13:47:38 +03:00
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
2014-05-30 12:53:19 +04:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2015-10-03 16:16:42 +03:00
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2016-02-08 13:56:18 +03:00
|
|
|
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
2014-05-30 12:53:19 +04:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
inline QString psServerPrefix() {
|
|
|
|
return qsl("Global\\");
|
|
|
|
}
|
|
|
|
inline void psCheckLocalSocket(const QString &) {
|
|
|
|
}
|
|
|
|
|
2014-07-06 07:32:21 +04:00
|
|
|
class NotifyWindow;
|
2014-05-30 12:53:19 +04:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-07-06 07:32:21 +04:00
|
|
|
void psActivateNotify(NotifyWindow *w);
|
|
|
|
void psClearNotifies(PeerId peerId = 0);
|
|
|
|
void psNotifyShown(NotifyWindow *w);
|
2015-04-23 18:50:11 +03:00
|
|
|
void psPlatformNotify(HistoryItem *item, int32 fwdCount);
|
2014-07-06 07:32:21 +04:00
|
|
|
|
2014-12-15 18:55:45 +03:00
|
|
|
void psUpdateCounter();
|
|
|
|
|
2015-08-11 22:50:48 +03:00
|
|
|
bool psHasNativeNotifications();
|
|
|
|
void psCleanNotifyPhotosIn(int32 dt);
|
|
|
|
|
2014-12-15 18:55:45 +03:00
|
|
|
virtual QImage iconWithCounter(int size, int count, style::color bg, bool smallIcon) = 0;
|
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
~PsMainWindow();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
2014-09-20 14:31:03 -07:00
|
|
|
void psUpdateDelegate();
|
2014-05-30 12:53:19 +04:00
|
|
|
void psSavePosition(Qt::WindowState state = Qt::WindowActive);
|
2015-01-15 17:22:15 +03:00
|
|
|
void psShowTrayMenu();
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2015-08-11 22:50:48 +03:00
|
|
|
void psCleanNotifyPhotos();
|
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
protected:
|
|
|
|
|
2015-01-15 17:22:15 +03:00
|
|
|
bool psHasTrayIcon() const {
|
|
|
|
return trayIcon;
|
|
|
|
}
|
2014-06-20 11:06:21 +04:00
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
bool posInited;
|
|
|
|
QSystemTrayIcon *trayIcon;
|
2015-10-23 18:15:24 +02:00
|
|
|
PopupMenu *trayIconMenu;
|
2014-11-25 23:33:11 +03:00
|
|
|
QImage icon256, iconbig256;
|
2014-11-13 21:26:17 +03:00
|
|
|
QIcon wndIcon;
|
2014-09-20 14:31:03 -07:00
|
|
|
|
2015-01-15 17:22:15 +03:00
|
|
|
void psTrayMenuUpdated();
|
|
|
|
void psSetupTrayIcon();
|
2014-05-30 12:53:19 +04:00
|
|
|
|
|
|
|
QTimer psUpdatedPositionTimer;
|
|
|
|
|
|
|
|
private:
|
|
|
|
HWND ps_hWnd;
|
2016-03-20 21:34:20 +03:00
|
|
|
// HWND ps_tbHider_hWnd;
|
2014-05-30 12:53:19 +04:00
|
|
|
HMENU ps_menu;
|
|
|
|
HICON ps_iconBig, ps_iconSmall, ps_iconOverlay;
|
|
|
|
|
2015-08-11 22:50:48 +03:00
|
|
|
SingleTimer ps_cleanNotifyPhotosTimer;
|
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
void psDestroyIcons();
|
|
|
|
};
|
|
|
|
|
2016-01-25 13:22:58 +03:00
|
|
|
void psWriteDump();
|
2016-01-31 14:32:29 +03:00
|
|
|
void psWriteStackTrace();
|
2016-01-21 14:58:58 +08:00
|
|
|
|
2015-06-03 21:13:01 +03:00
|
|
|
void psDeleteDir(const QString &dir);
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2015-01-26 16:04:41 +03:00
|
|
|
void psUserActionDone();
|
2015-03-02 15:34:16 +03:00
|
|
|
bool psIdleSupported();
|
2015-01-26 16:04:41 +03:00
|
|
|
uint64 psIdleTime();
|
|
|
|
|
2015-01-27 19:58:58 +03:00
|
|
|
bool psSkipAudioNotify();
|
|
|
|
bool psSkipDesktopNotify();
|
|
|
|
|
2015-01-18 12:23:03 +03:00
|
|
|
QStringList psInitLogs();
|
|
|
|
void psClearInitLogs();
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2014-09-26 16:48:19 -07:00
|
|
|
void psActivateProcess(uint64 pid = 0);
|
2014-05-30 12:53:19 +04:00
|
|
|
QString psLocalServerPrefix();
|
|
|
|
QString psCurrentCountry();
|
|
|
|
QString psCurrentLanguage();
|
|
|
|
QString psAppDataPath();
|
2014-09-30 07:11:09 -07:00
|
|
|
QString psAppDataPathOld();
|
|
|
|
QString psDownloadPath();
|
2014-06-14 23:32:11 +04:00
|
|
|
QString psCurrentExeDirectory(int argc, char *argv[]);
|
2014-11-27 21:20:48 +03:00
|
|
|
QString psCurrentExeName(int argc, char *argv[]);
|
2014-05-30 12:53:19 +04:00
|
|
|
void psAutoStart(bool start, bool silent = false);
|
2014-07-18 14:37:34 +04:00
|
|
|
void psSendToMenu(bool send, bool silent = false);
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2014-07-06 07:32:21 +04:00
|
|
|
QRect psDesktopRect();
|
2014-10-17 16:57:14 +04:00
|
|
|
void psShowOverAll(QWidget *w, bool canFocus = true);
|
|
|
|
void psBringToBack(QWidget *w);
|
2014-07-06 07:32:21 +04:00
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
int psCleanup();
|
|
|
|
int psFixPrevious();
|
|
|
|
|
|
|
|
void psExecUpdater();
|
2016-01-30 21:24:42 +03:00
|
|
|
void psExecTelegram(const QString &arg = QString());
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2015-01-21 13:20:23 +03:00
|
|
|
bool psShowOpenWithMenu(int x, int y, const QString &file);
|
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
void psPostprocessFile(const QString &name);
|
|
|
|
void psOpenFile(const QString &name, bool openWith = false);
|
|
|
|
void psShowInFolder(const QString &name);
|
2016-01-11 23:43:29 +08:00
|
|
|
|
|
|
|
QAbstractNativeEventFilter *psNativeEventFilter();
|
2014-09-28 19:47:30 -07:00
|
|
|
|
2015-08-13 18:11:07 +03:00
|
|
|
void psNewVersion();
|
2014-12-03 16:10:32 +03:00
|
|
|
|
2014-09-28 19:47:30 -07:00
|
|
|
void psUpdateOverlayed(TWidget *widget);
|
2016-05-27 13:57:11 +03:00
|
|
|
inline QString psConvertFileUrl(const QUrl &url) {
|
|
|
|
return url.toLocalFile();
|
2014-09-30 07:13:47 -07:00
|
|
|
}
|
2015-11-26 20:34:52 +03:00
|
|
|
inline QByteArray psDownloadPathBookmark(const QString &path) {
|
|
|
|
return QByteArray();
|
|
|
|
}
|
|
|
|
inline QByteArray psPathBookmark(const QString &path) {
|
|
|
|
return QByteArray();
|
|
|
|
}
|
|
|
|
inline void psDownloadPathEnableAccess() {
|
|
|
|
}
|
|
|
|
|
|
|
|
class PsFileBookmark {
|
|
|
|
public:
|
|
|
|
PsFileBookmark(const QByteArray &bookmark) {
|
|
|
|
}
|
|
|
|
bool check() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool enable() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
void disable() const {
|
|
|
|
}
|
|
|
|
const QString &name(const QString &original) const {
|
|
|
|
return original;
|
|
|
|
}
|
|
|
|
QByteArray bookmark() const {
|
|
|
|
return QByteArray();
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
2016-02-17 19:37:21 +03:00
|
|
|
|
2016-02-28 16:54:04 +03:00
|
|
|
bool psLaunchMaps(const LocationCoords &coords);
|