diff --git a/Telegram/SourceFiles/main.cpp b/Telegram/SourceFiles/main.cpp index de6daec28..02e9c27b7 100644 --- a/Telegram/SourceFiles/main.cpp +++ b/Telegram/SourceFiles/main.cpp @@ -44,8 +44,8 @@ int main(int argc, char *argv[]) { #else QCoreApplication::addLibraryPath("/usr/lib/qt5/plugins"); #endif - setenv("QT_STYLE_OVERRIDE", "qwerty", false); - unsetenv("QT_QPA_PLATFORMTHEME"); + qputenv("QT_STYLE_OVERRIDE", "qwerty"); + qunsetenv("QT_QPA_PLATFORMTHEME"); int result = 0; { diff --git a/Telegram/SourceFiles/platform/win/audio_win.cpp b/Telegram/SourceFiles/platform/win/audio_win.cpp index 1d9dfab40..4f6d127e4 100644 --- a/Telegram/SourceFiles/platform/win/audio_win.cpp +++ b/Telegram/SourceFiles/platform/win/audio_win.cpp @@ -18,21 +18,22 @@ 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 */ +#include "stdafx.h" + #include "platform/win/audio_win.h" #include "platform/win/windows_dlls.h" #include "media/media_audio.h" -#include -#include - -#include using namespace Microsoft::WRL; namespace Platform { namespace Audio { namespace { +const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator); +const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator); + // Inspired by Chromium. class DeviceListener : public IMMNotificationClient { public: diff --git a/Telegram/SourceFiles/platform/win/file_utilities_win.cpp b/Telegram/SourceFiles/platform/win/file_utilities_win.cpp index ac6195b8c..9eb880ec8 100644 --- a/Telegram/SourceFiles/platform/win/file_utilities_win.cpp +++ b/Telegram/SourceFiles/platform/win/file_utilities_win.cpp @@ -18,6 +18,8 @@ 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 */ +#include "stdafx.h" +#include #include "platform/win/file_utilities_win.h" #include "mainwindow.h" @@ -26,8 +28,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "lang/lang_keys.h" #include "messenger.h" -#include -#include HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &, int hbitmapFormat); @@ -420,9 +420,9 @@ bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption, } else { files = dialog.selectedFiles().mid(0, 1); } - if (type == Type::ReadFile || type == Type::ReadFiles) { - remoteContent = dialog.selectedRemoteContent(); - } +// if (type == Type::ReadFile || type == Type::ReadFiles) { +// remoteContent = dialog.selectedRemoteContent(); +// } return true; } diff --git a/Telegram/SourceFiles/platform/win/main_window_win.cpp b/Telegram/SourceFiles/platform/win/main_window_win.cpp index 79f0a90fd..e99f7a6e6 100644 --- a/Telegram/SourceFiles/platform/win/main_window_win.cpp +++ b/Telegram/SourceFiles/platform/win/main_window_win.cpp @@ -18,6 +18,7 @@ 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 */ +#include "stdafx.h" #include "platform/win/main_window_win.h" #include "styles/style_window.h" @@ -34,17 +35,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include -#include -#include -#include - -#include -#include -#include -#include - -#include - #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) < (b) ? (b) : (a)) #include @@ -229,7 +219,7 @@ public: destroy(); return false; } - SetWindowLong(hwnds[i], GWL_HWNDPARENT, (LONG)hwnd); + SetWindowLong(hwnds[i], GWLP_HWNDPARENT, (LONG)hwnd); dcs[i] = CreateCompatibleDC(screenDC); if (!dcs[i]) { @@ -705,18 +695,18 @@ void MainWindow::workmodeUpdated(DBIWorkMode mode) { switch (mode) { case dbiwmWindowAndTray: { psSetupTrayIcon(); - HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT); + HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWLP_HWNDPARENT); if (psOwner) { - SetWindowLong(ps_hWnd, GWL_HWNDPARENT, 0); + SetWindowLong(ps_hWnd, GWLP_HWNDPARENT, 0); psRefreshTaskbarIcon(); } } break; case dbiwmTrayOnly: { psSetupTrayIcon(); - HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT); + HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWLP_HWNDPARENT); if (!psOwner) { - SetWindowLong(ps_hWnd, GWL_HWNDPARENT, (LONG)ps_tbHider_hWnd); + SetWindowLong(ps_hWnd, GWLP_HWNDPARENT, (LONG)ps_tbHider_hWnd); } } break; @@ -727,9 +717,9 @@ void MainWindow::workmodeUpdated(DBIWorkMode mode) { } trayIcon = 0; - HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT); + HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWLP_HWNDPARENT); if (psOwner) { - SetWindowLong(ps_hWnd, GWL_HWNDPARENT, 0); + SetWindowLong(ps_hWnd, GWLP_HWNDPARENT, 0); psRefreshTaskbarIcon(); } } break; diff --git a/Telegram/SourceFiles/platform/win/notifications_manager_win.cpp b/Telegram/SourceFiles/platform/win/notifications_manager_win.cpp index 1c67bf299..0c4f0eb02 100644 --- a/Telegram/SourceFiles/platform/win/notifications_manager_win.cpp +++ b/Telegram/SourceFiles/platform/win/notifications_manager_win.cpp @@ -18,6 +18,7 @@ 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 */ +#include "stdafx.h" #include "platform/win/notifications_manager_win.h" #include "window/notifications_utilities.h" @@ -27,14 +28,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "mainwindow.h" #include "base/task_queue.h" -#include -#include - -#include -#include -#include -#include - #include #include diff --git a/Telegram/SourceFiles/platform/win/specific_win.cpp b/Telegram/SourceFiles/platform/win/specific_win.cpp index 3bb347009..b0d477b1c 100644 --- a/Telegram/SourceFiles/platform/win/specific_win.cpp +++ b/Telegram/SourceFiles/platform/win/specific_win.cpp @@ -18,6 +18,7 @@ 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 */ +#include "stdafx.h" #include "platform/win/specific_win.h" #include "platform/win/main_window_win.h" @@ -33,35 +34,14 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "passcodewidget.h" #include "base/task_queue.h" -#include -#include - -#include -#include -#include -#include - #pragma warning(push) #pragma warning(disable:4091) #include #include #pragma warning(pop) -#include -#include -#include -#include -#include - -#include -#include #include -#include -#include -#include -#include -#include #include diff --git a/Telegram/SourceFiles/platform/win/window_title_win.cpp b/Telegram/SourceFiles/platform/win/window_title_win.cpp index 57d0bf200..51cd75d8c 100644 --- a/Telegram/SourceFiles/platform/win/window_title_win.cpp +++ b/Telegram/SourceFiles/platform/win/window_title_win.cpp @@ -18,6 +18,7 @@ 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 */ +#include "stdafx.h" #include "platform/win/window_title_win.h" #include "ui/widgets/buttons.h" diff --git a/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp b/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp index 8eef2a47c..b208018a0 100644 --- a/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp +++ b/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp @@ -18,17 +18,13 @@ 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 */ +#include "stdafx.h" #include "platform/win/windows_app_user_model_id.h" #include "platform/win/windows_dlls.h" #include #include -#include -#include -#include -#include - using namespace Microsoft::WRL; namespace Platform { diff --git a/Telegram/SourceFiles/platform/win/windows_dlls.cpp b/Telegram/SourceFiles/platform/win/windows_dlls.cpp index 2f6ffb272..44e0f4259 100644 --- a/Telegram/SourceFiles/platform/win/windows_dlls.cpp +++ b/Telegram/SourceFiles/platform/win/windows_dlls.cpp @@ -18,6 +18,7 @@ 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 */ +#include "stdafx.h" #include "platform/win/windows_dlls.h" namespace Platform { diff --git a/Telegram/SourceFiles/platform/win/windows_dlls.h b/Telegram/SourceFiles/platform/win/windows_dlls.h index ae0c8b3c7..867bbc3cb 100644 --- a/Telegram/SourceFiles/platform/win/windows_dlls.h +++ b/Telegram/SourceFiles/platform/win/windows_dlls.h @@ -20,9 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #pragma once -#include -#include -#include namespace Platform { namespace Dlls { diff --git a/Telegram/SourceFiles/platform/win/windows_event_filter.cpp b/Telegram/SourceFiles/platform/win/windows_event_filter.cpp index a28f40b57..fc4d488df 100644 --- a/Telegram/SourceFiles/platform/win/windows_event_filter.cpp +++ b/Telegram/SourceFiles/platform/win/windows_event_filter.cpp @@ -18,6 +18,7 @@ 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 */ +#include "stdafx.h" #include "platform/win/windows_event_filter.h" #include "mainwindow.h" diff --git a/Telegram/SourceFiles/stdafx.h b/Telegram/SourceFiles/stdafx.h index 9c1d5f5e3..f39f36f65 100644 --- a/Telegram/SourceFiles/stdafx.h +++ b/Telegram/SourceFiles/stdafx.h @@ -53,6 +53,36 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #define MAC_USE_BREAKPAD #endif // OS_MAC_STORE +#ifdef Q_OS_WIN +#include + +// Windows Header Files: +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#endif + #include #include diff --git a/Telegram/SourceFiles/ui/special_buttons.cpp b/Telegram/SourceFiles/ui/special_buttons.cpp index c079b77c2..387eb6c03 100644 --- a/Telegram/SourceFiles/ui/special_buttons.cpp +++ b/Telegram/SourceFiles/ui/special_buttons.cpp @@ -337,9 +337,9 @@ void NewAvatarButton::paintEvent(QPaintEvent *e) { } void NewAvatarButton::setImage(const QImage &image) { - auto small = image.scaled(size() * cIntRetinaFactor(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - Images::prepareCircle(small); - _image = App::pixmapFromImageInPlace(std::move(small)); + auto smallImg = image.scaled(size() * cIntRetinaFactor(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + Images::prepareCircle(smallImg); + _image = App::pixmapFromImageInPlace(std::move(smallImg)); _image.setDevicePixelRatio(cRetinaFactor()); update(); }