2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2014-12-01 10:47:38 +00:00
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
2015-10-03 13:16:42 +00:00
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2017-01-11 18:31:31 +00:00
|
|
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
#include "core/basic_types.h"
|
2016-09-27 14:20:49 +00:00
|
|
|
#include "history.h"
|
|
|
|
#include "history/history_item.h"
|
|
|
|
#include "history/history_media.h"
|
|
|
|
#include "history/history_message.h"
|
|
|
|
#include "layout.h"
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-01-11 15:43:29 +00:00
|
|
|
class AppClass;
|
2016-04-12 21:31:28 +00:00
|
|
|
class MainWindow;
|
2014-05-30 08:53:19 +00:00
|
|
|
class MainWidget;
|
2015-03-19 09:18:19 +00:00
|
|
|
class ApiWrap;
|
2014-05-30 08:53:19 +00:00
|
|
|
class FileUploader;
|
|
|
|
|
2016-09-27 13:37:18 +00:00
|
|
|
using HistoryItemsMap = OrderedSet<HistoryItem*>;
|
|
|
|
using PhotoItems = QHash<PhotoData*, HistoryItemsMap>;
|
|
|
|
using DocumentItems = QHash<DocumentData*, HistoryItemsMap>;
|
|
|
|
using WebPageItems = QHash<WebPageData*, HistoryItemsMap>;
|
|
|
|
using GameItems = QHash<GameData*, HistoryItemsMap>;
|
|
|
|
using SharedContactItems = QHash<int32, HistoryItemsMap>;
|
|
|
|
using GifItems = QHash<Media::Clip::Reader*, HistoryItem*>;
|
2015-12-27 21:37:48 +00:00
|
|
|
|
2016-09-27 13:37:18 +00:00
|
|
|
using PhotosData = QHash<PhotoId, PhotoData*>;
|
|
|
|
using DocumentsData = QHash<DocumentId, DocumentData*>;
|
2015-12-27 21:37:48 +00:00
|
|
|
|
2016-09-28 10:15:03 +00:00
|
|
|
struct LocationCoords;
|
|
|
|
struct LocationData;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
namespace App {
|
2016-01-11 15:43:29 +00:00
|
|
|
AppClass *app();
|
2016-04-12 21:31:28 +00:00
|
|
|
MainWindow *wnd();
|
2014-05-30 08:53:19 +00:00
|
|
|
MainWidget *main();
|
2015-03-02 12:34:16 +00:00
|
|
|
bool passcoded();
|
2014-05-30 08:53:19 +00:00
|
|
|
FileUploader *uploader();
|
2015-03-19 09:18:19 +00:00
|
|
|
ApiWrap *api();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void logOut();
|
|
|
|
|
|
|
|
QString formatPhone(QString phone);
|
|
|
|
|
2016-06-03 07:20:24 +00:00
|
|
|
TimeId onlineForSort(UserData *user, TimeId now);
|
|
|
|
int32 onlineWillChangeIn(UserData *user, TimeId now);
|
|
|
|
int32 onlineWillChangeIn(TimeId online, TimeId now);
|
|
|
|
QString onlineText(UserData *user, TimeId now, bool precise = false);
|
|
|
|
QString onlineText(TimeId online, TimeId now, bool precise = false);
|
|
|
|
bool onlineColorUse(UserData *user, TimeId now);
|
|
|
|
bool onlineColorUse(TimeId online, TimeId now);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-07-08 16:59:46 +00:00
|
|
|
UserData *feedUser(const MTPUser &user);
|
2016-05-25 12:09:05 +00:00
|
|
|
UserData *feedUsers(const MTPVector<MTPUser> &users); // returns last user
|
2016-07-08 16:59:46 +00:00
|
|
|
PeerData *feedChat(const MTPChat &chat);
|
2016-05-25 12:09:05 +00:00
|
|
|
PeerData *feedChats(const MTPVector<MTPChat> &chats); // returns last chat
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-06-29 22:09:23 +00:00
|
|
|
void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos, bool emitPeerUpdated = true);
|
|
|
|
void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d, bool emitPeerUpdated = true);
|
|
|
|
void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d, bool emitPeerUpdated = true);
|
2015-10-29 19:10:49 +00:00
|
|
|
void feedChatAdmins(const MTPDupdateChatAdmins &d, bool emitPeerUpdated = true);
|
|
|
|
void feedParticipantAdmin(const MTPDupdateChatParticipantAdmin &d, bool emitPeerUpdated = true);
|
2015-10-15 00:15:28 +00:00
|
|
|
bool checkEntitiesAndViewsUpdate(const MTPDmessage &m); // returns true if item found and it is not detached
|
2016-09-23 18:26:53 +00:00
|
|
|
void updateEditedMessage(const MTPMessage &m);
|
2015-12-27 21:37:48 +00:00
|
|
|
void addSavedGif(DocumentData *doc);
|
|
|
|
void checkSavedGif(HistoryItem *item);
|
2015-11-18 14:59:17 +00:00
|
|
|
void feedMsgs(const QVector<MTPMessage> &msgs, NewMessageType type);
|
2015-09-20 08:55:41 +00:00
|
|
|
void feedMsgs(const MTPVector<MTPMessage> &msgs, NewMessageType type);
|
2015-09-03 10:48:40 +00:00
|
|
|
void feedInboxRead(const PeerId &peer, MsgId upTo);
|
2016-06-22 18:41:13 +00:00
|
|
|
void feedOutboxRead(const PeerId &peer, MsgId upTo, TimeId when);
|
2015-09-03 10:48:40 +00:00
|
|
|
void feedWereDeleted(ChannelId channelId, const QVector<MTPint> &msgsIds);
|
2016-06-02 13:57:49 +00:00
|
|
|
void feedUserLink(MTPint userId, const MTPContactLink &myLink, const MTPContactLink &foreignLink);
|
2015-06-29 22:09:23 +00:00
|
|
|
|
|
|
|
void markPeerUpdated(PeerData *data);
|
|
|
|
void clearPeerUpdated(PeerData *data);
|
|
|
|
|
2015-02-03 15:02:46 +00:00
|
|
|
ImagePtr image(const MTPPhotoSize &size);
|
2015-08-07 12:11:50 +00:00
|
|
|
StorageImageLocation imageLocation(int32 w, int32 h, const MTPFileLocation &loc);
|
2015-05-19 15:46:45 +00:00
|
|
|
StorageImageLocation imageLocation(const MTPPhotoSize &size);
|
2015-02-03 15:02:46 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
PhotoData *feedPhoto(const MTPPhoto &photo, const PreparedPhotoThumbs &thumbs);
|
2016-09-27 13:37:18 +00:00
|
|
|
PhotoData *feedPhoto(const MTPPhoto &photo, PhotoData *convert = nullptr);
|
|
|
|
PhotoData *feedPhoto(const MTPDphoto &photo, PhotoData *convert = nullptr);
|
2015-01-02 14:55:24 +00:00
|
|
|
DocumentData *feedDocument(const MTPdocument &document, const QPixmap &thumb);
|
2016-09-27 13:37:18 +00:00
|
|
|
DocumentData *feedDocument(const MTPdocument &document, DocumentData *convert = nullptr);
|
|
|
|
DocumentData *feedDocument(const MTPDdocument &document, DocumentData *convert = nullptr);
|
|
|
|
WebPageData *feedWebPage(const MTPDwebPage &webpage, WebPageData *convert = nullptr);
|
|
|
|
WebPageData *feedWebPage(const MTPDwebPagePending &webpage, WebPageData *convert = nullptr);
|
2015-04-04 20:01:34 +00:00
|
|
|
WebPageData *feedWebPage(const MTPWebPage &webpage);
|
2016-09-27 13:37:18 +00:00
|
|
|
GameData *feedGame(const MTPDgame &game, GameData *convert = nullptr);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-25 11:29:45 +00:00
|
|
|
PeerData *peer(const PeerId &id, PeerData::LoadedStatus restriction = PeerData::NotLoaded);
|
|
|
|
inline UserData *user(const PeerId &id, PeerData::LoadedStatus restriction = PeerData::NotLoaded) {
|
|
|
|
return asUser(peer(id, restriction));
|
|
|
|
}
|
|
|
|
inline ChatData *chat(const PeerId &id, PeerData::LoadedStatus restriction = PeerData::NotLoaded) {
|
|
|
|
return asChat(peer(id, restriction));
|
|
|
|
}
|
|
|
|
inline ChannelData *channel(const PeerId &id, PeerData::LoadedStatus restriction = PeerData::NotLoaded) {
|
|
|
|
return asChannel(peer(id, restriction));
|
|
|
|
}
|
|
|
|
inline UserData *user(UserId userId, PeerData::LoadedStatus restriction = PeerData::NotLoaded) {
|
|
|
|
return asUser(peer(peerFromUser(userId), restriction));
|
|
|
|
}
|
|
|
|
inline ChatData *chat(ChatId chatId, PeerData::LoadedStatus restriction = PeerData::NotLoaded) {
|
|
|
|
return asChat(peer(peerFromChat(chatId), restriction));
|
|
|
|
}
|
|
|
|
inline ChannelData *channel(ChannelId channelId, PeerData::LoadedStatus restriction = PeerData::NotLoaded) {
|
|
|
|
return asChannel(peer(peerFromChannel(channelId), restriction));
|
|
|
|
}
|
|
|
|
inline PeerData *peerLoaded(const PeerId &id) {
|
|
|
|
return peer(id, PeerData::FullLoaded);
|
|
|
|
}
|
|
|
|
inline UserData *userLoaded(const PeerId &id) {
|
|
|
|
return user(id, PeerData::FullLoaded);
|
|
|
|
}
|
|
|
|
inline ChatData *chatLoaded(const PeerId &id) {
|
|
|
|
return chat(id, PeerData::FullLoaded);
|
|
|
|
}
|
|
|
|
inline ChannelData *channelLoaded(const PeerId &id) {
|
|
|
|
return channel(id, PeerData::FullLoaded);
|
|
|
|
}
|
|
|
|
inline UserData *userLoaded(UserId userId) {
|
|
|
|
return user(userId, PeerData::FullLoaded);
|
|
|
|
}
|
|
|
|
inline ChatData *chatLoaded(ChatId chatId) {
|
|
|
|
return chat(chatId, PeerData::FullLoaded);
|
|
|
|
}
|
|
|
|
inline ChannelData *channelLoaded(ChannelId channelId) {
|
|
|
|
return channel(channelId, PeerData::FullLoaded);
|
|
|
|
}
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
UserData *self();
|
2015-12-28 22:06:27 +00:00
|
|
|
PeerData *peerByName(const QString &username);
|
2014-05-30 08:53:19 +00:00
|
|
|
QString peerName(const PeerData *peer, bool forDialogs = false);
|
2015-07-21 14:55:23 +00:00
|
|
|
PhotoData *photo(const PhotoId &photo);
|
2015-08-12 18:01:32 +00:00
|
|
|
PhotoData *photoSet(const PhotoId &photo, PhotoData *convert, const uint64 &access, int32 date, const ImagePtr &thumb, const ImagePtr &medium, const ImagePtr &full);
|
2015-05-19 15:46:45 +00:00
|
|
|
DocumentData *document(const DocumentId &document);
|
2016-07-08 13:56:53 +00:00
|
|
|
DocumentData *documentSet(const DocumentId &document, DocumentData *convert, const uint64 &access, int32 version, int32 date, const QVector<MTPDocumentAttribute> &attributes, const QString &mime, const ImagePtr &thumb, int32 dc, int32 size, const StorageImageLocation &thumbLocation);
|
2015-07-21 14:55:23 +00:00
|
|
|
WebPageData *webPage(const WebPageId &webPage);
|
2016-09-27 13:37:18 +00:00
|
|
|
WebPageData *webPageSet(const WebPageId &webPage, WebPageData *convert, const QString &type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, DocumentData *doc, int32 duration, const QString &author, int32 pendingTill);
|
|
|
|
GameData *game(const GameId &game);
|
2016-09-28 10:15:03 +00:00
|
|
|
GameData *gameSet(const GameId &game, GameData *convert, const uint64 &accessHash, const QString &shortName, const QString &title, const QString &description, PhotoData *photo, DocumentData *doc);
|
2016-02-28 13:54:04 +00:00
|
|
|
LocationData *location(const LocationCoords &coords);
|
2014-11-12 20:18:00 +00:00
|
|
|
void forgetMedia();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
MTPPhoto photoFromUserPhoto(MTPint userId, MTPint date, const MTPUserProfilePhoto &photo);
|
|
|
|
|
|
|
|
Histories &histories();
|
2015-09-07 07:52:37 +00:00
|
|
|
History *history(const PeerId &peer);
|
2016-05-20 16:01:06 +00:00
|
|
|
History *historyFromDialog(const PeerId &peer, int32 unreadCnt, int32 maxInboxRead, int32 maxOutboxRead);
|
2014-05-30 08:53:19 +00:00
|
|
|
History *historyLoaded(const PeerId &peer);
|
2015-09-03 10:48:40 +00:00
|
|
|
HistoryItem *histItemById(ChannelId channelId, MsgId itemId);
|
2016-03-13 15:45:00 +00:00
|
|
|
inline History *history(const PeerData *peer) {
|
2016-03-22 15:23:34 +00:00
|
|
|
t_assert(peer != nullptr);
|
2016-03-13 15:45:00 +00:00
|
|
|
return history(peer->id);
|
|
|
|
}
|
|
|
|
inline History *historyLoaded(const PeerData *peer) {
|
2016-03-22 15:23:34 +00:00
|
|
|
return peer ? historyLoaded(peer->id) : nullptr;
|
2016-03-13 15:45:00 +00:00
|
|
|
}
|
|
|
|
inline HistoryItem *histItemById(const ChannelData *channel, MsgId itemId) {
|
|
|
|
return histItemById(channel ? peerToChannel(channel->id) : 0, itemId);
|
|
|
|
}
|
2015-09-03 10:48:40 +00:00
|
|
|
inline HistoryItem *histItemById(const FullMsgId &msgId) {
|
|
|
|
return histItemById(msgId.channel, msgId.msg);
|
|
|
|
}
|
2015-12-23 12:55:32 +00:00
|
|
|
void historyRegItem(HistoryItem *item);
|
2014-07-04 11:12:54 +00:00
|
|
|
void historyItemDetached(HistoryItem *item);
|
2014-05-30 08:53:19 +00:00
|
|
|
void historyUnregItem(HistoryItem *item);
|
2016-03-11 12:20:58 +00:00
|
|
|
void historyUpdateDependent(HistoryItem *item);
|
2014-05-30 08:53:19 +00:00
|
|
|
void historyClearMsgs();
|
|
|
|
void historyClearItems();
|
2016-03-05 21:12:55 +00:00
|
|
|
void historyRegDependency(HistoryItem *dependent, HistoryItem *dependency);
|
|
|
|
void historyUnregDependency(HistoryItem *dependent, HistoryItem *dependency);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-09-03 10:48:40 +00:00
|
|
|
void historyRegRandom(uint64 randomId, const FullMsgId &itemId);
|
2014-05-30 08:53:19 +00:00
|
|
|
void historyUnregRandom(uint64 randomId);
|
2015-09-03 10:48:40 +00:00
|
|
|
FullMsgId histItemByRandom(uint64 randomId);
|
|
|
|
void historyRegSentData(uint64 randomId, const PeerId &peerId, const QString &text);
|
|
|
|
void historyUnregSentData(uint64 randomId);
|
|
|
|
void histSentDataByItem(uint64 randomId, PeerId &peerId, QString &text);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void hoveredItem(HistoryItem *item);
|
|
|
|
HistoryItem *hoveredItem();
|
|
|
|
void pressedItem(HistoryItem *item);
|
|
|
|
HistoryItem *pressedItem();
|
|
|
|
void hoveredLinkItem(HistoryItem *item);
|
|
|
|
HistoryItem *hoveredLinkItem();
|
|
|
|
void pressedLinkItem(HistoryItem *item);
|
|
|
|
HistoryItem *pressedLinkItem();
|
|
|
|
void contextItem(HistoryItem *item);
|
|
|
|
HistoryItem *contextItem();
|
|
|
|
void mousedItem(HistoryItem *item);
|
|
|
|
HistoryItem *mousedItem();
|
2016-06-14 16:26:41 +00:00
|
|
|
void clearMousedItems();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-10-23 16:06:56 +00:00
|
|
|
const style::font &monofont();
|
2015-10-06 19:49:23 +00:00
|
|
|
const QPixmap &emoji();
|
|
|
|
const QPixmap &emojiLarge();
|
2015-05-08 12:45:14 +00:00
|
|
|
const QPixmap &emojiSingle(EmojiPtr emoji, int32 fontHeight);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-12-27 21:37:48 +00:00
|
|
|
void clearHistories();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void initMedia();
|
2015-12-27 21:37:48 +00:00
|
|
|
void deinitMedia();
|
2014-05-30 08:53:19 +00:00
|
|
|
void playSound();
|
|
|
|
|
|
|
|
void checkImageCacheSize();
|
|
|
|
|
|
|
|
bool isValidPhone(QString phone);
|
|
|
|
|
2016-03-02 18:34:42 +00:00
|
|
|
enum LaunchState {
|
|
|
|
Launched = 0,
|
|
|
|
QuitRequested = 1,
|
|
|
|
QuitProcessed = 2,
|
|
|
|
};
|
2014-05-30 08:53:19 +00:00
|
|
|
void quit();
|
2016-03-02 18:34:42 +00:00
|
|
|
bool quitting();
|
2016-06-07 19:59:39 +00:00
|
|
|
void allDraftsSaved();
|
2016-03-02 18:34:42 +00:00
|
|
|
LaunchState launchState();
|
|
|
|
void setLaunchState(LaunchState state);
|
2016-10-28 12:44:28 +00:00
|
|
|
void restart();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-11-28 15:45:07 +00:00
|
|
|
constexpr auto kFileSizeLimit = 1500 * 1024 * 1024; // Load files up to 1500mb
|
|
|
|
constexpr auto kImageSizeLimit = 64 * 1024 * 1024; // Open images up to 64mb jpg/png/gif
|
|
|
|
QImage readImage(QByteArray data, QByteArray *format = nullptr, bool opaque = true, bool *animated = nullptr);
|
|
|
|
QImage readImage(const QString &file, QByteArray *format = nullptr, bool opaque = true, bool *animated = nullptr, QByteArray *content = 0);
|
2016-05-27 10:57:11 +00:00
|
|
|
QPixmap pixmapFromImageInPlace(QImage &&image);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-12-25 13:09:14 +00:00
|
|
|
void regPhotoItem(PhotoData *data, HistoryItem *item);
|
|
|
|
void unregPhotoItem(PhotoData *data, HistoryItem *item);
|
|
|
|
const PhotoItems &photoItems();
|
2015-12-27 21:37:48 +00:00
|
|
|
const PhotosData &photosData();
|
2015-12-25 13:09:14 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void regDocumentItem(DocumentData *data, HistoryItem *item);
|
|
|
|
void unregDocumentItem(DocumentData *data, HistoryItem *item);
|
|
|
|
const DocumentItems &documentItems();
|
2015-12-27 21:37:48 +00:00
|
|
|
const DocumentsData &documentsData();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-04-04 20:01:34 +00:00
|
|
|
void regWebPageItem(WebPageData *data, HistoryItem *item);
|
|
|
|
void unregWebPageItem(WebPageData *data, HistoryItem *item);
|
|
|
|
const WebPageItems &webPageItems();
|
|
|
|
|
2016-09-27 13:37:18 +00:00
|
|
|
void regGameItem(GameData *data, HistoryItem *item);
|
|
|
|
void unregGameItem(GameData *data, HistoryItem *item);
|
|
|
|
const GameItems &gameItems();
|
|
|
|
|
2015-12-12 22:29:33 +00:00
|
|
|
void regSharedContactItem(int32 userId, HistoryItem *item);
|
|
|
|
void unregSharedContactItem(int32 userId, HistoryItem *item);
|
|
|
|
const SharedContactItems &sharedContactItems();
|
2015-09-02 10:20:33 +00:00
|
|
|
QString phoneFromSharedContact(int32 userId);
|
|
|
|
|
2016-06-24 10:37:29 +00:00
|
|
|
void regGifItem(Media::Clip::Reader *reader, HistoryItem *item);
|
|
|
|
void unregGifItem(Media::Clip::Reader *reader);
|
2015-12-16 13:35:15 +00:00
|
|
|
void stopGifItems();
|
2015-12-15 14:50:51 +00:00
|
|
|
|
2015-04-30 13:53:36 +00:00
|
|
|
void regMuted(PeerData *peer, int32 changeIn);
|
|
|
|
void unregMuted(PeerData *peer);
|
|
|
|
void updateMuted();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void setProxySettings(QNetworkAccessManager &manager);
|
2016-03-20 08:16:35 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
2015-12-30 19:09:20 +00:00
|
|
|
QNetworkProxy getHttpProxySettings();
|
2016-10-18 07:56:38 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
2014-05-30 08:53:19 +00:00
|
|
|
void setProxySettings(QTcpSocket &socket);
|
|
|
|
|
2016-11-12 15:02:19 +00:00
|
|
|
enum class RectPart {
|
2016-11-21 20:26:54 +00:00
|
|
|
None = 0x000,
|
2016-11-12 15:02:19 +00:00
|
|
|
TopLeft = 0x001,
|
|
|
|
Top = 0x002,
|
|
|
|
TopRight = 0x004,
|
|
|
|
Left = 0x008,
|
|
|
|
Center = 0x010,
|
|
|
|
Right = 0x020,
|
|
|
|
BottomLeft = 0x040,
|
|
|
|
Bottom = 0x080,
|
|
|
|
BottomRight = 0x100,
|
|
|
|
TopFull = 0x007,
|
|
|
|
LeftFull = 0x049,
|
|
|
|
RightFull = 0x124,
|
|
|
|
BottomFull = 0x1c0,
|
|
|
|
NoTopBottom = 0x038,
|
|
|
|
NoLeftRight = 0x092,
|
|
|
|
Full = 0x1ff,
|
|
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(RectParts, RectPart);
|
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(RectParts);
|
|
|
|
|
2016-11-21 20:26:54 +00:00
|
|
|
void complexOverlayRect(Painter &p, QRect rect, ImageRoundRadius radius, ImageRoundCorners corners);
|
|
|
|
void complexLocationRect(Painter &p, QRect rect, ImageRoundRadius radius, ImageRoundCorners corners);
|
|
|
|
|
2016-07-07 12:35:14 +00:00
|
|
|
QImage **cornersMask(ImageRoundRadius radius);
|
2016-12-23 13:21:01 +00:00
|
|
|
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, RoundCorners index, const style::color *shadow = nullptr, RectParts parts = RectPart::Full);
|
|
|
|
inline void roundRect(Painter &p, const QRect &rect, style::color bg, RoundCorners index, const style::color *shadow = nullptr, RectParts parts = RectPart::Full) {
|
2016-11-12 15:02:19 +00:00
|
|
|
return roundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, index, shadow, parts);
|
2015-05-20 19:28:24 +00:00
|
|
|
}
|
2016-12-23 13:21:01 +00:00
|
|
|
void roundShadow(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color shadow, RoundCorners index, RectParts parts = RectPart::Full);
|
|
|
|
inline void roundShadow(Painter &p, const QRect &rect, style::color shadow, RoundCorners index, RectParts parts = RectPart::Full) {
|
2016-11-12 15:02:19 +00:00
|
|
|
return roundShadow(p, rect.x(), rect.y(), rect.width(), rect.height(), shadow, index, parts);
|
2015-05-22 11:14:52 +00:00
|
|
|
}
|
2016-12-23 13:21:01 +00:00
|
|
|
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, ImageRoundRadius radius, RectParts parts = RectPart::Full);
|
|
|
|
inline void roundRect(Painter &p, const QRect &rect, style::color bg, ImageRoundRadius radius, RectParts parts = RectPart::Full) {
|
2016-11-12 15:02:19 +00:00
|
|
|
return roundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, radius, parts);
|
2015-10-03 10:09:09 +00:00
|
|
|
}
|
2015-05-20 19:28:24 +00:00
|
|
|
|
2015-02-03 15:02:46 +00:00
|
|
|
struct WallPaper {
|
|
|
|
WallPaper(int32 id, ImagePtr thumb, ImagePtr full) : id(id), thumb(thumb), full(full) {
|
|
|
|
}
|
|
|
|
int32 id;
|
|
|
|
ImagePtr thumb;
|
|
|
|
ImagePtr full;
|
|
|
|
};
|
|
|
|
typedef QList<WallPaper> WallPapers;
|
|
|
|
DeclareSetting(WallPapers, ServerBackgrounds);
|
|
|
|
|
2015-11-20 13:34:37 +00:00
|
|
|
};
|