mirror of https://github.com/procxx/kepka.git
Some platform-dependent modules refactoring.
Now each platform-dependent module declares its interface in platform/platform_module.h file and after that includes platform- specific headers like platform/win/module_win.h with implementation. Also removed the legacy WinRT platform-dependent implementations.
This commit is contained in:
parent
ae08a2f697
commit
6f0cf30b12
|
@ -2015,7 +2015,7 @@ namespace {
|
||||||
dependent->dependencyItemRemoved(item);
|
dependent->dependencyItemRemoved(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (auto manager = Window::Notifications::manager()) {
|
if (auto manager = Window::Notifications::GetManager()) {
|
||||||
manager->clearFromItem(item);
|
manager->clearFromItem(item);
|
||||||
}
|
}
|
||||||
if (Global::started() && !App::quitting()) {
|
if (Global::started() && !App::quitting()) {
|
||||||
|
@ -2434,7 +2434,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
void playSound() {
|
void playSound() {
|
||||||
if (Global::SoundNotify() && !Platform::Notifications::skipAudio()) {
|
if (Global::SoundNotify() && !Platform::Notifications::SkipAudio()) {
|
||||||
Media::Player::PlayNotify();
|
Media::Player::PlayNotify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,7 +335,7 @@ void Application::closeApplication() {
|
||||||
if (App::launchState() == App::QuitProcessed) return;
|
if (App::launchState() == App::QuitProcessed) return;
|
||||||
App::setLaunchState(App::QuitProcessed);
|
App::setLaunchState(App::QuitProcessed);
|
||||||
|
|
||||||
if (auto manager = Window::Notifications::manager()) {
|
if (auto manager = Window::Notifications::GetManager()) {
|
||||||
manager->clearAllFast();
|
manager->clearAllFast();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
#include "platform/platform_file_dialog.h"
|
#include "platform/platform_file_utilities.h"
|
||||||
|
|
||||||
AboutBox::AboutBox(QWidget *parent)
|
AboutBox::AboutBox(QWidget *parent)
|
||||||
: _version(this, lng_about_version(lt_version, QString::fromLatin1(AppVersionStr.c_str()) + (cAlphaVersion() ? " alpha" : "") + (cBetaVersion() ? qsl(" beta %1").arg(cBetaVersion()) : QString())), st::aboutVersionLink)
|
: _version(this, lng_about_version(lt_version, QString::fromLatin1(AppVersionStr.c_str()) + (cAlphaVersion() ? " alpha" : "") + (cBetaVersion() ? qsl(" beta %1").arg(cBetaVersion()) : QString())), st::aboutVersionLink)
|
||||||
|
|
|
@ -60,7 +60,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
#include "core/qthelp_regex.h"
|
#include "core/qthelp_regex.h"
|
||||||
#include "ui/widgets/popup_menu.h"
|
#include "ui/widgets/popup_menu.h"
|
||||||
#include "platform/platform_file_dialog.h"
|
#include "platform/platform_file_utilities.h"
|
||||||
#include "auth_session.h"
|
#include "auth_session.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -5959,7 +5959,7 @@ DragState HistoryWidget::getDragState(const QMimeData *d) {
|
||||||
for (QList<QUrl>::const_iterator i = urls.cbegin(), en = urls.cend(); i != en; ++i) {
|
for (QList<QUrl>::const_iterator i = urls.cbegin(), en = urls.cend(); i != en; ++i) {
|
||||||
if (!i->isLocalFile()) return DragStateNone;
|
if (!i->isLocalFile()) return DragStateNone;
|
||||||
|
|
||||||
auto file = Platform::FileDialog::UrlToLocal(*i);
|
auto file = Platform::File::UrlToLocal(*i);
|
||||||
|
|
||||||
QFileInfo info(file);
|
QFileInfo info(file);
|
||||||
if (info.isDir()) return DragStateNone;
|
if (info.isDir()) return DragStateNone;
|
||||||
|
@ -6658,7 +6658,7 @@ HistoryWidget::SendingFilesLists HistoryWidget::getSendingFilesLists(const QList
|
||||||
if (!url.isLocalFile()) {
|
if (!url.isLocalFile()) {
|
||||||
result.nonLocalUrls.push_back(url);
|
result.nonLocalUrls.push_back(url);
|
||||||
} else {
|
} else {
|
||||||
auto filepath = Platform::FileDialog::UrlToLocal(url);
|
auto filepath = Platform::File::UrlToLocal(url);
|
||||||
getSendingLocalFileInfo(result, filepath);
|
getSendingLocalFileInfo(result, filepath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,12 +285,12 @@ action app bin command csh osx workflow\
|
||||||
*result = qsl("\
|
*result = qsl("\
|
||||||
bin csh ksh out run\
|
bin csh ksh out run\
|
||||||
").split(' ');
|
").split(' ');
|
||||||
#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
|
#else // Q_OS_MAC || Q_OS_LINUX
|
||||||
*result = qsl("\
|
*result = qsl("\
|
||||||
bat bin cmd com cpl exe gadget inf ins inx isu job jse lnk msc msi \
|
bat bin cmd com cpl exe gadget inf ins inx isu job jse lnk msc msi \
|
||||||
msp mst paf pif ps1 reg rgs sct shb shs u3p vb vbe vbs vbscript ws wsf\
|
msp mst paf pif ps1 reg rgs sct shb shs u3p vb vbe vbs vbscript ws wsf\
|
||||||
").split(' ');
|
").split(' ');
|
||||||
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
|
#endif // !Q_OS_MAC && !Q_OS_LINUX
|
||||||
return result.release();
|
return result.release();
|
||||||
})());
|
})());
|
||||||
|
|
||||||
|
|
|
@ -970,7 +970,7 @@ void MainWindow::notifySchedule(History *history, HistoryItem *item) {
|
||||||
|
|
||||||
auto when = ms + delay;
|
auto when = ms + delay;
|
||||||
_notifyWhenAlerts[history].insert(when, notifyByFrom);
|
_notifyWhenAlerts[history].insert(when, notifyByFrom);
|
||||||
if (Global::DesktopNotify() && !Platform::Notifications::skipToast()) {
|
if (Global::DesktopNotify() && !Platform::Notifications::SkipToast()) {
|
||||||
NotifyWhenMaps::iterator i = _notifyWhenMaps.find(history);
|
NotifyWhenMaps::iterator i = _notifyWhenMaps.find(history);
|
||||||
if (i == _notifyWhenMaps.end()) {
|
if (i == _notifyWhenMaps.end()) {
|
||||||
i = _notifyWhenMaps.insert(history, NotifyWhenMap());
|
i = _notifyWhenMaps.insert(history, NotifyWhenMap());
|
||||||
|
@ -993,7 +993,7 @@ void MainWindow::notifySchedule(History *history, HistoryItem *item) {
|
||||||
|
|
||||||
void MainWindow::notifyClear(History *history) {
|
void MainWindow::notifyClear(History *history) {
|
||||||
if (!history) {
|
if (!history) {
|
||||||
Window::Notifications::manager()->clearAll();
|
Window::Notifications::GetManager()->clearAll();
|
||||||
|
|
||||||
for (auto i = _notifyWhenMaps.cbegin(), e = _notifyWhenMaps.cend(); i != e; ++i) {
|
for (auto i = _notifyWhenMaps.cbegin(), e = _notifyWhenMaps.cend(); i != e; ++i) {
|
||||||
i.key()->clearNotifications();
|
i.key()->clearNotifications();
|
||||||
|
@ -1005,7 +1005,7 @@ void MainWindow::notifyClear(History *history) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::Notifications::manager()->clearFromHistory(history);
|
Window::Notifications::GetManager()->clearFromHistory(history);
|
||||||
|
|
||||||
history->clearNotifications();
|
history->clearNotifications();
|
||||||
_notifyWhenMaps.remove(history);
|
_notifyWhenMaps.remove(history);
|
||||||
|
@ -1018,7 +1018,7 @@ void MainWindow::notifyClear(History *history) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::notifyClearFast() {
|
void MainWindow::notifyClearFast() {
|
||||||
Window::Notifications::manager()->clearAllFast();
|
Window::Notifications::GetManager()->clearAllFast();
|
||||||
|
|
||||||
_notifyWhenMaps.clear();
|
_notifyWhenMaps.clear();
|
||||||
_notifyWhenAlerts.clear();
|
_notifyWhenAlerts.clear();
|
||||||
|
@ -1100,7 +1100,7 @@ void MainWindow::notifyShowNext() {
|
||||||
App::playSound();
|
App::playSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_notifyWaiters.isEmpty() || !Global::DesktopNotify() || Platform::Notifications::skipToast()) {
|
if (_notifyWaiters.isEmpty() || !Global::DesktopNotify() || Platform::Notifications::SkipToast()) {
|
||||||
if (nextAlert) {
|
if (nextAlert) {
|
||||||
_notifyWaitTimer.start(nextAlert - ms);
|
_notifyWaitTimer.start(nextAlert - ms);
|
||||||
}
|
}
|
||||||
|
@ -1194,7 +1194,7 @@ void MainWindow::notifyShowNext() {
|
||||||
} while (nextNotify);
|
} while (nextNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::Notifications::manager()->showNotification(notifyItem, fwdCount);
|
Window::Notifications::GetManager()->showNotification(notifyItem, fwdCount);
|
||||||
|
|
||||||
if (!history->hasNotification()) {
|
if (!history->hasNotification()) {
|
||||||
_notifyWaiters.remove(history);
|
_notifyWaiters.remove(history);
|
||||||
|
@ -1216,7 +1216,7 @@ void MainWindow::app_activateClickHandler(ClickHandlerPtr handler, Qt::MouseButt
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::notifyUpdateAll() {
|
void MainWindow::notifyUpdateAll() {
|
||||||
Window::Notifications::manager()->updateAll();
|
Window::Notifications::GetManager()->updateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage MainWindow::iconLarge() const {
|
QImage MainWindow::iconLarge() const {
|
||||||
|
|
|
@ -88,7 +88,7 @@ Messenger::Messenger() : QObject()
|
||||||
anim::startManager();
|
anim::startManager();
|
||||||
historyInit();
|
historyInit();
|
||||||
Media::Player::start();
|
Media::Player::start();
|
||||||
Window::Notifications::start();
|
Window::Notifications::Start();
|
||||||
|
|
||||||
DEBUG_LOG(("Application Info: inited..."));
|
DEBUG_LOG(("Application Info: inited..."));
|
||||||
|
|
||||||
|
@ -678,7 +678,7 @@ Messenger::~Messenger() {
|
||||||
|
|
||||||
Shortcuts::finish();
|
Shortcuts::finish();
|
||||||
|
|
||||||
Window::Notifications::finish();
|
Window::Notifications::Finish();
|
||||||
|
|
||||||
anim::stopManager();
|
anim::stopManager();
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "platform/linux/file_dialog_linux.h"
|
#include "platform/linux/file_utilities_linux.h"
|
||||||
|
|
||||||
#include <private/qguiapplication_p.h>
|
#include <private/qguiapplication_p.h>
|
||||||
#include "platform/linux/linux_libs.h"
|
#include "platform/linux/linux_libs.h"
|
|
@ -20,7 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ui/filedialog.h"
|
#include "platform/platform_file_utilities.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#undef signals
|
#undef signals
|
||||||
|
@ -30,16 +30,20 @@ extern "C" {
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
|
namespace File {
|
||||||
|
|
||||||
|
inline QString UrlToLocal(const QUrl &url) {
|
||||||
|
return url.toLocalFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace File
|
||||||
|
|
||||||
namespace FileDialog {
|
namespace FileDialog {
|
||||||
|
|
||||||
bool Supported();
|
bool Supported();
|
||||||
|
|
||||||
bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption, const QString &filter, ::FileDialog::internal::Type type, QString startFile);
|
bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption, const QString &filter, ::FileDialog::internal::Type type, QString startFile);
|
||||||
|
|
||||||
inline QString UrlToLocal(const QUrl &url) {
|
|
||||||
return url.toLocalFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
// This is a patched copy of qgtk2 theme plugin.
|
// This is a patched copy of qgtk2 theme plugin.
|
|
@ -20,7 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "window/main_window.h"
|
#include "platform/platform_main_window.h"
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ using Notification = QSharedPointer<NotificationData>;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void start() {
|
void Start() {
|
||||||
if (LibNotifyLoaded()) {
|
if (LibNotifyLoaded()) {
|
||||||
if (Libs::notify_is_initted() || Libs::notify_init("Telegram Desktop")) {
|
if (Libs::notify_is_initted() || Libs::notify_init("Telegram Desktop")) {
|
||||||
ManagerInstance.createIfNull();
|
ManagerInstance.createIfNull();
|
||||||
|
@ -246,19 +246,19 @@ void start() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager *manager() {
|
Window::Notifications::Manager *GetManager() {
|
||||||
if (Global::started() && Global::NativeNotifications()) {
|
if (Global::started() && Global::NativeNotifications()) {
|
||||||
return ManagerInstance.data();
|
return ManagerInstance.data();
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool supported() {
|
bool Supported() {
|
||||||
return ManagerInstance.data() != nullptr;
|
return ManagerInstance.data() != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void finish() {
|
void Finish() {
|
||||||
if (manager()) {
|
if (GetManager()) {
|
||||||
ManagerInstance.reset();
|
ManagerInstance.reset();
|
||||||
Libs::notify_uninit();
|
Libs::notify_uninit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,19 +20,19 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "window/notifications_manager.h"
|
#include "platform/platform_notifications_manager.h"
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace Notifications {
|
namespace Notifications {
|
||||||
|
|
||||||
inline void defaultNotificationShown(QWidget *widget) {
|
inline void CustomNotificationShownHook(QWidget *widget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool skipAudio() {
|
inline bool SkipAudio() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool skipToast() {
|
inline bool SkipToast() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ui/filedialog.h"
|
#include "platform/platform_file_utilities.h"
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace FileDialog {
|
namespace FileDialog {
|
||||||
|
@ -33,7 +33,5 @@ inline bool Get(QStringList &files, QByteArray &remoteContent, const QString &ca
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString UrlToLocal(const QUrl &url);
|
|
||||||
|
|
||||||
} // namespace FileDialog
|
} // namespace FileDialog
|
||||||
} // namespace Platform
|
} // namespace Platform
|
|
@ -19,7 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "platform/mac/file_dialog_mac.h"
|
#include "platform/mac/file_utilities_mac.h"
|
||||||
|
|
||||||
#include "platform/mac/mac_utilities.h"
|
#include "platform/mac/mac_utilities.h"
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include <CoreFoundation/CFURL.h>
|
#include <CoreFoundation/CFURL.h>
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace FileDialog {
|
namespace File {
|
||||||
|
|
||||||
QString UrlToLocal(const QUrl &url) {
|
QString UrlToLocal(const QUrl &url) {
|
||||||
auto result = url.toLocalFile();
|
auto result = url.toLocalFile();
|
||||||
|
@ -40,5 +40,5 @@ QString UrlToLocal(const QUrl &url) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace FileDialog
|
} // namespace File
|
||||||
} // namespace Platform
|
} // namespace Platform
|
|
@ -20,7 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "window/main_window.h"
|
#include "platform/platform_main_window.h"
|
||||||
#include "pspecific_mac_p.h"
|
#include "pspecific_mac_p.h"
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
|
|
|
@ -94,7 +94,7 @@ MainWindow::Private *_private;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) activeSpaceDidChange:(NSNotification *)aNotification {
|
- (void) activeSpaceDidChange:(NSNotification *)aNotification {
|
||||||
if (auto manager = Window::Notifications::Default::manager()) {
|
if (auto manager = Window::Notifications::Default::GetManager()) {
|
||||||
manager->enumerateNotifications([](QWidget *widget) {
|
manager->enumerateNotifications([](QWidget *widget) {
|
||||||
objc_activateWnd(widget->winId());
|
objc_activateWnd(widget->winId());
|
||||||
});
|
});
|
||||||
|
@ -293,7 +293,7 @@ void MainWindow::psUpdateWorkmode() {
|
||||||
trayIcon = nullptr;
|
trayIcon = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (auto manager = Platform::Notifications::manager()) {
|
if (auto manager = Platform::Notifications::ManagerNative()) {
|
||||||
manager->updateDelegate();
|
manager->updateDelegate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,19 +20,26 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "window/notifications_manager.h"
|
#include "platform/platform_notifications_manager.h"
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace Notifications {
|
namespace Notifications {
|
||||||
|
|
||||||
inline bool skipAudio() {
|
class Manager;
|
||||||
|
Manager *GetNativeManager();
|
||||||
|
|
||||||
|
inline bool SkipAudio() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool skipToast() {
|
inline bool SkipToast() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Window::Notifications::Manager *GetManager() {
|
||||||
|
return GetNativeManager();
|
||||||
|
}
|
||||||
|
|
||||||
class Manager : public Window::Notifications::NativeManager {
|
class Manager : public Window::Notifications::NativeManager {
|
||||||
public:
|
public:
|
||||||
Manager();
|
Manager();
|
||||||
|
|
|
@ -94,21 +94,21 @@ NSImage *qt_mac_create_nsimage(const QPixmap &pm);
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace Notifications {
|
namespace Notifications {
|
||||||
|
|
||||||
void start() {
|
void Start() {
|
||||||
if (cPlatform() != dbipMacOld) {
|
if (cPlatform() != dbipMacOld) {
|
||||||
ManagerInstance.createIfNull();
|
ManagerInstance.createIfNull();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager *manager() {
|
Manager *GetNativeManager() {
|
||||||
return ManagerInstance.data();
|
return ManagerInstance.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void finish() {
|
void Finish() {
|
||||||
ManagerInstance.clear();
|
ManagerInstance.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void defaultNotificationShown(QWidget *widget) {
|
void CustomNotificationShownHook(QWidget *widget) {
|
||||||
widget->hide();
|
widget->hide();
|
||||||
objc_holdOnTop(widget->winId());
|
objc_holdOnTop(widget->winId());
|
||||||
widget->show();
|
widget->show();
|
||||||
|
|
|
@ -20,7 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "window/window_title.h"
|
#include "platform/platform_window_title.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PlainShadow;
|
class PlainShadow;
|
||||||
|
|
|
@ -20,6 +20,18 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
namespace Platform {
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
void DeInit();
|
||||||
|
|
||||||
|
} // namespace Audio
|
||||||
|
} // namespace Platform
|
||||||
|
|
||||||
|
// Platform dependent implementations.
|
||||||
|
|
||||||
#if defined Q_OS_MAC || defined Q_OS_LINUX
|
#if defined Q_OS_MAC || defined Q_OS_LINUX
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace Audio {
|
namespace Audio {
|
||||||
|
|
|
@ -20,12 +20,30 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "window/main_window.h"
|
#include "ui/filedialog.h"
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
|
namespace File {
|
||||||
|
|
||||||
class MainWindow : public Window::MainWindow {
|
QString UrlToLocal(const QUrl &url);
|
||||||
|
|
||||||
};
|
} // namespace File
|
||||||
|
|
||||||
|
namespace FileDialog {
|
||||||
|
|
||||||
|
bool Supported();
|
||||||
|
|
||||||
|
bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption, const QString &filter, ::FileDialog::internal::Type type, QString startFile);
|
||||||
|
|
||||||
|
} // namespace FileDialog
|
||||||
} // namespace Platform
|
} // namespace Platform
|
||||||
|
|
||||||
|
// Platform dependent implementations.
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
#include "platform/mac/file_utilities_mac.h"
|
||||||
|
#elif defined Q_OS_LINUX // Q_OS_MAC
|
||||||
|
#include "platform/linux/file_utilities_linux.h"
|
||||||
|
#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
|
||||||
|
#include "platform/win/file_utilities_win.h"
|
||||||
|
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
|
|
@ -20,12 +20,20 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "window/main_window.h"
|
||||||
|
|
||||||
|
namespace Platform {
|
||||||
|
|
||||||
|
class MainWindow;
|
||||||
|
|
||||||
|
} // namespace Platform
|
||||||
|
|
||||||
|
// Platform dependent implementations.
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include "platform/mac/main_window_mac.h"
|
#include "platform/mac/main_window_mac.h"
|
||||||
#elif defined Q_OS_LINUX // Q_OS_MAC
|
#elif defined Q_OS_LINUX // Q_OS_MAC
|
||||||
#include "platform/linux/main_window_linux.h"
|
#include "platform/linux/main_window_linux.h"
|
||||||
#elif defined Q_OS_WINRT // Q_OS_MAC || Q_OS_LINUX
|
#elif defined Q_OS_WIN // 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"
|
#include "platform/win/main_window_win.h"
|
||||||
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
|
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN
|
||||||
|
|
|
@ -20,30 +20,29 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// Platform module must define a Platform::Notifications::Manager class.
|
#include "window/notifications_manager.h"
|
||||||
// It should be Window::Notifications::Manager or its derivative.
|
|
||||||
|
namespace Platform {
|
||||||
|
namespace Notifications {
|
||||||
|
|
||||||
|
void CustomNotificationShownHook(QWidget *widget);
|
||||||
|
bool SkipAudio();
|
||||||
|
bool SkipToast();
|
||||||
|
|
||||||
|
void Start();
|
||||||
|
Window::Notifications::Manager *GetManager();
|
||||||
|
bool Supported();
|
||||||
|
void Finish();
|
||||||
|
|
||||||
|
} // namespace Notifications
|
||||||
|
} // namespace Platform
|
||||||
|
|
||||||
|
// Platform dependent implementations.
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include "platform/mac/notifications_manager_mac.h"
|
#include "platform/mac/notifications_manager_mac.h"
|
||||||
#elif defined Q_OS_LINUX // Q_OS_MAC
|
#elif defined Q_OS_LINUX // Q_OS_MAC
|
||||||
#include "platform/linux/notifications_manager_linux.h"
|
#include "platform/linux/notifications_manager_linux.h"
|
||||||
#elif defined Q_OS_WINRT // Q_OS_MAC || Q_OS_LINUX
|
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
|
||||||
#include "platform/winrt/notifications_manager_winrt.h"
|
|
||||||
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT
|
|
||||||
#include "platform/win/notifications_manager_win.h"
|
#include "platform/win/notifications_manager_win.h"
|
||||||
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
|
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN
|
||||||
|
|
||||||
// Platform-independent API.
|
|
||||||
namespace Platform {
|
|
||||||
namespace Notifications {
|
|
||||||
|
|
||||||
void defaultNotificationShown(QWidget *widget);
|
|
||||||
bool skipAudio();
|
|
||||||
bool skipToast();
|
|
||||||
|
|
||||||
void start();
|
|
||||||
Manager *manager();
|
|
||||||
bool supported();
|
|
||||||
void finish();
|
|
||||||
|
|
||||||
} // namespace Notifications
|
|
||||||
} // namespace Platform
|
|
||||||
|
|
|
@ -21,15 +21,18 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "window/window_title.h"
|
#include "window/window_title.h"
|
||||||
|
#include "window/themes/window_theme_preview.h"
|
||||||
|
|
||||||
namespace Window {
|
namespace Platform {
|
||||||
namespace Theme {
|
|
||||||
|
|
||||||
int DefaultPreviewTitleHeight();
|
object_ptr<Window::TitleWidget> CreateTitleWidget(QWidget *parent);
|
||||||
void DefaultPreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRect body, int outerWidth);
|
|
||||||
|
|
||||||
} // namespace Theme
|
int PreviewTitleHeight();
|
||||||
} // namespace Window
|
void PreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRect body, int outerWidth);
|
||||||
|
|
||||||
|
} // namespace Platform
|
||||||
|
|
||||||
|
// Platform dependent implementations.
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include "platform/mac/window_title_mac.h"
|
#include "platform/mac/window_title_mac.h"
|
||||||
|
|
|
@ -19,11 +19,5 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "platform/win/main_window_winrt.h"
|
#include "platform/win/file_utilities_win.h"
|
||||||
|
|
||||||
namespace Platform {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
} // namespace Platform
|
|
|
@ -20,15 +20,17 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ui/filedialog.h"
|
#include "platform/platform_file_utilities.h"
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
#include "platform/mac/file_dialog_mac.h"
|
|
||||||
#elif defined Q_OS_LINUX // Q_OS_MAC
|
|
||||||
#include "platform/linux/file_dialog_linux.h"
|
|
||||||
#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
|
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
|
namespace File {
|
||||||
|
|
||||||
|
inline QString UrlToLocal(const QUrl &url) {
|
||||||
|
return url.toLocalFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace File
|
||||||
|
|
||||||
namespace FileDialog {
|
namespace FileDialog {
|
||||||
|
|
||||||
inline bool Supported() {
|
inline bool Supported() {
|
||||||
|
@ -39,11 +41,5 @@ inline bool Get(QStringList &files, QByteArray &remoteContent, const QString &ca
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QString UrlToLocal(const QUrl &url) {
|
|
||||||
return url.toLocalFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace FileDialog
|
} // namespace FileDialog
|
||||||
} // namespace Platform
|
} // namespace Platform
|
||||||
|
|
||||||
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
|
|
|
@ -802,7 +802,7 @@ void MainWindow::initHook() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::psHasNativeNotifications() {
|
bool MainWindow::psHasNativeNotifications() {
|
||||||
return Notifications::supported();
|
return Notifications::Supported();
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QMargins);
|
Q_DECLARE_METATYPE(QMargins);
|
||||||
|
|
|
@ -20,7 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "window/main_window.h"
|
#include "platform/platform_main_window.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
|
@ -315,24 +315,24 @@ private:
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void start() {
|
void Start() {
|
||||||
if (init()) {
|
if (init()) {
|
||||||
ManagerInstance.createIfNull();
|
ManagerInstance.createIfNull();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager *manager() {
|
Window::Notifications::Manager *GetManager() {
|
||||||
if (Global::started() && Global::NativeNotifications()) {
|
if (Global::started() && Global::NativeNotifications()) {
|
||||||
return ManagerInstance.data();
|
return ManagerInstance.data();
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool supported() {
|
bool Supported() {
|
||||||
return ManagerInstance.data() != nullptr;
|
return ManagerInstance.data() != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void finish() {
|
void Finish() {
|
||||||
ManagerInstance.clear();
|
ManagerInstance.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ void querySystemNotificationSettings() {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
bool skipAudio() {
|
bool SkipAudio() {
|
||||||
querySystemNotificationSettings();
|
querySystemNotificationSettings();
|
||||||
|
|
||||||
if (UserNotificationState == QUNS_NOT_PRESENT || UserNotificationState == QUNS_PRESENTATION_MODE) {
|
if (UserNotificationState == QUNS_NOT_PRESENT || UserNotificationState == QUNS_PRESENTATION_MODE) {
|
||||||
|
@ -615,7 +615,7 @@ bool skipAudio() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool skipToast() {
|
bool SkipToast() {
|
||||||
querySystemNotificationSettings();
|
querySystemNotificationSettings();
|
||||||
|
|
||||||
if (UserNotificationState == QUNS_PRESENTATION_MODE || UserNotificationState == QUNS_RUNNING_D3D_FULL_SCREEN/* || UserNotificationState == QUNS_BUSY*/) {
|
if (UserNotificationState == QUNS_PRESENTATION_MODE || UserNotificationState == QUNS_RUNNING_D3D_FULL_SCREEN/* || UserNotificationState == QUNS_BUSY*/) {
|
||||||
|
|
|
@ -20,12 +20,12 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "window/notifications_manager.h"
|
#include "platform/platform_notifications_manager.h"
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace Notifications {
|
namespace Notifications {
|
||||||
|
|
||||||
inline void defaultNotificationShown(QWidget *widget) {
|
inline void CustomNotificationShownHook(QWidget *widget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
class Manager : public Window::Notifications::NativeManager {
|
class Manager : public Window::Notifications::NativeManager {
|
||||||
|
|
|
@ -20,7 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "window/window_title.h"
|
#include "platform/platform_window_title.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class IconButton;
|
class IconButton;
|
||||||
|
|
|
@ -37,7 +37,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "messenger.h"
|
#include "messenger.h"
|
||||||
#include "platform/platform_file_dialog.h"
|
#include "platform/platform_file_utilities.h"
|
||||||
|
|
||||||
namespace Profile {
|
namespace Profile {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -252,7 +252,7 @@ bool CoverWidget::mimeDataHasImage(const QMimeData *mimeData) const {
|
||||||
auto &url = urls.at(0);
|
auto &url = urls.at(0);
|
||||||
if (!url.isLocalFile()) return false;
|
if (!url.isLocalFile()) return false;
|
||||||
|
|
||||||
auto file = Platform::FileDialog::UrlToLocal(url);
|
auto file = Platform::File::UrlToLocal(url);
|
||||||
|
|
||||||
QFileInfo info(file);
|
QFileInfo info(file);
|
||||||
if (info.isDir()) return false;
|
if (info.isDir()) return false;
|
||||||
|
@ -305,7 +305,7 @@ void CoverWidget::dropEvent(QDropEvent *e) {
|
||||||
if (urls.size() == 1) {
|
if (urls.size() == 1) {
|
||||||
auto &url = urls.at(0);
|
auto &url = urls.at(0);
|
||||||
if (url.isLocalFile()) {
|
if (url.isLocalFile()) {
|
||||||
img = App::readImage(Platform::FileDialog::UrlToLocal(url));
|
img = App::readImage(Platform::File::UrlToLocal(url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "pspecific_mac.h"
|
#include "pspecific_mac.h"
|
||||||
#elif defined Q_OS_LINUX // Q_OS_MAC
|
#elif defined Q_OS_LINUX // Q_OS_MAC
|
||||||
#include "pspecific_linux.h"
|
#include "pspecific_linux.h"
|
||||||
#elif defined Q_OS_WINRT // Q_OS_MAC || Q_OS_LINUX
|
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
|
||||||
#include "pspecific_winrt.h"
|
|
||||||
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT
|
|
||||||
#include "pspecific_win.h"
|
#include "pspecific_win.h"
|
||||||
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
|
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,201 +0,0 @@
|
||||||
|
|
||||||
/*
|
|
||||||
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-2017 John Preston, https://desktop.telegram.org
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
inline QString psServerPrefix() {
|
|
||||||
return qsl("Global\\");
|
|
||||||
}
|
|
||||||
inline void psCheckLocalSocket(const QString &) {
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Window {
|
|
||||||
namespace Notifications {
|
|
||||||
class Widget;
|
|
||||||
} // namespace Notifications
|
|
||||||
} // namespace Window
|
|
||||||
|
|
||||||
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, const 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();
|
|
||||||
|
|
||||||
void psDeleteDir(const QString &dir);
|
|
||||||
|
|
||||||
void psUserActionDone();
|
|
||||||
bool psIdleSupported();
|
|
||||||
uint64 psIdleTime();
|
|
||||||
|
|
||||||
bool psSkipAudioNotify();
|
|
||||||
bool psSkipDesktopNotify();
|
|
||||||
|
|
||||||
QStringList psInitLogs();
|
|
||||||
void psClearInitLogs();
|
|
||||||
|
|
||||||
void psActivateProcess(uint64 pid = 0);
|
|
||||||
QString psLocalServerPrefix();
|
|
||||||
QString psCurrentCountry();
|
|
||||||
QString psCurrentLanguage();
|
|
||||||
QString psAppDataPath();
|
|
||||||
QString psAppDataPathOld();
|
|
||||||
QString psDownloadPath();
|
|
||||||
QString psCurrentExeDirectory(int argc, char *argv[]);
|
|
||||||
QString psCurrentExeName(int argc, char *argv[]);
|
|
||||||
void psAutoStart(bool start, bool silent = false);
|
|
||||||
void psSendToMenu(bool send, bool silent = false);
|
|
||||||
|
|
||||||
QRect psDesktopRect();
|
|
||||||
void psShowOverAll(QWidget *w, bool canFocus = true);
|
|
||||||
void psBringToBack(QWidget *w);
|
|
||||||
|
|
||||||
int psCleanup();
|
|
||||||
int psFixPrevious();
|
|
||||||
|
|
||||||
void psExecUpdater();
|
|
||||||
void psExecTelegram(const QString &arg = QString());
|
|
||||||
|
|
||||||
bool psShowOpenWithMenu(int x, int y, const QString &file);
|
|
||||||
|
|
||||||
void psPostprocessFile(const QString &name);
|
|
||||||
void psOpenFile(const QString &name, bool openWith = false);
|
|
||||||
void psShowInFolder(const QString &name);
|
|
||||||
|
|
||||||
QAbstractNativeEventFilter *psNativeEventFilter();
|
|
||||||
|
|
||||||
void psNewVersion();
|
|
||||||
|
|
||||||
void psUpdateOverlayed(TWidget *widget);
|
|
||||||
inline QString psConvertFileUrl(const QUrl &url) {
|
|
||||||
return url.toLocalFile();
|
|
||||||
}
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
bool psLaunchMaps(const LocationCoords &coords);
|
|
|
@ -35,7 +35,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "boxes/addcontactbox.h"
|
#include "boxes/addcontactbox.h"
|
||||||
#include "styles/style_settings.h"
|
#include "styles/style_settings.h"
|
||||||
#include "styles/style_profile.h" // for divider
|
#include "styles/style_profile.h" // for divider
|
||||||
#include "platform/platform_file_dialog.h"
|
#include "platform/platform_file_utilities.h"
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ bool CoverWidget::mimeDataHasImage(const QMimeData *mimeData) const {
|
||||||
auto &url = urls.at(0);
|
auto &url = urls.at(0);
|
||||||
if (!url.isLocalFile()) return false;
|
if (!url.isLocalFile()) return false;
|
||||||
|
|
||||||
auto file = Platform::FileDialog::UrlToLocal(url);
|
auto file = Platform::File::UrlToLocal(url);
|
||||||
|
|
||||||
QFileInfo info(file);
|
QFileInfo info(file);
|
||||||
if (info.isDir()) return false;
|
if (info.isDir()) return false;
|
||||||
|
@ -235,7 +235,7 @@ void CoverWidget::dropEvent(QDropEvent *e) {
|
||||||
if (urls.size() == 1) {
|
if (urls.size() == 1) {
|
||||||
auto &url = urls.at(0);
|
auto &url = urls.at(0);
|
||||||
if (url.isLocalFile()) {
|
if (url.isLocalFile()) {
|
||||||
img = App::readImage(Platform::FileDialog::UrlToLocal(url));
|
img = App::readImage(Platform::File::UrlToLocal(url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ void NotificationsWidget::onNativeNotifications() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::Notifications::manager()->clearAllFast();
|
Window::Notifications::GetManager()->clearAllFast();
|
||||||
Global::SetNativeNotifications(_nativeNotifications->checked());
|
Global::SetNativeNotifications(_nativeNotifications->checked());
|
||||||
Local::writeUserSettings();
|
Local::writeUserSettings();
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "localstorage.h"
|
#include "localstorage.h"
|
||||||
#include "platform/platform_file_dialog.h"
|
#include "platform/platform_file_utilities.h"
|
||||||
|
|
||||||
#include "core/task_queue.h"
|
#include "core/task_queue.h"
|
||||||
|
|
||||||
|
@ -178,9 +178,9 @@ bool getFiles(QStringList &files, QByteArray &remoteContent, const QString &capt
|
||||||
files = dialog.selectedFiles().mid(0, 1);
|
files = dialog.selectedFiles().mid(0, 1);
|
||||||
}
|
}
|
||||||
if (type == Type::ReadFile || type == Type::ReadFiles) {
|
if (type == Type::ReadFile || type == Type::ReadFiles) {
|
||||||
#if defined Q_OS_WIN && !defined Q_OS_WINRT
|
#ifdef Q_OS_WIN
|
||||||
remoteContent = dialog.selectedRemoteContent();
|
remoteContent = dialog.selectedRemoteContent();
|
||||||
#endif // Q_OS_WIN && !Q_OS_WINRT
|
#endif // Q_OS_WIN
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,21 +30,21 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
namespace Window {
|
namespace Window {
|
||||||
namespace Notifications {
|
namespace Notifications {
|
||||||
|
|
||||||
void start() {
|
void Start() {
|
||||||
Default::start();
|
Default::Start();
|
||||||
Platform::Notifications::start();
|
Platform::Notifications::Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager *manager() {
|
Manager *GetManager() {
|
||||||
if (auto result = Platform::Notifications::manager()) {
|
if (auto result = Platform::Notifications::GetManager()) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return Default::manager();
|
return Default::GetManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
void finish() {
|
void Finish() {
|
||||||
Platform::Notifications::finish();
|
Platform::Notifications::Finish();
|
||||||
Default::finish();
|
Default::Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager::DisplayOptions Manager::getNotificationOptions(HistoryItem *item) {
|
Manager::DisplayOptions Manager::getNotificationOptions(HistoryItem *item) {
|
||||||
|
|
|
@ -25,9 +25,9 @@ namespace Notifications {
|
||||||
|
|
||||||
class Manager;
|
class Manager;
|
||||||
|
|
||||||
void start();
|
void Start();
|
||||||
Manager *manager();
|
Manager *GetManager();
|
||||||
void finish();
|
void Finish();
|
||||||
|
|
||||||
class Manager {
|
class Manager {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -60,15 +60,15 @@ internal::Widget::Direction notificationShiftDirection() {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void start() {
|
void Start() {
|
||||||
ManagerInstance.createIfNull();
|
ManagerInstance.createIfNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager *manager() {
|
Manager *GetManager() {
|
||||||
return ManagerInstance.data();
|
return ManagerInstance.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void finish() {
|
void Finish() {
|
||||||
ManagerInstance.clear();
|
ManagerInstance.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ void Manager::showNextFromQueue() {
|
||||||
queued.item,
|
queued.item,
|
||||||
queued.forwardedCount,
|
queued.forwardedCount,
|
||||||
startPosition, startShift, shiftDirection);
|
startPosition, startShift, shiftDirection);
|
||||||
Platform::Notifications::defaultNotificationShown(notification.get());
|
Platform::Notifications::CustomNotificationShownHook(notification.get());
|
||||||
_notifications.push_back(notification.release());
|
_notifications.push_back(notification.release());
|
||||||
--count;
|
--count;
|
||||||
} while (count > 0 && !_queuedNotifications.isEmpty());
|
} while (count > 0 && !_queuedNotifications.isEmpty());
|
||||||
|
@ -476,9 +476,9 @@ Notification::Notification(History *history, PeerData *peer, PeerData *author, H
|
||||||
, _author(author)
|
, _author(author)
|
||||||
, _item(msg)
|
, _item(msg)
|
||||||
, _forwardedCount(forwardedCount)
|
, _forwardedCount(forwardedCount)
|
||||||
#if defined Q_OS_WIN && !defined Q_OS_WINRT
|
#ifdef Q_OS_WIN
|
||||||
, _started(GetTickCount())
|
, _started(GetTickCount())
|
||||||
#endif // Q_OS_WIN && !Q_OS_WINRT
|
#endif // Q_OS_WIN
|
||||||
, _close(this, st::notifyClose)
|
, _close(this, st::notifyClose)
|
||||||
, _reply(this, lang(lng_notification_reply), st::defaultBoxButton) {
|
, _reply(this, lang(lng_notification_reply), st::defaultBoxButton) {
|
||||||
auto position = computePosition(st::notifyMinHeight);
|
auto position = computePosition(st::notifyMinHeight);
|
||||||
|
@ -544,12 +544,12 @@ bool Notification::checkLastInput(bool hasReplyingNotifications) {
|
||||||
if (!_waitingForInput) return true;
|
if (!_waitingForInput) return true;
|
||||||
|
|
||||||
auto wasUserInput = true; // TODO
|
auto wasUserInput = true; // TODO
|
||||||
#if defined Q_OS_WIN && !defined Q_OS_WINRT
|
#ifdef Q_OS_WIN
|
||||||
LASTINPUTINFO lii;
|
LASTINPUTINFO lii;
|
||||||
lii.cbSize = sizeof(LASTINPUTINFO);
|
lii.cbSize = sizeof(LASTINPUTINFO);
|
||||||
BOOL res = GetLastInputInfo(&lii);
|
BOOL res = GetLastInputInfo(&lii);
|
||||||
wasUserInput = (!res || lii.dwTime >= _started);
|
wasUserInput = (!res || lii.dwTime >= _started);
|
||||||
#endif // Q_OS_WIN && !Q_OS_WINRT
|
#endif // Q_OS_WIN
|
||||||
if (wasUserInput) {
|
if (wasUserInput) {
|
||||||
_waitingForInput = false;
|
_waitingForInput = false;
|
||||||
if (!hasReplyingNotifications) {
|
if (!hasReplyingNotifications) {
|
||||||
|
|
|
@ -40,9 +40,9 @@ class HideAllButton;
|
||||||
|
|
||||||
class Manager;
|
class Manager;
|
||||||
|
|
||||||
void start();
|
void Start();
|
||||||
Manager *manager();
|
Manager *GetManager();
|
||||||
void finish();
|
void Finish();
|
||||||
|
|
||||||
class Manager : public Notifications::Manager, private base::Subscriber {
|
class Manager : public Notifications::Manager, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
|
@ -234,9 +234,9 @@ private:
|
||||||
Animation a_actionsOpacity;
|
Animation a_actionsOpacity;
|
||||||
QPixmap _buttonsCache;
|
QPixmap _buttonsCache;
|
||||||
|
|
||||||
#if defined Q_OS_WIN && !defined Q_OS_WINRT
|
#ifdef Q_OS_WIN
|
||||||
TimeMs _started;
|
TimeMs _started;
|
||||||
#endif // Q_OS_WIN && !Q_OS_WINRT
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
History *_history;
|
History *_history;
|
||||||
PeerData *_peer;
|
PeerData *_peer;
|
||||||
|
|
|
@ -33,5 +33,8 @@ struct CurrentData {
|
||||||
|
|
||||||
std::unique_ptr<Preview> GeneratePreview(const QString &filepath, const CurrentData &data);
|
std::unique_ptr<Preview> GeneratePreview(const QString &filepath, const CurrentData &data);
|
||||||
|
|
||||||
|
int DefaultPreviewTitleHeight();
|
||||||
|
void DefaultPreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRect body, int outerWidth);
|
||||||
|
|
||||||
} // namespace Theme
|
} // namespace Theme
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
|
@ -374,14 +374,14 @@
|
||||||
'<(src_loc)/platform/linux/linux_libnotify.h',
|
'<(src_loc)/platform/linux/linux_libnotify.h',
|
||||||
'<(src_loc)/platform/linux/linux_libs.cpp',
|
'<(src_loc)/platform/linux/linux_libs.cpp',
|
||||||
'<(src_loc)/platform/linux/linux_libs.h',
|
'<(src_loc)/platform/linux/linux_libs.h',
|
||||||
'<(src_loc)/platform/linux/file_dialog_linux.cpp',
|
'<(src_loc)/platform/linux/file_utilities_linux.cpp',
|
||||||
'<(src_loc)/platform/linux/file_dialog_linux.h',
|
'<(src_loc)/platform/linux/file_utilities_linux.h',
|
||||||
'<(src_loc)/platform/linux/main_window_linux.cpp',
|
'<(src_loc)/platform/linux/main_window_linux.cpp',
|
||||||
'<(src_loc)/platform/linux/main_window_linux.h',
|
'<(src_loc)/platform/linux/main_window_linux.h',
|
||||||
'<(src_loc)/platform/linux/notifications_manager_linux.cpp',
|
'<(src_loc)/platform/linux/notifications_manager_linux.cpp',
|
||||||
'<(src_loc)/platform/linux/notifications_manager_linux.h',
|
'<(src_loc)/platform/linux/notifications_manager_linux.h',
|
||||||
'<(src_loc)/platform/mac/file_dialog_mac.mm',
|
'<(src_loc)/platform/mac/file_utilities_mac.mm',
|
||||||
'<(src_loc)/platform/mac/file_dialog_mac.h',
|
'<(src_loc)/platform/mac/file_utilities_mac.h',
|
||||||
'<(src_loc)/platform/mac/mac_utilities.mm',
|
'<(src_loc)/platform/mac/mac_utilities.mm',
|
||||||
'<(src_loc)/platform/mac/mac_utilities.h',
|
'<(src_loc)/platform/mac/mac_utilities.h',
|
||||||
'<(src_loc)/platform/mac/main_window_mac.mm',
|
'<(src_loc)/platform/mac/main_window_mac.mm',
|
||||||
|
@ -392,6 +392,8 @@
|
||||||
'<(src_loc)/platform/mac/window_title_mac.h',
|
'<(src_loc)/platform/mac/window_title_mac.h',
|
||||||
'<(src_loc)/platform/win/audio_win.cpp',
|
'<(src_loc)/platform/win/audio_win.cpp',
|
||||||
'<(src_loc)/platform/win/audio_win.h',
|
'<(src_loc)/platform/win/audio_win.h',
|
||||||
|
'<(src_loc)/platform/win/file_utilities_win.cpp',
|
||||||
|
'<(src_loc)/platform/win/file_utilities_win.h',
|
||||||
'<(src_loc)/platform/win/main_window_win.cpp',
|
'<(src_loc)/platform/win/main_window_win.cpp',
|
||||||
'<(src_loc)/platform/win/main_window_win.h',
|
'<(src_loc)/platform/win/main_window_win.h',
|
||||||
'<(src_loc)/platform/win/notifications_manager_win.cpp',
|
'<(src_loc)/platform/win/notifications_manager_win.cpp',
|
||||||
|
@ -405,7 +407,7 @@
|
||||||
'<(src_loc)/platform/win/windows_event_filter.cpp',
|
'<(src_loc)/platform/win/windows_event_filter.cpp',
|
||||||
'<(src_loc)/platform/win/windows_event_filter.h',
|
'<(src_loc)/platform/win/windows_event_filter.h',
|
||||||
'<(src_loc)/platform/platform_audio.h',
|
'<(src_loc)/platform/platform_audio.h',
|
||||||
'<(src_loc)/platform/platform_file_dialog.h',
|
'<(src_loc)/platform/platform_file_utilities.h',
|
||||||
'<(src_loc)/platform/platform_main_window.h',
|
'<(src_loc)/platform/platform_main_window.h',
|
||||||
'<(src_loc)/platform/platform_notifications_manager.h',
|
'<(src_loc)/platform/platform_notifications_manager.h',
|
||||||
'<(src_loc)/platform/platform_window_title.h',
|
'<(src_loc)/platform/platform_window_title.h',
|
||||||
|
@ -624,8 +626,8 @@
|
||||||
'<(src_loc)/platform/linux/linux_libnotify.h',
|
'<(src_loc)/platform/linux/linux_libnotify.h',
|
||||||
'<(src_loc)/platform/linux/linux_libs.cpp',
|
'<(src_loc)/platform/linux/linux_libs.cpp',
|
||||||
'<(src_loc)/platform/linux/linux_libs.h',
|
'<(src_loc)/platform/linux/linux_libs.h',
|
||||||
'<(src_loc)/platform/linux/file_dialog_linux.cpp',
|
'<(src_loc)/platform/linux/file_utilities_linux.cpp',
|
||||||
'<(src_loc)/platform/linux/file_dialog_linux.h',
|
'<(src_loc)/platform/linux/file_utilities_linux.h',
|
||||||
'<(src_loc)/platform/linux/main_window_linux.cpp',
|
'<(src_loc)/platform/linux/main_window_linux.cpp',
|
||||||
'<(src_loc)/platform/linux/main_window_linux.h',
|
'<(src_loc)/platform/linux/main_window_linux.h',
|
||||||
'<(src_loc)/platform/linux/notifications_manager_linux.cpp',
|
'<(src_loc)/platform/linux/notifications_manager_linux.cpp',
|
||||||
|
@ -638,6 +640,8 @@
|
||||||
'<(src_loc)/pspecific_mac.h',
|
'<(src_loc)/pspecific_mac.h',
|
||||||
'<(src_loc)/pspecific_mac_p.mm',
|
'<(src_loc)/pspecific_mac_p.mm',
|
||||||
'<(src_loc)/pspecific_mac_p.h',
|
'<(src_loc)/pspecific_mac_p.h',
|
||||||
|
'<(src_loc)/platform/mac/file_utilities_mac.mm',
|
||||||
|
'<(src_loc)/platform/mac/file_utilities_mac.h',
|
||||||
'<(src_loc)/platform/mac/mac_utilities.mm',
|
'<(src_loc)/platform/mac/mac_utilities.mm',
|
||||||
'<(src_loc)/platform/mac/mac_utilities.h',
|
'<(src_loc)/platform/mac/mac_utilities.h',
|
||||||
'<(src_loc)/platform/mac/main_window_mac.mm',
|
'<(src_loc)/platform/mac/main_window_mac.mm',
|
||||||
|
@ -667,6 +671,8 @@
|
||||||
'<(src_loc)/pspecific_win.h',
|
'<(src_loc)/pspecific_win.h',
|
||||||
'<(src_loc)/platform/win/audio_win.cpp',
|
'<(src_loc)/platform/win/audio_win.cpp',
|
||||||
'<(src_loc)/platform/win/audio_win.h',
|
'<(src_loc)/platform/win/audio_win.h',
|
||||||
|
'<(src_loc)/platform/win/file_utilities_win.cpp',
|
||||||
|
'<(src_loc)/platform/win/file_utilities_win.h',
|
||||||
'<(src_loc)/platform/win/main_window_win.cpp',
|
'<(src_loc)/platform/win/main_window_win.cpp',
|
||||||
'<(src_loc)/platform/win/main_window_win.h',
|
'<(src_loc)/platform/win/main_window_win.h',
|
||||||
'<(src_loc)/platform/win/notifications_manager_win.cpp',
|
'<(src_loc)/platform/win/notifications_manager_win.cpp',
|
||||||
|
|
Loading…
Reference in New Issue