Remove PCH (#148)

This commit brings many changes:

1. Remove cotire;
2. Remove PCH files (stdafx.xxx) and mentions;
3. Rearrange and clean includes:
3.1. Remove core includes path, use full header path core/xxx;
3.2. Move object_ptr to separate file base/object_ptr.h;
3.3. Add missing includes;
5. Add forward decls;
6. Get rid of some Qt private parts;
7. Fix ALL compilation errors after removing cotire on Windows, Linux, MacOS.

Closes #133.
Related to #96.
This commit is contained in:
Alex 2018-06-04 16:25:31 +03:00 committed by GitHub
parent f2de0e5127
commit 69661217d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
438 changed files with 1603 additions and 8013 deletions

View File

@ -1,8 +1,7 @@
cmake_minimum_required(VERSION 3.10)
project(kepka-desktop)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cotire/CMake;${PROJECT_SOURCE_DIR}/modules/")
include(cotire)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules/")
include(CTest)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.10)

View File

@ -12,6 +12,9 @@ if (PACKAGED_BUILD)
add_definitions(-DTDESKTOP_DISABLE_DESKTOP_FILE_GENERATION)
endif()
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -H")
##================================================
## Codegen Tools
##================================================
@ -189,8 +192,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
# cmakelists file. To do: get rid of the PCH requirement for more flexible build structure.
add_executable(Telegram WIN32 MACOSX_BUNDLE
SourceFiles/stdafx.cpp
${CMAKE_CURRENT_BINARY_DIR}/styles/palette.cpp
${CMAKE_CURRENT_BINARY_DIR}/numbers.cpp
${CMAKE_CURRENT_BINARY_DIR}/lang_auto.cpp
@ -568,7 +569,7 @@ include_directories(ThirdParty) # For minizip/ but we use fully-qualified
include_directories(ThirdParty/GSL/include ThirdParty/variant/include
ThirdParty/emoji_suggestions ThirdParty/libtgvoip)
include_directories(SourceFiles SourceFiles/core)
include_directories(SourceFiles)
include_directories(${OPENAL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}
${OPUS_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS} ${ALSA_INCLUDE_DIRS} ${PULSEAUDIO_INCLUDE_DIR})
@ -581,9 +582,9 @@ endif()
if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_USING_V110_SDK71_
-DWIN32 -D_WINDOWS -D_UNICODE -DUNICODE
-DWIN32 -D_WINDOWS -D_UNICODE -DUNICODE
-DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP
-DHAVE_STDINT_H)
-DHAVE_STDINT_H -DNOMINMAX)
endif()
add_definitions(-DAL_LIBTYPE_STATIC)
@ -706,17 +707,6 @@ endif()
target_link_libraries(Telegram Threads::Threads)
set_target_properties(Telegram
PROPERTIES
COTIRE_CXX_PREFIX_HEADER_INIT SourceFiles/stdafx.h
COTIRE_ADD_UNITY_BUILD FALSE
)
cotire(Telegram)
# See https://github.com/sakra/cotire/blob/master/MANUAL.md#objective-c
# ObjC and ObjC++ files cannot be cotired, so they have to include appropriate Qt and Tg
# headers themselves, this applies to macOS platform sources.
##================================================
## Tests
##================================================

View File

@ -35,6 +35,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "window/notifications_manager.h"
#include "chat_helpers/message_field.h"
#include "chat_helpers/stickers.h"
#include "base/algorithm.h" // for_each_apply
namespace {

View File

@ -28,6 +28,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "mtproto/sender.h"
#include "base/flat_map.h"
#include "base/flat_set.h"
#include "structs.h"
#include "facades.h"
class AuthSession;
@ -43,6 +45,8 @@ inline const MTPVector<MTPChat> *getChatsFromMessagesChats(const MTPmessages_Cha
} // namespace Api
class History;
class ApiWrap : private MTP::Sender, private base::Subscriber {
public:
ApiWrap(not_null<AuthSession*> session);

View File

@ -50,6 +50,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "window/notifications_manager.h"
#include "platform/platform_notifications_manager.h"
#include <QLinkedList> // used in list of PhotosData
#include <QFontDatabase>
#include <QBuffer>
#include <QImageReader>
namespace {
App::LaunchState _launchState = App::Launched;

View File

@ -20,10 +20,15 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QString>
#include <QNetworkAccessManager>
#include "ui/animation.h"
#include "core/basic_types.h"
#include "history/history.h"
#include "history/history_item.h"
#include "layout.h"
#include "media/media_clip_reader.h"
class Messenger;
class MainWindow;

View File

@ -28,6 +28,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "messenger.h"
#include "base/timer.h"
#include <QDesktopWidget>
#include <QScreen>
namespace {
// @todo are there no other ways to get/set hex?

View File

@ -20,8 +20,13 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "stdafx.h"
#include <memory>
#include <QApplication>
#include <QLocalSocket>
#include <QLocalServer>
class Messenger;
class Application : public QApplication {
Q_OBJECT

View File

@ -32,6 +32,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "window/section_widget.h"
#include "chat_helpers/tabbed_selector.h"
#include "app.h" // App::user
namespace {
constexpr auto kAutoLockTimeoutLateMs = TimeMs(3000);

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once
#include "base/timer.h"
#include "structs.h"
namespace Storage {
class Downloader;
@ -43,6 +44,8 @@ enum class SelectorTab;
} // namespace ChatHelpers
class ApiWrap;
class History;
class HistoryItem;
class AuthSessionData final {
public:

View File

@ -20,6 +20,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <iterator>
#include <algorithm>
namespace base {
// @todo use ranges-v3 here

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once
#include <cstdlib>
#include <gsl/gsl>
namespace base {
namespace assertion {

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once
#include <deque>
#include <algorithm>
#include "base/optional.h"
namespace base {

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once
#include <deque>
#include <algorithm>
namespace base {

View File

@ -20,6 +20,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <utility>
namespace base {
namespace functors {

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once
#include <memory>
#include <cstddef> // std::max_align_t
#ifndef Assert
#define LambdaAssertDefined

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once
#include <QPointer>
#include "base/lambda.h"
namespace base {

View File

@ -0,0 +1,127 @@
/*
This file is part of Kepka - The Unofficial Telegram Desktop client,
see https://github.com/procxx/kepka
Kepka 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/procxx/kepka/blob/master/LICENSE
Copyright (c) 2018 pro.cxx Community
*/
#pragma once
#include <QObject>
#include <QPointer>
#include "core/utils.h" // @todo used for base::take
// Smart pointer for QObject*, has move semantics, destroys object if it doesn't have a parent.
template <typename Object>
class object_ptr {
public:
object_ptr(std::nullptr_t) {
}
// No default constructor, but constructors with at least
// one argument are simply make functions.
template <typename Parent, typename... Args>
explicit object_ptr(Parent &&parent, Args&&... args) : _object(new Object(std::forward<Parent>(parent), std::forward<Args>(args)...)) {
}
object_ptr(const object_ptr &other) = delete;
object_ptr &operator=(const object_ptr &other) = delete;
object_ptr(object_ptr &&other) : _object(base::take(other._object)) {
}
object_ptr &operator=(object_ptr &&other) {
auto temp = std::move(other);
destroy();
std::swap(_object, temp._object);
return *this;
}
template <typename OtherObject, typename = std::enable_if_t<std::is_base_of<Object, OtherObject>::value>>
object_ptr(object_ptr<OtherObject> &&other) : _object(base::take(other._object)) {
}
template <typename OtherObject, typename = std::enable_if_t<std::is_base_of<Object, OtherObject>::value>>
object_ptr &operator=(object_ptr<OtherObject> &&other) {
_object = base::take(other._object);
return *this;
}
object_ptr &operator=(std::nullptr_t) {
_object = nullptr;
return *this;
}
// So we can pass this pointer to methods like connect().
Object *data() const {
return static_cast<Object*>(_object.data());
}
operator Object*() const {
return data();
}
explicit operator bool() const {
return _object != nullptr;
}
Object *operator->() const {
return data();
}
Object &operator*() const {
return *data();
}
// Use that instead "= new Object(parent, ...)"
template <typename Parent, typename... Args>
void create(Parent &&parent, Args&&... args) {
destroy();
_object = new Object(std::forward<Parent>(parent), std::forward<Args>(args)...);
}
void destroy() {
delete base::take(_object);
}
void destroyDelayed() {
if (_object) {
if (auto widget = base::up_cast<QWidget*>(data())) {
widget->hide();
}
base::take(_object)->deleteLater();
}
}
~object_ptr() {
if (auto pointer = _object) {
if (!pointer->parent()) {
destroy();
}
}
}
template <typename ResultType, typename SourceType>
friend object_ptr<ResultType> static_object_cast(object_ptr<SourceType> source);
private:
template <typename OtherObject>
friend class object_ptr;
QPointer<QObject> _object;
};
template <typename ResultType, typename SourceType>
inline object_ptr<ResultType> static_object_cast(object_ptr<SourceType> source) {
auto result = object_ptr<ResultType>(nullptr);
result._object = static_cast<ResultType*>(base::take(source._object).data());
return std::move(result);
}

View File

@ -19,6 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "base/observer.h"
#include "facades.h"
namespace base {
namespace internal {

View File

@ -23,7 +23,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include <vector>
#include <deque>
#include <QSharedPointer>
#include "base/assertion.h"
#include "base/lambda.h"
#include "base/type_traits.h"
#include "core/utils.h"
namespace base {
namespace internal {

View File

@ -24,6 +24,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include <openssl/sha.h>
#include <openssl/rand.h>
#include "base/assertion.h"
#include "core/utils.h"
namespace openssl {
class Context {

View File

@ -20,7 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QtCore/QMap>
#include <QMap>
// ordered set template based on QMap
template <typename T>

View File

@ -20,6 +20,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QByteArray>
#include <QLatin1String>
#include "base/assertion.h"
namespace base {
namespace parse {

View File

@ -20,6 +20,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QRegularExpression>
#include "base/flags.h"
namespace qthelp {

View File

@ -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 <QStringList>
#include "core/utils.h"
#include "base/qthelp_url.h"
namespace qthelp {
@ -32,7 +34,7 @@ QMap<QString, QString> url_parse_params(const QString &params, UrlParamNameTrans
return name;
};
auto paramsList = params.split('&');
auto paramsList = params.split('&');
for_const (auto &param, paramsList) {
// Skip params without a name (starting with '=').
if (auto separatorPosition = param.indexOf('=')) {

View File

@ -20,6 +20,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QString>
#include <QUrl>
#include <QMap>
namespace qthelp {
inline QString url_encode(const QString &part) {

View File

@ -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 <QMutexLocker>
#include "base/runtime_composer.h"
struct RuntimeComposerMetadatasMap {

View File

@ -19,6 +19,11 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <cstddef>
#include <QAtomicInt>
#include "base/assertion.h"
#include "core/utils.h"
class RuntimeComposer;
typedef void(*RuntimeComponentConstruct)(void *location, RuntimeComposer *composer);

View File

@ -18,10 +18,15 @@ 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 "base/task_queue.h"
#include <algorithm>
#include <thread>
#include <condition_variable>
#include <QMutex>
#include <QWaitCondition>
#include "base/assertion.h"
#include "base/task_queue.h"
#include "facades.h"
namespace base {
namespace {

View File

@ -21,6 +21,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once
#include <memory>
#include <deque>
#include <QMutex>
#include "base/lambda.h"
#include "base/timer.h"
namespace base {

View File

@ -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 <QTimerEvent>
#include "base/timer.h"
namespace base {

View File

@ -23,6 +23,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "base/lambda.h"
#include "base/observer.h"
using TimeMs = qint64;
namespace base {
class Timer final : private QObject {

View File

@ -20,6 +20,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <type_traits>
namespace base {
template <typename T>

View File

@ -20,7 +20,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <memory>
// @todo replace this with std::experimental::observer_ptr
#include <utility>
#include <QCoreApplication>
namespace base {
@ -131,11 +134,11 @@ weak_unique_ptr<T> make_weak_unique(const std::unique_ptr<T> &value) {
#ifdef QT_VERSION
template <typename Lambda>
inline void InvokeQueued(base::enable_weak_from_this *context, Lambda &&lambda) {
QObject proxy;
QObject::connect(&proxy, &QObject::destroyed, QCoreApplication::instance(), [guard = base::make_weak_unique(context), lambda = std::forward<Lambda>(lambda)] {
if (guard) {
lambda();
}
}, Qt::QueuedConnection);
QObject proxy;
QObject::connect(&proxy, &QObject::destroyed, QCoreApplication::instance(), [guard = base::make_weak_unique(context), lambda = std::forward<Lambda>(lambda)] {
if (guard) {
lambda();
}
}, Qt::QueuedConnection);
}
#endif // QT_VERSION

View File

@ -23,9 +23,13 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QByteArray>
#include "minizip/zip.h"
#include "minizip/unzip.h"
#include "logs.h"
namespace zlib {
namespace internal {

View File

@ -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 <QDesktopServices>
#include "boxes/about_box.h"
#include "config.h"

View File

@ -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 <algorithm>
#include "boxes/abstract_box.h"
#include "styles/style_boxes.h"

View File

@ -20,8 +20,12 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "layerwidget.h"
#include "base/lambda.h"
#include "base/observer.h"
#include "ui/text/text_entity.h"
#include "ui/widgets/shadow.h"
#include "ui/twidget.h"
#include "layerwidget.h"
namespace Ui {
class RoundButton;

View File

@ -41,6 +41,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "apiwrap.h"
#include "observer_peer.h"
#include "auth_session.h"
#include <QGuiApplication>
#include <QClipboard>
namespace {

View File

@ -25,7 +25,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "mainwindow.h"
#include "ui/widgets/checkbox.h"
#include "styles/style_boxes.h"
#include "facades.h"
void AutoLockBox::prepare() {
setTitle(langFactory(lng_passcode_autolock));

View File

@ -18,8 +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 "base/lambda_guard.h"
#include "boxes/change_phone_box.h"
#include "lang/lang_keys.h"
#include "styles/style_boxes.h"
#include "ui/widgets/labels.h"
@ -28,6 +28,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "boxes/confirm_phone_box.h"
#include "ui/toast/toast.h"
#include "boxes/confirm_box.h"
#include "facades.h"
#include "app.h" // For formatPhone
namespace {

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once
#include "boxes/abstract_box.h"
#include "history/history.h"
namespace Ui {
class Checkbox;

View File

@ -27,6 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "ui/widgets/buttons.h"
#include "platform/platform_specific.h"
#include "styles/style_boxes.h"
#include "facades.h"
DownloadPathBox::DownloadPathBox(QWidget *parent)
: _path(Global::DownloadPath())

View File

@ -25,6 +25,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "ui/widgets/shadow.h"
#include "styles/style_mediaview.h"
#include "ui/widgets/input_fields.h"
#include "app.h"
class EditColorBox::Picker : public TWidget {
public:

View File

@ -27,6 +27,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "styles/style_boxes.h"
#include "ui/special_buttons.h"
#include "boxes/calendar_box.h"
#include "facades.h"
#include "app.h" // For App::peerName
namespace {

View File

@ -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 "base/lambda_guard.h"
#include "boxes/edit_privacy_box.h"
#include "styles/style_boxes.h"
@ -29,6 +30,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "apiwrap.h"
#include "auth_session.h"
#include "lang/lang_keys.h"
#include "app.h" // For App::user, App::feedUsers
namespace {

View File

@ -19,7 +19,6 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "boxes/language_box.h"
#include "lang/lang_keys.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"

View File

@ -26,6 +26,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "lang/lang_keys.h"
#include "mainwindow.h"
#include "auth_session.h"
#include "facades.h"
#include "app.h" // For App::wnd
#include "layout.h" // For formatSizeText
LocalStorageBox::LocalStorageBox(QWidget *parent)
: _clear(this, lang(lng_local_storage_clear), st::boxLinkButton) {

View File

@ -32,6 +32,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "auth_session.h"
#include "window/notifications_manager.h"
#include "platform/platform_specific.h"
#include "app.h" // For App::pixmapFromImageInPlace
namespace {

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once
#include "boxes/abstract_box.h"
#include "facades.h"
namespace Ui {
class LinkButton;

View File

@ -27,6 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "styles/style_boxes.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/input_fields.h"
#include "facades.h"
PasscodeBox::PasscodeBox(QWidget*, bool turningOff)
: _turningOff(turningOff)

View File

@ -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 "base/algorithm.h"
#include "boxes/peer_list_box.h"
#include "styles/style_boxes.h"

View File

@ -18,8 +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 "base/algorithm.h"
#include "boxes/peer_list_controllers.h"
#include "styles/style_boxes.h"
#include "styles/style_profile.h"
#include "boxes/confirm_box.h"

View File

@ -23,6 +23,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "boxes/peer_list_box.h"
#include "base/flat_set.h"
#include "base/weak_unique_ptr.h"
#include "history/history.h"
// Not used for now.
//

View File

@ -28,6 +28,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "ui/widgets/buttons.h"
#include "ui/widgets/input_fields.h"
#include "mainwindow.h"
#include "facades.h"
ReportBox::ReportBox(QWidget*, PeerData *peer) : _peer(peer)
, _reasonGroup(std::make_shared<Ui::RadioenumGroup<Reason>>(Reason::Spam))

View File

@ -22,6 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "boxes/abstract_box.h"
#include "storage/localimageloader.h"
#include "history/history_media.h"
namespace Ui {
class Checkbox;

View File

@ -34,6 +34,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "ui/widgets/scroll_area.h"
#include "auth_session.h"
#include "messenger.h"
#include <QApplication>
#include <QClipboard>
namespace {

View File

@ -29,6 +29,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "ui/toast/toast.h"
#include "styles/style_boxes.h"
#include "messenger.h"
#include <QApplication>
#include <QClipboard>
UsernameBox::UsernameBox(QWidget*)
: _username(this, st::defaultInputField, [] { return qsl("@username"); }, App::self()->username, false)

View File

@ -27,6 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "ui/effects/ripple_animation.h"
#include "calls/calls_instance.h"
#include "history/history_media_types.h"
#include "app.h"
namespace Calls {
namespace {

View File

@ -18,8 +18,9 @@ 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 "calls/calls_call.h"
#include "core/utils.h"
#include "calls/calls_call.h"
#include "auth_session.h"
#include "mainwidget.h"
#include "lang/lang_keys.h"

View File

@ -20,6 +20,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <vector>
#include <core/basic_types.h>
#include "settings.h"
namespace Calls {
class Call;

View File

@ -18,6 +18,11 @@ 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 <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonParseError>
#include "calls/calls_instance.h"
#include "mtproto/connection.h"
@ -31,6 +36,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "media/media_audio_track.h"
#include "boxes/rate_call_box.h"
#include "app.h"
namespace Calls {
namespace {

View File

@ -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 <QDesktopWidget>
#include "calls/calls_panel.h"
#include "calls/calls_emoji_fingerprint.h"
@ -37,6 +38,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "platform/platform_specific.h"
#include "base/task_queue.h"
#include "window/main_window.h"
#include "app.h"
#include <QApplication>
namespace Calls {
namespace {

View File

@ -30,6 +30,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "observer_peer.h"
#include "boxes/abstract_box.h"
#include "base/timer.h"
#include "app.h"
namespace Calls {
namespace {

View File

@ -22,6 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "base/weak_unique_ptr.h"
#include "base/timer.h"
#include "ui/twidget.h"
namespace Ui {
class IconButton;

View File

@ -18,10 +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 <QPaintEvent>
#include "chat_helpers/bot_keyboard.h"
#include "styles/style_widgets.h"
#include "styles/style_history.h"
#include "facades.h"
#include "app.h"
BotKeyboard::BotKeyboard(QWidget *parent) : TWidget(parent)
, _st(&st::botKbButton) {

View File

@ -20,7 +20,12 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "history/history_item.h"
#include "ui/twidget.h"
#include "ui/widgets/tooltip.h"
#include "structs.h"
class HistoryItem;
class BotKeyboard : public TWidget, public Ui::AbstractTooltipShower, public ClickHandlerHost {
Q_OBJECT

View File

@ -24,6 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "styles/style_chat_helpers.h"
#include "ui/widgets/shadow.h"
#include "lang/lang_keys.h"
#include "app.h"
namespace ChatHelpers {
namespace {

View File

@ -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 <QTextBlock>
#include "chat_helpers/emoji_suggestions_widget.h"
#include "chat_helpers/emoji_suggestions_helper.h"
@ -26,6 +27,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "platform/platform_specific.h"
#include "styles/style_chat_helpers.h"
#include "ui/widgets/inner_dropdown.h"
#include "ui/emoji_config.h"
#include "app.h"
namespace Ui {
namespace Emoji {
@ -121,7 +124,7 @@ std::vector<SuggestionsWidget::Row> SuggestionsWidget::getRowsByQuery() const {
suggestionsEmoji[i] = Find(QStringFromUTF16(suggestions[i].emoji()));
}
auto recents = 0;
auto &recent = GetRecent();
auto &recent = GetRecent();
for (auto &item : recent) {
auto emoji = item.first->original();
if (!emoji) emoji = item.first;

View File

@ -20,6 +20,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QTextEdit>
#include "base/observer.h"
#include "ui/twidget.h"
#include "ui/effects/panel_animation.h"
namespace Ui {

View File

@ -29,6 +29,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "styles/style_chat_helpers.h"
#include "auth_session.h"
#include "chat_helpers/stickers.h"
#include "app.h"
#include <QApplication>
FieldAutocomplete::FieldAutocomplete(QWidget *parent) : TWidget(parent)
, _scroll(this, st::mentionScroll) {

View File

@ -20,7 +20,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QTimer>
#include "base/observer.h"
#include "ui/twidget.h"
#include "ui/animation.h"
#include "structs.h"
namespace Ui {
class ScrollArea;

View File

@ -31,6 +31,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "lang/lang_keys.h"
#include "mainwindow.h"
#include "window/window_controller.h"
#include "app.h"
#include <QApplication>
namespace ChatHelpers {
namespace {

View File

@ -18,6 +18,9 @@ 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 <QMimeData>
#include <QString>
#include "chat_helpers/message_field.h"
#include "history/history_widget.h"

View File

@ -36,6 +36,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "auth_session.h"
#include "observer_peer.h"
#include "apiwrap.h"
#include "chat_helpers/tabbed_selector.h"
#include "app.h"
#include <QApplication>
#include <QWidget>
namespace ChatHelpers {
namespace {

View File

@ -22,6 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "chat_helpers/tabbed_selector.h"
#include "base/variant.h"
#include "ui/effects/ripple_animation.h"
namespace Window {
class Controller;

View File

@ -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 <QWindow>
#include "chat_helpers/tabbed_panel.h"
#include "ui/widgets/shadow.h"
@ -25,6 +26,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "chat_helpers/tabbed_selector.h"
#include "window/window_controller.h"
#include "mainwindow.h"
#include "app.h"
namespace ChatHelpers {
namespace {

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once
#include "ui/twidget.h"
#include "ui/animation.h"
#include "base/timer.h"
namespace Window {

View File

@ -35,6 +35,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "mainwindow.h"
#include "observer_peer.h"
#include "apiwrap.h"
#include "app.h"
namespace ChatHelpers {
namespace {

View File

@ -74,8 +74,11 @@ CppFile::CppFile(const QString &path, const ProjectInfo &project)
}
}
CppFile &CppFile::include(const QString &header) {
stream() << "#include \"" << header << "\"";
CppFile &CppFile::include(const QString &header, bool global ) {
if (global)
stream() << QString("#include <%1>").arg(header);
else
stream() << QString("#include \"%1\"").arg(header);
return newline();
}
@ -129,4 +132,4 @@ bool CppFile::finalize() {
}
} // namespace common
} // namespace codegen
} // namespace codegen

View File

@ -48,7 +48,7 @@ public:
stream() << "\n";
return *this;
}
CppFile &include(const QString &header);
CppFile &include(const QString &header, bool global = false);
// Empty name adds anonymous namespace.
CppFile &pushNamespace(const QString &name = QString());

View File

@ -318,6 +318,7 @@ bool Generator::writeImages() {
bool Generator::writeSource() {
source_ = std::make_unique<common::CppFile>(outputPath_ + ".cpp", project_);
source_->include("ui/emoji_config.h").newline();
source_->include("emoji_suggestions_data.h").newline();
source_->pushNamespace("Ui").pushNamespace("Emoji").pushNamespace();
source_->stream() << "\
@ -379,6 +380,9 @@ void Init() {\n\
bool Generator::writeHeader() {
auto header = std::make_unique<common::CppFile>(outputPath_ + ".h", project_);
header->include("QChar", true);
header->include("settings.h");
header->pushNamespace("Ui").pushNamespace("Emoji").pushNamespace("internal");
header->stream() << "\
\n\

View File

@ -115,6 +115,11 @@ Generator::Generator(const LangPack &langpack, const QString &destBasePath, cons
bool Generator::writeHeader() {
header_ = std::make_unique<common::CppFile>(basePath_ + ".h", project_);
header_->include("utility", true);
header_->include("QString", true);
header_->include("QLatin1String", true);
header_->include("lang/lang_tag.h").newline().pushNamespace("Lang").stream() << "\
\n\
constexpr auto kTagsCount = " << langpack_.tags.size() << ";\n\

View File

@ -39,6 +39,7 @@ Generator::Generator(const Rules &rules, const QString &destBasePath, const comm
bool Generator::writeHeader() {
header_ = std::make_unique<common::CppFile>(basePath_ + ".h", project_);
header_->include("QString", true);
header_->stream() << "QVector<int> phoneNumberParse(const QString &number);\n";
return header_->finalize();
@ -47,6 +48,7 @@ bool Generator::writeHeader() {
bool Generator::writeSource() {
source_ = std::make_unique<common::CppFile>(basePath_ + ".cpp", project_);
source_->include("QVector", true);
source_->stream() << "\
QVector<int> phoneNumberParse(const QString &number) {\n\
QVector<int> result;\n\

View File

@ -989,6 +989,7 @@ GNU General Public License for more details.\n\
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\
*/\n\
#include "base/assertion.h"\n\
#include "scheme.h"\n\
\n\
// Creator proxy class definition\n\

View File

@ -216,6 +216,7 @@ Generator::Generator(const structure::Module &module, const QString &destBasePat
bool Generator::writeHeader() {
header_ = std::make_unique<common::CppFile>(basePath_ + ".h", project_);
header_->include("styles/style_basic.h").newline();
header_->include("ui/style/style_core.h").newline();
if (!writeHeaderStyleNamespace()) {

View File

@ -20,8 +20,13 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QtGlobal>
#ifdef Q_OS_WIN
# include <guiddef.h>
#endif
#include "core/version.h"
#include "settings.h"
#include "core/utils.h"
constexpr str_const AppName = "${KEPKA_APPNAME}";
@ -142,6 +147,7 @@ inline bool isServiceUser(quint64 id) {
}
#ifdef Q_OS_WIN
#include <guiddef.h>
inline const GUID &cGUID() {
#ifndef OS_MAC_STORE
static const GUID gGuid = { 0x87a94ab0, 0xe370, 0x4cde, { 0x98, 0xd3, 0xac, 0xc1, 0x10, 0xc5, 0x96, 0x7d } };

View File

@ -24,15 +24,15 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include <exception>
#include <memory>
#include <ctime>
#include <cstdint>
#include <gsl/gsl>
#include <QLatin1String>
#include <QString>
#include "base/build_config.h"
#include "base/ordered_set.h"
template <typename Type>
using not_null = gsl::not_null<Type>;
#include "base/ordered_set.h"
#include <cstdint>
#define qsl(s) QStringLiteral(s)
#define qstr(s) QLatin1String(s, static_cast<int>(sizeof(s)-1))

View File

@ -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 "ui/text/text_entity.h"
#include "core/click_handler.h"
ClickHandlerHost::~ClickHandlerHost() {

View File

@ -20,6 +20,12 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QSharedPointer>
#include "core/utils.h"
#include "base/lambda.h"
#include "ui/text/text_entity.h"
class ClickHandler;
using ClickHandlerPtr = QSharedPointer<ClickHandler>;
@ -42,7 +48,7 @@ protected:
};
class EntityInText;
struct TextWithEntities;
class ClickHandler {
public:
virtual ~ClickHandler() {

View File

@ -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 <QDesktopServices>
#include "core/click_handler_types.h"
#include "lang/lang_keys.h"
@ -29,6 +30,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "storage/localstorage.h"
#include "ui/widgets/tooltip.h"
#include "core/file_utilities.h"
#include "facades.h"
#include "app.h" // App::userLoaded
namespace {

View File

@ -20,7 +20,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QUrl>
#include <QApplication>
#include <QClipboard>
#include "core/click_handler.h"
#include "structs.h"
class TextClickHandler : public ClickHandler {
public:

View File

@ -18,6 +18,9 @@ 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 <QDesktopServices>
#include <QStandardPaths>
#include <QFileDialog>
#include "core/file_utilities.h"
#include "mainwindow.h"

View File

@ -20,6 +20,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QUrl>
#include <QPoint>
#include <QString>
#include <QByteArray>
#include <QStringList>
#include "base/observer.h"
// legacy

View File

@ -20,7 +20,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <base/lambda.h>
#include "core/basic_types.h"
#include "core/utils.h"
#include <QTimer>
class SingleTimer : public QTimer { // single shot timer with check
Q_OBJECT

View File

@ -18,6 +18,9 @@ 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 <QMutex>
#include <QThread>
#include <QMimeDatabase>
#include "core/utils.h"
#include <openssl/crypto.h>
@ -27,6 +30,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include <openssl/engine.h>
#include <openssl/conf.h>
#include <openssl/ssl.h>
#include <QSslSocket>
extern "C" {
#include <libavcodec/avcodec.h>
@ -47,6 +51,8 @@ quint64 _SharedMemoryLocation[4] = { 0x00, 0x01, 0x02, 0x03 };
#include <openssl/rand.h>
#include "mtproto/core_types.h"
// Base types compile-time check
static_assert(sizeof(char) == 1, "Basic types size check failed");
static_assert(sizeof(uchar) == 1, "Basic types size check failed");

View File

@ -20,8 +20,19 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <set>
#include <QByteArray>
#include <QDateTime>
#include <QReadWriteLock>
#include <QRegularExpression>
#include <QMimeType>
#include <QStringList>
#include <QFileInfo>
#include "base/assertion.h"
#include "core/basic_types.h"
#include "base/flags.h"
#include "logs.h"
// Define specializations for QByteArray for Qt 5.3.2, because
// QByteArray in Qt 5.3.2 doesn't declare "pointer" subtype.
@ -218,11 +229,11 @@ private:
};
inline QString str_const_toString(const str_const &str) {
return QString::fromUtf8(str.c_str(), str.size());
return QString::fromUtf8(str.c_str(), static_cast<int>(str.size()));
}
inline QByteArray str_const_toByteArray(const str_const &str) {
return QByteArray::fromRawData(str.c_str(), str.size());
return QByteArray::fromRawData(str.c_str(), static_cast<int>(str.size()));
}
template <typename T>

View File

@ -21,7 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once
#include <cstdint>
// #include "core/utils.h"
#include "utils.h"
#define BETA_VERSION_MACRO (0ULL)

View File

@ -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 "base/ordered_set.h"
#include "core/utils.h"
#include "data/data_abstract_structure.h"
namespace Data {

View File

@ -20,6 +20,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "structs.h"
#include "history/history.h"
namespace Ui {
class FlatTextarea;
} // namespace Ui

Some files were not shown because too many files have changed in this diff Show More