mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-29 15:01:03 +00:00
merged with master fix of report spam button
This commit is contained in:
commit
fefff78ae0
125
README.md
125
README.md
@ -1,10 +1,10 @@
|
||||
## [Telegram Desktop](https://tdesktop.com) – Official Telegram Messenger app
|
||||
# [Telegram Desktop][telegram_desktop] – Official Messenger
|
||||
|
||||
This is complete source code and build instructions for alpha version of official desktop client for [Telegram](https://telegram.org) messenger, based on [Telegram API](https://core.telegram.org/) and [MTProto](https://core.telegram.org/mtproto) secure protocol.
|
||||
This is the complete source code and the build instructions for the alpha version of the official desktop client for the [Telegram][telegram] messenger, based on the [Telegram API][telegram_api] and the [MTProto][telegram_proto] secure protocol.
|
||||
|
||||
Source code is published under GPL v3, license is available [here](https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE).
|
||||
The source code is published under GPL v3, the license is available [here][license].
|
||||
|
||||
###Supported systems
|
||||
## Supported systems
|
||||
|
||||
* Windows XP - Windows 10 (**not** RT)
|
||||
* Mac OS X 10.8 - Mac OS X 10.10
|
||||
@ -12,9 +12,9 @@ Source code is published under GPL v3, license is available [here](https://githu
|
||||
* Ubuntu 12.04 - Ubuntu 14.04
|
||||
* Fedora 22
|
||||
|
||||
###Third-party
|
||||
## Third-party libraries
|
||||
|
||||
* Qt 5.3.2 and 5.5.0, slightly patched ([LGPL](http://qt-project.org/doc/qt-5/lgpl.html))
|
||||
* Qt 5.3.2 and 5.5.0, slightly patched ([LGPL](http://doc.qt.io/qt-5/licensing.html))
|
||||
* OpenSSL 1.0.1g ([OpenSSL License](https://www.openssl.org/source/license.html))
|
||||
* zlib 1.2.8 ([zlib License](http://www.zlib.net/zlib_license.html))
|
||||
* libexif 0.6.20 ([LGPL](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html))
|
||||
@ -25,75 +25,84 @@ Source code is published under GPL v3, license is available [here](https://githu
|
||||
* FFmpeg ([LGPL](https://www.ffmpeg.org/legal.html))
|
||||
* Open Sans font ([Apache License](http://www.apache.org/licenses/LICENSE-2.0.html))
|
||||
|
||||
###[Build instructions for Visual Studio 2013](https://github.com/telegramdesktop/tdesktop/blob/master/MSVC.md)
|
||||
## Build instructions
|
||||
|
||||
###[Build instructions for XCode 6.4](https://github.com/telegramdesktop/tdesktop/blob/master/XCODE.md)
|
||||
* [Visual Studio 2013][msvc]
|
||||
* [XCode 6.4][xcode]
|
||||
* [XCode 6.4 for OS X 10.6 and 10.7][xcode_old]
|
||||
* [Qt Creator 3.2.0 Ubuntu][qtcreator]
|
||||
|
||||
###[Build instructions for XCode 6.4 for OS X 10.6 and 10.7](https://github.com/telegramdesktop/tdesktop/blob/master/XCODEold.md)
|
||||
## Projects in Telegram solution
|
||||
|
||||
###[Build instructions for Qt Creator 3.2.0 Ubuntu](https://github.com/telegramdesktop/tdesktop/blob/master/QTCREATOR.md)
|
||||
* ### Telegram
|
||||
|
||||
##Projects in Telegram solution
|
||||
[Telegram Desktop][telegram_desktop] messenger
|
||||
|
||||
####Telegram
|
||||
* ### Updater
|
||||
|
||||
tdesktop messenger
|
||||
A little app, that is launched by Telegram when update is ready, replaces all files and launches it back.
|
||||
|
||||
####Updater
|
||||
* ### Packer
|
||||
|
||||
little app, that is launched by Telegram when update is ready, replaces all files and launches it back
|
||||
Compiles given files to single update file, compresses it with lzma and signs with a private key. It is not built in **Debug** and **Release** configurations of Telegram solution, because private key is inaccessible.
|
||||
|
||||
####Packer
|
||||
* ### Prepare
|
||||
|
||||
compiles given files to single update file, compresses it with lzma and signs with a private key, it is not built in **Debug** and **Release** configurations of Telegram solution, because private key is inaccessible
|
||||
Prepares a release for deployment, puts all current files to deploy/{version} folder.
|
||||
|
||||
####Prepare
|
||||
**Windows**:
|
||||
* tsetup{version}.exe installer
|
||||
* Telegram.exe
|
||||
* Telegram.pdb (debug info for crash minidumps view)
|
||||
* tupdate{updversion} binary lzma update archive
|
||||
|
||||
prepares a release for deployment, puts all files to deploy/{version} folder, for Win:
|
||||
* current tsetup{version}exe installer
|
||||
* current Telegram.exe
|
||||
* current Telegram.pdb (debug info for crash minidumps view)
|
||||
* current tupdate{updversion} binary lzma update archive
|
||||
**Mac**:
|
||||
* tsetup{version}.dmg
|
||||
* Telegram.app
|
||||
* tmacupd{updversion} binary lzma update archive
|
||||
|
||||
for Mac:
|
||||
* current tsetup{version}dmg
|
||||
* current Telegram.app
|
||||
* current tmacupd{updversion} binary lzma update archive
|
||||
* ### MetaEmoji
|
||||
|
||||
####MetaEmoji
|
||||
Creates four sprites and text2emoji replace code
|
||||
* SourceFiles/art/emoji.png
|
||||
* SourceFiles/art/emoji_125x.png
|
||||
* SourceFiles/art/emoji_150x.png
|
||||
* SourceFiles/art/emoji_200x.png
|
||||
* SourceFiles/art/emoji_250x.png
|
||||
* SourceFiles/gui/emoji_config.cpp
|
||||
|
||||
creates four sprites and text2emoji replace code
|
||||
* SourceFiles/art/emoji.png
|
||||
* SourceFiles/art/emoji_125x.png
|
||||
* SourceFiles/art/emoji_150x.png
|
||||
* SourceFiles/art/emoji_200x.png
|
||||
* SourceFiles/art/emoji_250x.png
|
||||
* SourceFiles/gui/emoji_config.cpp
|
||||
* ### MetaStyle
|
||||
|
||||
####MetaStyle
|
||||
From two files and two sprites
|
||||
* Resources/style_classes.txt
|
||||
* Resources/style.txt
|
||||
* SourceFiles/art/sprite.png
|
||||
* SourceFiles/art/sprite_200x.png
|
||||
|
||||
from two files and two sprites
|
||||
* Resources/style_classes.txt
|
||||
* Resources/style.txt
|
||||
* SourceFiles/art/sprite.png
|
||||
* SourceFiles/art/sprite_200x.png
|
||||
Creates two other sprites, four sprite grids and style constants code
|
||||
* SourceFiles/art/sprite_125x.png
|
||||
* SourceFiles/art/sprite_150x.png
|
||||
* SourceFiles/art/grid.png
|
||||
* SourceFiles/art/grid_125x.png
|
||||
* SourceFiles/art/grid_150x.png
|
||||
* SourceFiles/art/grid_200x.png
|
||||
* GeneratedFiles/style_classes.h
|
||||
* GeneratedFiles/style_auto.h
|
||||
* GeneratedFiles/style_auto.cpp
|
||||
|
||||
creates two other sprites, four sprite grids and style constants code
|
||||
* SourceFiles/art/sprite_125x.png
|
||||
* SourceFiles/art/sprite_150x.png
|
||||
* SourceFiles/art/grid.png
|
||||
* SourceFiles/art/grid_125x.png
|
||||
* SourceFiles/art/grid_150x.png
|
||||
* SourceFiles/art/grid_200x.png
|
||||
* GeneratedFiles/style_classes.h
|
||||
* GeneratedFiles/style_auto.h
|
||||
* GeneratedFiles/style_auto.cpp
|
||||
* ### MetaLang
|
||||
|
||||
####MetaLang
|
||||
Creates from languagepack file `Resources/lang.txt` language constants code and language file parse code:
|
||||
* GeneratedFiles/lang.h
|
||||
* GeneratedFiles/lang.cpp
|
||||
|
||||
from langpack file
|
||||
* Resources/lang.txt
|
||||
|
||||
creates lang constants code and lang file parse code
|
||||
* GeneratedFiles/lang.h
|
||||
* GeneratedFiles/lang.cpp
|
||||
[//]: # (LINKS)
|
||||
[telegram]: https://telegram.org
|
||||
[telegram_desktop]: https://desktop.telegram.org
|
||||
[telegram_api]: https://core.telegram.org
|
||||
[telegram_proto]: https://core.telegram.org/mtproto
|
||||
[license]: LICENSE
|
||||
[msvc]: MSVC.md
|
||||
[xcode]: XCODE.md
|
||||
[xcode_old]: XCODEold.md
|
||||
[qtcreator]: qtcreator.md
|
@ -1,10 +1,10 @@
|
||||
@echo OFF
|
||||
|
||||
set "AppVersionStrMajor=0.8"
|
||||
set "AppVersion=8056"
|
||||
set "AppVersionStrSmall=0.8.56"
|
||||
set "AppVersionStr=0.8.56"
|
||||
set "AppVersionStrFull=0.8.56.0"
|
||||
set "AppVersion=8057"
|
||||
set "AppVersionStrSmall=0.8.57"
|
||||
set "AppVersionStr=0.8.57"
|
||||
set "AppVersionStrFull=0.8.57.0"
|
||||
set "DevChannel=0"
|
||||
|
||||
if %DevChannel% neq 0 goto preparedev
|
||||
|
@ -494,6 +494,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_report_spam" = "Report Spam";
|
||||
"lng_report_spam_hide" = "Hide";
|
||||
"lng_report_spam_thanks" = "Thank you for your report!";
|
||||
"lng_report_spam_sure" = "Are you sure you want\nto report spam from this user?";
|
||||
"lng_report_spam_sure_group" = "Are you sure you want\nto report spam in this group?";
|
||||
"lng_report_spam_ok" = "Report";
|
||||
"lng_cant_send_to_not_contact" = "Sorry, you can only send messages to\nmutual contacts at the moment. {more_info}";
|
||||
"lng_cant_invite_not_contact" = "Sorry, you can only add mutual contacts\nto groups at the moment. {more_info}";
|
||||
"lng_cant_more_info" = "More info »";
|
||||
|
@ -17,8 +17,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
static const int32 AppVersion = 8056;
|
||||
static const wchar_t *AppVersionStr = L"0.8.56";
|
||||
static const int32 AppVersion = 8057;
|
||||
static const wchar_t *AppVersionStr = L"0.8.57";
|
||||
static const bool DevVersion = false;
|
||||
|
||||
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
|
||||
|
@ -6091,7 +6091,7 @@ bool HistoryReply::updateReplyTo(bool force) {
|
||||
}
|
||||
if (force) {
|
||||
initDimensions();
|
||||
if (App::main()) App::main()->msgUpdated(history()->peer->id, this);
|
||||
if (App::main()) App::main()->itemResized(this);
|
||||
}
|
||||
return (replyToMsg || !replyToMsgId);
|
||||
}
|
||||
|
@ -544,6 +544,7 @@ void HistoryList::onDragExec() {
|
||||
}
|
||||
drag->setMimeData(mimeData);
|
||||
drag->exec(Qt::CopyAction);
|
||||
if (App::main()) App::main()->updateAfterDrag();
|
||||
return;
|
||||
} else {
|
||||
HistoryItem *pressedLnkItem = App::pressedLinkItem(), *pressedItem = App::pressedItem();
|
||||
@ -575,6 +576,7 @@ void HistoryList::onDragExec() {
|
||||
|
||||
drag->setMimeData(mimeData);
|
||||
drag->exec(Qt::CopyAction);
|
||||
if (App::main()) App::main()->updateAfterDrag();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2988,6 +2990,10 @@ void HistoryWidget::contactsReceived() {
|
||||
updateControlsVisibility();
|
||||
}
|
||||
|
||||
void HistoryWidget::updateAfterDrag() {
|
||||
if (_list) _list->dragActionUpdate(QCursor::pos());
|
||||
}
|
||||
|
||||
void HistoryWidget::updateReportSpamStatus() {
|
||||
if (!_peer || (_peer->isUser() && (peerToUser(_peer->id) == MTP::authedId() || isNotificationsUser(_peer->id) || isServiceUser(_peer->id) || _peer->asUser()->botInfo))) {
|
||||
_reportSpamStatus = dbiprsNoButton;
|
||||
@ -4752,10 +4758,18 @@ void HistoryWidget::onAudioFailed(const FullMsgId &newId) {
|
||||
}
|
||||
|
||||
void HistoryWidget::onReportSpamClicked() {
|
||||
ConfirmBox *box = new ConfirmBox(lang(_peer->isUser() ? lng_report_spam_sure : lng_report_spam_sure_group), lang(lng_report_spam_ok));
|
||||
connect(box, SIGNAL(confirmed()), this, SLOT(onReportSpamSure()));
|
||||
App::wnd()->showLayer(box);
|
||||
_clearPeer = _peer;
|
||||
}
|
||||
|
||||
void HistoryWidget::onReportSpamSure() {
|
||||
if (_reportSpamRequest) return;
|
||||
|
||||
if (_peer->isUser()) MTP::send(MTPcontacts_Block(_peer->asUser()->inputUser), rpcDone(&HistoryWidget::blockDone, _peer), RPCFailHandlerPtr(), 0, 5);
|
||||
_reportSpamRequest = MTP::send(MTPmessages_ReportSpam(_peer->input), rpcDone(&HistoryWidget::reportSpamDone, _peer), rpcFail(&HistoryWidget::reportSpamFail));
|
||||
App::wnd()->hideLayer();
|
||||
if (_clearPeer->isUser()) MTP::send(MTPcontacts_Block(_clearPeer->asUser()->inputUser), rpcDone(&HistoryWidget::blockDone, _clearPeer), RPCFailHandlerPtr(), 0, 5);
|
||||
_reportSpamRequest = MTP::send(MTPmessages_ReportSpam(_clearPeer->input), rpcDone(&HistoryWidget::reportSpamDone, _clearPeer), rpcFail(&HistoryWidget::reportSpamFail));
|
||||
}
|
||||
|
||||
void HistoryWidget::reportSpamDone(PeerData *peer, const MTPBool &result, mtpRequestId req) {
|
||||
@ -4796,10 +4810,10 @@ void HistoryWidget::onReportSpamClear() {
|
||||
}
|
||||
|
||||
void HistoryWidget::onReportSpamClearSure() {
|
||||
App::wnd()->hideLayer();
|
||||
if (_clearPeer->isUser()) {
|
||||
App::main()->deleteConversation(_clearPeer);
|
||||
} else if (_clearPeer->isChat()) {
|
||||
App::wnd()->hideLayer();
|
||||
App::main()->showDialogs();
|
||||
MTP::send(MTPmessages_DeleteChatUser(_clearPeer->asChat()->inputChat, App::self()->inputUser), App::main()->rpcDone(&MainWidget::deleteHistoryAfterLeave, _clearPeer), App::main()->rpcFail(&MainWidget::leaveChatFailed, _clearPeer));
|
||||
} else if (_clearPeer->isChannel()) { // CHANNELS_UX
|
||||
|
@ -519,6 +519,8 @@ public:
|
||||
void contactsReceived();
|
||||
void updateToEndVisibility();
|
||||
|
||||
void updateAfterDrag();
|
||||
|
||||
~HistoryWidget();
|
||||
|
||||
signals:
|
||||
@ -557,6 +559,7 @@ public slots:
|
||||
void onAudioFailed(const FullMsgId &msgId);
|
||||
|
||||
void onReportSpamClicked();
|
||||
void onReportSpamSure();
|
||||
void onReportSpamHide();
|
||||
void onReportSpamClear();
|
||||
void onReportSpamClearSure();
|
||||
|
@ -487,7 +487,10 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
|
||||
"lng_report_spam" = "Spam melden";
|
||||
"lng_report_spam_hide" = "Schließen";
|
||||
"lng_report_spam_thanks" = "Danke für die Meldung!";
|
||||
"lng_report_spam_thanks" = "Danke!";
|
||||
"lng_report_spam_sure" = "Möchtest du wirklich Spam\nvon diesem Nutzer melden?";
|
||||
"lng_report_spam_sure_group" = "Möchtest du wirklich Spam\nin dieser Gruppe melden?";
|
||||
"lng_report_spam_ok" = "Melden";
|
||||
"lng_cant_send_to_not_contact" = "Derzeit kannst du nur Personen schreiben, wenn ihr eure Nummern ausgetauscht habt. {more_info}";
|
||||
"lng_cant_invite_not_contact" = "Du kannst nur Personen hinzufügen, wenn ihr eure Nummern ausgetauscht habt. {more_info}";
|
||||
"lng_cant_more_info" = "Weitere Infos »";
|
||||
|
@ -488,6 +488,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_report_spam" = "Reportar spam";
|
||||
"lng_report_spam_hide" = "Ocultar";
|
||||
"lng_report_spam_thanks" = "¡Gracias por tu reporte!";
|
||||
"lng_report_spam_sure" = "¿Quieres reportar el\nspam de este usuario?";
|
||||
"lng_report_spam_sure_group" = "¿Quieres reportar el\nspam en este grupo?";
|
||||
"lng_report_spam_ok" = "Reportar";
|
||||
"lng_cant_send_to_not_contact" = "Por ahora, sólo puedes enviar mensajes\na contactos mutuos. {more_info}";
|
||||
"lng_cant_invite_not_contact" = "Por ahora, sólo puedes añadir contactos \nmutuos a grupos. {more_info}";
|
||||
"lng_cant_more_info" = "Más información »";
|
||||
@ -632,7 +635,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_about_text" = "Aplicación oficial basada en [a href=\"https://core.telegram.org/mtproto\"]MTProto[/a] y la [a href=\"https://core.telegram.org/api\"]\nAPI de Telegram[/a] para velocidad y seguridad.\n\nSoftware bajo licencia [a href=\"https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\"]GNU GPL[/a] versión 3.\nCódigo fuente disponible en [a href=\"https://github.com/telegramdesktop/tdesktop\"]GitHub[/a].";
|
||||
"lng_about_done" = "Hecho";
|
||||
|
||||
"lng_search_found_results" = "{count:No se encontraron mensajes|Found # mensaje|Found # mensajes}";
|
||||
"lng_search_found_results" = "{count:No se encontraron mensajes|# mensaje encontrado|# mensajes encontrados}";
|
||||
"lng_search_global_results" = "Resultados de la búsqueda global";
|
||||
|
||||
"lng_media_save_progress" = "{ready} de {total} {mb}";
|
||||
|
@ -488,6 +488,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_report_spam" = "Segnala spam";
|
||||
"lng_report_spam_hide" = "Nascondi";
|
||||
"lng_report_spam_thanks" = "Grazie per la tua segnalazione!";
|
||||
"lng_report_spam_sure" = "Sei sicuro di voler segnalare\nquesto utente come spam?";
|
||||
"lng_report_spam_sure_group" = "Sei sicuro di voler segnalare\ndello spam in questo gruppo?";
|
||||
"lng_report_spam_ok" = "Segnala";
|
||||
"lng_cant_send_to_not_contact" = "Spiacenti, ma al momento puoi scrivere\nsolo a contatti in comune. {more_info}";
|
||||
"lng_cant_invite_not_contact" = "Spiacenti, ma al momento puoi aggiungere\nai gruppi solo a contatti in comune. {more_info}";
|
||||
"lng_cant_more_info" = "Più info »";
|
||||
|
@ -488,6 +488,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_report_spam" = "스팸 신고";
|
||||
"lng_report_spam_hide" = "숨기기";
|
||||
"lng_report_spam_thanks" = "신고해주셔서 감사합니다!";
|
||||
"lng_report_spam_sure" = "선택한 사용자 메사자를\n스팸으로 신고하겠습니까?";
|
||||
"lng_report_spam_sure_group" = "선택한 그룹 메시지를\n스팸으로 신고하시겠습니까?";
|
||||
"lng_report_spam_ok" = "신고하기";
|
||||
"lng_cant_send_to_not_contact" = "죄송하지만, 현재 서로 연락처가 추가된\n회원들끼리만 전송이 가능합니다. {more_info}";
|
||||
"lng_cant_invite_not_contact" = "죄송하지만, 현재 서로 연락처가 추가된\n회원들끼리만 추가 가능합니다. {more_info}";
|
||||
"lng_cant_more_info" = "자세한 정보 »";
|
||||
|
@ -488,6 +488,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_report_spam" = "Spam melden";
|
||||
"lng_report_spam_hide" = "Verbergen";
|
||||
"lng_report_spam_thanks" = "Bedankt voor je melding!";
|
||||
"lng_report_spam_sure" = "Spam van deze\ngebruiker echt melden? ";
|
||||
"lng_report_spam_sure_group" = "Spam van deze\ngroep echt melden? ";
|
||||
"lng_report_spam_ok" = "Melden";
|
||||
"lng_cant_send_to_not_contact" = "Op dit moment kun je alleen berichten\nversturen naar onderlinge contacten. {more_info}";
|
||||
"lng_cant_invite_not_contact" = "Op dit moment kun je alleen onderlinge\ncontacten aan groepen toevoegen. {more_info}";
|
||||
"lng_cant_more_info" = "Meer informatie »";
|
||||
|
@ -488,6 +488,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_report_spam" = "Reportar Spam";
|
||||
"lng_report_spam_hide" = "Ocultar";
|
||||
"lng_report_spam_thanks" = "Obrigado por reportar!";
|
||||
"lng_report_spam_sure" = "Tem certeza que deseja\nreportar spam deste usuário?";
|
||||
"lng_report_spam_sure_group" = "Tem certeza que seseja\nreportar por spam nesse grupo?";
|
||||
"lng_report_spam_ok" = "Reportar";
|
||||
"lng_cant_send_to_not_contact" = "Você só pode enviar mensagens para\ncontatos mútuos no momento. {more_info}";
|
||||
"lng_cant_invite_not_contact" = "Você só pode adicionar contatos\nmútuos ao grupo no momento. {more_info}";
|
||||
"lng_cant_more_info" = "Informações »";
|
||||
|
@ -1372,6 +1372,7 @@ void MainWidget::itemResized(HistoryItem *row, bool scrollToIt) {
|
||||
if (overview) {
|
||||
overview->itemResized(row, scrollToIt);
|
||||
}
|
||||
if (row) msgUpdated(row->history()->peer->id, row);
|
||||
}
|
||||
|
||||
bool MainWidget::overviewFailed(PeerData *peer, const RPCError &error, mtpRequestId req) {
|
||||
@ -2107,6 +2108,14 @@ void MainWidget::contactsReceived() {
|
||||
history.contactsReceived();
|
||||
}
|
||||
|
||||
void MainWidget::updateAfterDrag() {
|
||||
if (overview) {
|
||||
overview->updateAfterDrag();
|
||||
} else {
|
||||
history.updateAfterDrag();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool back) {
|
||||
if (!back && (!peerId || (_stack.size() == 1 && _stack[0]->type() == HistoryStackItem && _stack[0]->peer->id == peerId))) {
|
||||
back = true;
|
||||
@ -4120,6 +4129,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
if (ChannelData *channel = App::channelLoaded(d.vchannel_id.v)) {
|
||||
if (d.vgroup.type() == mtpc_messageGroup) {
|
||||
const MTPDmessageGroup &data(d.vgroup.c_messageGroup());
|
||||
// CHANNELS_FULL
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
@ -383,6 +383,7 @@ public:
|
||||
void ptsWaiterStartTimerFor(ChannelData *channel, int32 ms); // ms <= 0 - stop timer
|
||||
void handleUpdates(const MTPUpdates &updates, uint64 randomId = 0);
|
||||
void feedUpdate(const MTPUpdate &update);
|
||||
void updateAfterDrag();
|
||||
|
||||
~MainWidget();
|
||||
|
||||
|
@ -820,7 +820,7 @@ void OverviewInner::onDragExec() {
|
||||
}
|
||||
drag->setMimeData(mimeData);
|
||||
drag->exec(Qt::CopyAction);
|
||||
dragActionUpdate(QCursor::pos());
|
||||
if (App::main()) App::main()->updateAfterDrag();
|
||||
return;
|
||||
} else {
|
||||
HistoryItem *pressedLnkItem = App::pressedLinkItem(), *pressedItem = App::pressedItem();
|
||||
@ -847,7 +847,7 @@ void OverviewInner::onDragExec() {
|
||||
|
||||
drag->setMimeData(mimeData);
|
||||
drag->exec(Qt::CopyAction);
|
||||
dragActionUpdate(QCursor::pos());
|
||||
if (App::main()) App::main()->updateAfterDrag();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2855,6 +2855,10 @@ void OverviewWidget::updateScrollColors() {
|
||||
_scroll.updateColors(App::historyScrollBarColor(), App::historyScrollBgColor(), App::historyScrollBarOverColor(), App::historyScrollBgOverColor());
|
||||
}
|
||||
|
||||
void OverviewWidget::updateAfterDrag() {
|
||||
_inner.dragActionUpdate(QCursor::pos());
|
||||
}
|
||||
|
||||
OverviewWidget::~OverviewWidget() {
|
||||
onClearSelected();
|
||||
updateTopBarSelection();
|
||||
|
@ -312,6 +312,8 @@ public:
|
||||
|
||||
void updateScrollColors();
|
||||
|
||||
void updateAfterDrag();
|
||||
|
||||
~OverviewWidget();
|
||||
|
||||
public slots:
|
||||
|
@ -11,7 +11,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.8.56</string>
|
||||
<string>0.8.57</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
Binary file not shown.
@ -1697,7 +1697,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.8.56;
|
||||
CURRENT_PROJECT_VERSION = 0.8.57;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
@ -1715,7 +1715,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 0.8.56;
|
||||
CURRENT_PROJECT_VERSION = 0.8.57;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = fast;
|
||||
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
|
||||
@ -1741,10 +1741,10 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.8.56;
|
||||
CURRENT_PROJECT_VERSION = 0.8.57;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DYLIB_COMPATIBILITY_VERSION = 0.8;
|
||||
DYLIB_CURRENT_VERSION = 0.8.56;
|
||||
DYLIB_CURRENT_VERSION = 0.8.57;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
@ -1875,10 +1875,10 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.8.56;
|
||||
CURRENT_PROJECT_VERSION = 0.8.57;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DYLIB_COMPATIBILITY_VERSION = 0.8;
|
||||
DYLIB_CURRENT_VERSION = 0.8.56;
|
||||
DYLIB_CURRENT_VERSION = 0.8.57;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
|
@ -1,2 +1,2 @@
|
||||
echo 0.8 8056 0.8.56 0
|
||||
echo 0.8 8057 0.8.57 0
|
||||
# AppVersionStrMajor AppVersion AppVersionStr DevChannel
|
||||
|
@ -0,0 +1,285 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <qbackingstore.h>
|
||||
#include <qwindow.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qpa/qplatformbackingstore.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <qscreen.h>
|
||||
#include <qdebug.h>
|
||||
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <private/qwindow_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBackingStorePrivate
|
||||
{
|
||||
public:
|
||||
QBackingStorePrivate(QWindow *w)
|
||||
: window(w)
|
||||
{
|
||||
}
|
||||
|
||||
QWindow *window;
|
||||
QPlatformBackingStore *platformBackingStore;
|
||||
QRegion staticContents;
|
||||
QSize size;
|
||||
};
|
||||
|
||||
/*!
|
||||
\class QBackingStore
|
||||
\since 5.0
|
||||
\inmodule QtGui
|
||||
|
||||
\brief The QBackingStore class provides a drawing area for QWindow.
|
||||
|
||||
QBackingStore enables the use of QPainter to paint on a QWindow with type
|
||||
RasterSurface. The other way of rendering to a QWindow is through the use
|
||||
of OpenGL with QOpenGLContext.
|
||||
|
||||
A QBackingStore contains a buffered representation of the window contents,
|
||||
and thus supports partial updates by using QPainter to only update a sub
|
||||
region of the window contents.
|
||||
|
||||
QBackingStore might be used by an application that wants to use QPainter
|
||||
without OpenGL acceleration and without the extra overhead of using the
|
||||
QWidget or QGraphicsView UI stacks. For an example of how to use
|
||||
QBackingStore see the \l{Raster Window Example}.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Flushes the given \a region from the specified window \a win onto the
|
||||
screen.
|
||||
|
||||
Note that the \a offset parameter is currently unused.
|
||||
*/
|
||||
void QBackingStore::flush(const QRegion ®ion, QWindow *win, const QPoint &offset)
|
||||
{
|
||||
if (!win)
|
||||
win = window();
|
||||
if (!win->handle()) {
|
||||
qWarning() << "QBackingStore::flush() called for "
|
||||
<< win << " which does not have a handle.";
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef QBACKINGSTORE_DEBUG
|
||||
if (win && win->isTopLevel() && !qt_window_private(win)->receivedExpose) {
|
||||
qWarning().nospace() << "QBackingStore::flush() called with non-exposed window "
|
||||
<< win << ", behavior is undefined";
|
||||
}
|
||||
#endif
|
||||
|
||||
d_ptr->platformBackingStore->flush(win, region, offset);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QPaintDevice* QBackingStore::paintDevice()
|
||||
|
||||
Implement this function to return the appropriate paint device.
|
||||
*/
|
||||
QPaintDevice *QBackingStore::paintDevice()
|
||||
{
|
||||
return d_ptr->platformBackingStore->paintDevice();
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs an empty surface for the given top-level \a window.
|
||||
*/
|
||||
QBackingStore::QBackingStore(QWindow *window)
|
||||
: d_ptr(new QBackingStorePrivate(window))
|
||||
{
|
||||
d_ptr->platformBackingStore = QGuiApplicationPrivate::platformIntegration()->createPlatformBackingStore(window);
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys this surface.
|
||||
*/
|
||||
QBackingStore::~QBackingStore()
|
||||
{
|
||||
delete d_ptr->platformBackingStore;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a pointer to the top-level window associated with this
|
||||
surface.
|
||||
*/
|
||||
QWindow* QBackingStore::window() const
|
||||
{
|
||||
return d_ptr->window;
|
||||
}
|
||||
|
||||
/*!
|
||||
This function is called before painting onto the surface begins,
|
||||
with the \a region in which the painting will occur.
|
||||
|
||||
\sa endPaint(), paintDevice()
|
||||
*/
|
||||
|
||||
void QBackingStore::beginPaint(const QRegion ®ion)
|
||||
{
|
||||
d_ptr->platformBackingStore->beginPaint(region);
|
||||
}
|
||||
|
||||
void QBackingStore::beforeBeginPaint(QWindow *win)
|
||||
{
|
||||
if (!win)
|
||||
win = window();
|
||||
if (!win->handle())
|
||||
return;
|
||||
d_ptr->platformBackingStore->beforeBeginPaint(win);
|
||||
}
|
||||
|
||||
/*!
|
||||
This function is called after painting onto the surface has ended.
|
||||
|
||||
\sa beginPaint(), paintDevice()
|
||||
*/
|
||||
void QBackingStore::endPaint()
|
||||
{
|
||||
d_ptr->platformBackingStore->endPaint();
|
||||
}
|
||||
|
||||
void QBackingStore::afterEndPaint(QWindow *win)
|
||||
{
|
||||
if (!win)
|
||||
win = window();
|
||||
if (!win->handle())
|
||||
return;
|
||||
d_ptr->platformBackingStore->afterEndPaint(win);
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the size of the windowsurface to be \a size.
|
||||
|
||||
\sa size()
|
||||
*/
|
||||
void QBackingStore::resize(const QSize &size)
|
||||
{
|
||||
d_ptr->size = size;
|
||||
d_ptr->platformBackingStore->resize(size, d_ptr->staticContents);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the current size of the windowsurface.
|
||||
*/
|
||||
QSize QBackingStore::size() const
|
||||
{
|
||||
return d_ptr->size;
|
||||
}
|
||||
|
||||
/*!
|
||||
Scrolls the given \a area \a dx pixels to the right and \a dy
|
||||
downward; both \a dx and \a dy may be negative.
|
||||
|
||||
Returns \c true if the area was scrolled successfully; false otherwise.
|
||||
*/
|
||||
bool QBackingStore::scroll(const QRegion &area, int dx, int dy)
|
||||
{
|
||||
Q_UNUSED(area);
|
||||
Q_UNUSED(dx);
|
||||
Q_UNUSED(dy);
|
||||
|
||||
return d_ptr->platformBackingStore->scroll(area, dx, dy);
|
||||
}
|
||||
|
||||
void QBackingStore::setStaticContents(const QRegion ®ion)
|
||||
{
|
||||
d_ptr->staticContents = region;
|
||||
}
|
||||
|
||||
QRegion QBackingStore::staticContents() const
|
||||
{
|
||||
return d_ptr->staticContents;
|
||||
}
|
||||
|
||||
bool QBackingStore::hasStaticContents() const
|
||||
{
|
||||
return !d_ptr->staticContents.isEmpty();
|
||||
}
|
||||
|
||||
void Q_GUI_EXPORT qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
|
||||
{
|
||||
// make sure we don't detach
|
||||
uchar *mem = const_cast<uchar*>(const_cast<const QImage &>(img).bits());
|
||||
|
||||
int lineskip = img.bytesPerLine();
|
||||
int depth = img.depth() >> 3;
|
||||
|
||||
const QRect imageRect(0, 0, img.width(), img.height());
|
||||
const QRect r = rect & imageRect & imageRect.translated(-offset);
|
||||
const QPoint p = rect.topLeft() + offset;
|
||||
|
||||
if (r.isEmpty())
|
||||
return;
|
||||
|
||||
const uchar *src;
|
||||
uchar *dest;
|
||||
|
||||
if (r.top() < p.y()) {
|
||||
src = mem + r.bottom() * lineskip + r.left() * depth;
|
||||
dest = mem + (p.y() + r.height() - 1) * lineskip + p.x() * depth;
|
||||
lineskip = -lineskip;
|
||||
} else {
|
||||
src = mem + r.top() * lineskip + r.left() * depth;
|
||||
dest = mem + p.y() * lineskip + p.x() * depth;
|
||||
}
|
||||
|
||||
const int w = r.width();
|
||||
int h = r.height();
|
||||
const int bytes = w * depth;
|
||||
|
||||
// overlapping segments?
|
||||
if (offset.y() == 0 && qAbs(offset.x()) < w) {
|
||||
do {
|
||||
::memmove(dest, src, bytes);
|
||||
dest += lineskip;
|
||||
src += lineskip;
|
||||
} while (--h);
|
||||
} else {
|
||||
do {
|
||||
::memcpy(dest, src, bytes);
|
||||
dest += lineskip;
|
||||
src += lineskip;
|
||||
} while (--h);
|
||||
}
|
||||
}
|
||||
|
||||
QPlatformBackingStore *QBackingStore::handle() const
|
||||
{
|
||||
return d_ptr->platformBackingStore;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -0,0 +1,88 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBACKINGSTORE_H
|
||||
#define QBACKINGSTORE_H
|
||||
|
||||
#include <QtCore/qrect.h>
|
||||
|
||||
#include <QtGui/qwindow.h>
|
||||
#include <QtGui/qregion.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QRegion;
|
||||
class QRect;
|
||||
class QPoint;
|
||||
class QImage;
|
||||
class QBackingStorePrivate;
|
||||
class QPlatformBackingStore;
|
||||
|
||||
class Q_GUI_EXPORT QBackingStore
|
||||
{
|
||||
public:
|
||||
explicit QBackingStore(QWindow *window);
|
||||
~QBackingStore();
|
||||
|
||||
QWindow *window() const;
|
||||
|
||||
QPaintDevice *paintDevice();
|
||||
|
||||
// 'window' can be a child window, in which case 'region' is in child window coordinates and
|
||||
// offset is the (child) window's offset in relation to the window surface.
|
||||
void flush(const QRegion ®ion, QWindow *window = 0, const QPoint &offset = QPoint());
|
||||
|
||||
void resize(const QSize &size);
|
||||
QSize size() const;
|
||||
|
||||
bool scroll(const QRegion &area, int dx, int dy);
|
||||
|
||||
void beginPaint(const QRegion &);
|
||||
void beforeBeginPaint(QWindow *window);
|
||||
void endPaint();
|
||||
void afterEndPaint(QWindow *window);
|
||||
|
||||
void setStaticContents(const QRegion ®ion);
|
||||
QRegion staticContents() const;
|
||||
bool hasStaticContents() const;
|
||||
|
||||
QPlatformBackingStore *handle() const;
|
||||
|
||||
private:
|
||||
QScopedPointer<QBackingStorePrivate> d_ptr;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBACKINGSTORE_H
|
@ -0,0 +1,150 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QPLATFORMBACKINGSTORE_H
|
||||
#define QPLATFORMBACKINGSTORE_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is part of the QPA API and is not meant to be used
|
||||
// in applications. Usage of this API may make your code
|
||||
// source and binary incompatible with future versions of Qt.
|
||||
//
|
||||
|
||||
#include <QtCore/qrect.h>
|
||||
#include <QtCore/qobject.h>
|
||||
|
||||
#include <QtGui/qwindow.h>
|
||||
#include <QtGui/qregion.h>
|
||||
#include <QtGui/qopengl.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QRegion;
|
||||
class QRect;
|
||||
class QPoint;
|
||||
class QImage;
|
||||
class QPlatformBackingStorePrivate;
|
||||
class QPlatformWindow;
|
||||
class QPlatformTextureList;
|
||||
class QPlatformTextureListPrivate;
|
||||
class QOpenGLContext;
|
||||
class QPlatformGraphicsBuffer;
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
class Q_GUI_EXPORT QPlatformTextureList : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QPlatformTextureList)
|
||||
public:
|
||||
enum Flag {
|
||||
StacksOnTop = 0x01
|
||||
};
|
||||
Q_DECLARE_FLAGS(Flags, Flag)
|
||||
|
||||
explicit QPlatformTextureList(QObject *parent = 0);
|
||||
~QPlatformTextureList();
|
||||
|
||||
int count() const;
|
||||
bool isEmpty() const { return count() == 0; }
|
||||
GLuint textureId(int index) const;
|
||||
QRect geometry(int index) const;
|
||||
QRect clipRect(int index) const;
|
||||
void *source(int index);
|
||||
Flags flags(int index) const;
|
||||
void lock(bool on);
|
||||
bool isLocked() const;
|
||||
|
||||
void appendTexture(void *source, GLuint textureId, const QRect &geometry,
|
||||
const QRect &clipRect = QRect(), Flags flags = 0);
|
||||
void clear();
|
||||
|
||||
Q_SIGNALS:
|
||||
void locked(bool);
|
||||
};
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformTextureList::Flags)
|
||||
#endif
|
||||
|
||||
class Q_GUI_EXPORT QPlatformBackingStore
|
||||
{
|
||||
public:
|
||||
explicit QPlatformBackingStore(QWindow *window);
|
||||
virtual ~QPlatformBackingStore();
|
||||
|
||||
QWindow *window() const;
|
||||
|
||||
virtual QPaintDevice *paintDevice() = 0;
|
||||
|
||||
// 'window' can be a child window, in which case 'region' is in child window coordinates and
|
||||
// offset is the (child) window's offset in relation to the window surface.
|
||||
virtual void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) = 0;
|
||||
#ifndef QT_NO_OPENGL
|
||||
virtual void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset,
|
||||
QPlatformTextureList *textures, QOpenGLContext *context,
|
||||
bool translucentBackground);
|
||||
virtual QImage toImage() const;
|
||||
enum TextureFlag {
|
||||
TextureSwizzle = 0x01,
|
||||
TextureFlip = 0x02
|
||||
};
|
||||
Q_DECLARE_FLAGS(TextureFlags, TextureFlag)
|
||||
virtual GLuint toTexture(const QRegion &dirtyRegion, QSize *textureSize, TextureFlags *flags) const;
|
||||
#endif
|
||||
|
||||
virtual QPlatformGraphicsBuffer *graphicsBuffer() const;
|
||||
|
||||
virtual void resize(const QSize &size, const QRegion &staticContents) = 0;
|
||||
|
||||
virtual bool scroll(const QRegion &area, int dx, int dy);
|
||||
|
||||
virtual void beginPaint(const QRegion &);
|
||||
virtual void beforeBeginPaint(QWindow *window) {
|
||||
}
|
||||
virtual void endPaint();
|
||||
virtual void afterEndPaint(QWindow *window) {
|
||||
}
|
||||
|
||||
private:
|
||||
QPlatformBackingStorePrivate *d_ptr;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformBackingStore::TextureFlags)
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QPLATFORMBACKINGSTORE_H
|
@ -0,0 +1,70 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBACKINGSTORE_COCOA_H
|
||||
#define QBACKINGSTORE_COCOA_H
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
#include "qcocoawindow.h"
|
||||
#include "qnsview.h"
|
||||
|
||||
#include <qpa/qplatformbackingstore.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QCocoaBackingStore : public QPlatformBackingStore
|
||||
{
|
||||
public:
|
||||
QCocoaBackingStore(QWindow *window);
|
||||
~QCocoaBackingStore();
|
||||
|
||||
QPaintDevice *paintDevice();
|
||||
void flush(QWindow *widget, const QRegion ®ion, const QPoint &offset);
|
||||
QImage toImage() const;
|
||||
void resize (const QSize &size, const QRegion &);
|
||||
bool scroll(const QRegion &area, int dx, int dy);
|
||||
void beginPaint(const QRegion ®ion);
|
||||
void beforeBeginPaint(QWindow *widget);
|
||||
void afterEndPaint(QWindow *widget);
|
||||
qreal getBackingStoreDevicePixelRatio();
|
||||
|
||||
private:
|
||||
QImage m_qImage;
|
||||
QSize m_requestedSize;
|
||||
bool m_imageWasEqual;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
@ -0,0 +1,136 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qcocoabackingstore.h"
|
||||
#include <QtGui/QPainter>
|
||||
#include "qcocoahelpers.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QCocoaBackingStore::QCocoaBackingStore(QWindow *window)
|
||||
: QPlatformBackingStore(window), m_imageWasEqual(false)
|
||||
{
|
||||
}
|
||||
|
||||
QCocoaBackingStore::~QCocoaBackingStore()
|
||||
{
|
||||
}
|
||||
|
||||
QPaintDevice *QCocoaBackingStore::paintDevice()
|
||||
{
|
||||
QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window()->handle());
|
||||
int windowDevicePixelRatio = int(cocoaWindow->devicePixelRatio());
|
||||
|
||||
// Receate the backing store buffer if the effective buffer size has changed,
|
||||
// either due to a window resize or devicePixelRatio change.
|
||||
QSize effectiveBufferSize = m_requestedSize * windowDevicePixelRatio;
|
||||
if (m_qImage.size() != effectiveBufferSize) {
|
||||
QImage::Format format = (window()->format().hasAlpha() || cocoaWindow->m_drawContentBorderGradient)
|
||||
? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
|
||||
m_qImage = QImage(effectiveBufferSize, format);
|
||||
m_qImage.setDevicePixelRatio(windowDevicePixelRatio);
|
||||
if (format == QImage::Format_ARGB32_Premultiplied)
|
||||
m_qImage.fill(Qt::transparent);
|
||||
}
|
||||
return &m_qImage;
|
||||
}
|
||||
|
||||
void QCocoaBackingStore::flush(QWindow *win, const QRegion ®ion, const QPoint &offset)
|
||||
{
|
||||
if (!m_qImage.isNull()) {
|
||||
if (QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(win->handle()))
|
||||
[cocoaWindow->m_qtView flushBackingStore:this region:region offset:offset];
|
||||
}
|
||||
}
|
||||
|
||||
QImage QCocoaBackingStore::toImage() const
|
||||
{
|
||||
return m_qImage;
|
||||
}
|
||||
|
||||
void QCocoaBackingStore::resize(const QSize &size, const QRegion &)
|
||||
{
|
||||
m_requestedSize = size;
|
||||
}
|
||||
|
||||
bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy)
|
||||
{
|
||||
extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);
|
||||
const qreal devicePixelRatio = m_qImage.devicePixelRatio();
|
||||
QPoint qpoint(dx * devicePixelRatio, dy * devicePixelRatio);
|
||||
const QVector<QRect> qrects = area.rects();
|
||||
for (int i = 0; i < qrects.count(); ++i) {
|
||||
const QRect &qrect = QRect(qrects.at(i).topLeft() * devicePixelRatio, qrects.at(i).size() * devicePixelRatio);
|
||||
qt_scrollRectInImage(m_qImage, qrect, qpoint);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void QCocoaBackingStore::beginPaint(const QRegion ®ion)
|
||||
{
|
||||
if (m_qImage.hasAlphaChannel()) {
|
||||
QPainter p(&m_qImage);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
const QVector<QRect> rects = region.rects();
|
||||
const QColor blank = Qt::transparent;
|
||||
for (QVector<QRect>::const_iterator it = rects.begin(), end = rects.end(); it != end; ++it)
|
||||
p.fillRect(*it, blank);
|
||||
}
|
||||
}
|
||||
|
||||
void QCocoaBackingStore::beforeBeginPaint(QWindow *win) {
|
||||
m_imageWasEqual = false;
|
||||
if (!m_qImage.isNull()) {
|
||||
if (QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(win->handle())) {
|
||||
if ([cocoaWindow->m_qtView beforeBeginPaint:this])
|
||||
m_imageWasEqual = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QCocoaBackingStore::afterEndPaint(QWindow *win) {
|
||||
if (!m_qImage.isNull()) {
|
||||
if (QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(win->handle())) {
|
||||
if (m_imageWasEqual)
|
||||
[cocoaWindow->m_qtView afterEndPaint:this];
|
||||
}
|
||||
}
|
||||
m_imageWasEqual = false;
|
||||
}
|
||||
|
||||
qreal QCocoaBackingStore::getBackingStoreDevicePixelRatio()
|
||||
{
|
||||
return m_qImage.devicePixelRatio();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -0,0 +1,145 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNSVIEW_H
|
||||
#define QNSVIEW_H
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtGui/QImage>
|
||||
#include <QtGui/QAccessible>
|
||||
|
||||
#include "private/qcore_mac_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCocoaWindow;
|
||||
class QCocoaBackingStore;
|
||||
class QCocoaGLContext;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
|
||||
|
||||
@interface QT_MANGLE_NAMESPACE(QNSView) : NSView <NSTextInputClient> {
|
||||
QImage m_backingStore;
|
||||
qreal m_pixelRatio;
|
||||
QPoint m_backingStoreOffset;
|
||||
CGImageRef m_maskImage;
|
||||
uchar *m_maskData;
|
||||
bool m_shouldInvalidateWindowShadow;
|
||||
QWindow *m_window;
|
||||
QCocoaWindow *m_platformWindow;
|
||||
NSTrackingArea *m_trackingArea;
|
||||
Qt::MouseButtons m_buttons;
|
||||
Qt::MouseButtons m_frameStrutButtons;
|
||||
QString m_composingText;
|
||||
bool m_sendKeyEvent;
|
||||
QStringList *currentCustomDragTypes;
|
||||
bool m_sendUpAsRightButton;
|
||||
Qt::KeyboardModifiers currentWheelModifiers;
|
||||
bool m_subscribesForGlobalFrameNotifications;
|
||||
#ifndef QT_NO_OPENGL
|
||||
QCocoaGLContext *m_glContext;
|
||||
bool m_shouldSetGLContextinDrawRect;
|
||||
#endif
|
||||
NSString *m_inputSource;
|
||||
QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) *m_mouseMoveHelper;
|
||||
bool m_resendKeyEvent;
|
||||
bool m_scrolling;
|
||||
bool m_exposedOnMoveToWindow;
|
||||
}
|
||||
|
||||
- (id)init;
|
||||
- (id)initWithQWindow:(QWindow *)window platformWindow:(QCocoaWindow *) platformWindow;
|
||||
- (void) clearQWindowPointers;
|
||||
#ifndef QT_NO_OPENGL
|
||||
- (void)setQCocoaGLContext:(QCocoaGLContext *)context;
|
||||
#endif
|
||||
- (void)flushBackingStore:(QCocoaBackingStore *)backingStore region:(const QRegion &)region offset:(QPoint)offset;
|
||||
- (BOOL)beforeBeginPaint:(QCocoaBackingStore *)backingStore;
|
||||
- (void)afterEndPaint:(QCocoaBackingStore *)backingStore;
|
||||
- (void)setMaskRegion:(const QRegion *)region;
|
||||
- (void)invalidateWindowShadowIfNeeded;
|
||||
- (void)drawRect:(NSRect)dirtyRect;
|
||||
- (void)updateGeometry;
|
||||
- (void)notifyWindowStateChanged:(Qt::WindowState)newState;
|
||||
- (void)windowNotification : (NSNotification *) windowNotification;
|
||||
- (void)notifyWindowWillZoom:(BOOL)willZoom;
|
||||
- (void)viewDidHide;
|
||||
- (void)viewDidUnhide;
|
||||
|
||||
- (BOOL)isFlipped;
|
||||
- (BOOL)acceptsFirstResponder;
|
||||
- (BOOL)becomeFirstResponder;
|
||||
- (BOOL)hasMask;
|
||||
- (BOOL)isOpaque;
|
||||
|
||||
- (void)convertFromScreen:(NSPoint)mouseLocation toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint;
|
||||
|
||||
- (void)resetMouseButtons;
|
||||
|
||||
- (void)handleMouseEvent:(NSEvent *)theEvent;
|
||||
- (void)mouseDown:(NSEvent *)theEvent;
|
||||
- (void)mouseDragged:(NSEvent *)theEvent;
|
||||
- (void)mouseUp:(NSEvent *)theEvent;
|
||||
- (void)mouseMovedImpl:(NSEvent *)theEvent;
|
||||
- (void)mouseEnteredImpl:(NSEvent *)theEvent;
|
||||
- (void)mouseExitedImpl:(NSEvent *)theEvent;
|
||||
- (void)cursorUpdateImpl:(NSEvent *)theEvent;
|
||||
- (void)rightMouseDown:(NSEvent *)theEvent;
|
||||
- (void)rightMouseDragged:(NSEvent *)theEvent;
|
||||
- (void)rightMouseUp:(NSEvent *)theEvent;
|
||||
- (void)otherMouseDown:(NSEvent *)theEvent;
|
||||
- (void)otherMouseDragged:(NSEvent *)theEvent;
|
||||
- (void)otherMouseUp:(NSEvent *)theEvent;
|
||||
- (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent;
|
||||
|
||||
- (void)handleTabletEvent: (NSEvent *)theEvent;
|
||||
- (void)tabletPoint: (NSEvent *)theEvent;
|
||||
- (void)tabletProximity: (NSEvent *)theEvent;
|
||||
|
||||
- (int) convertKeyCode : (QChar)keyCode;
|
||||
+ (Qt::KeyboardModifiers) convertKeyModifiers : (ulong)modifierFlags;
|
||||
- (void)handleKeyEvent:(NSEvent *)theEvent eventType:(int)eventType;
|
||||
- (void)keyDown:(NSEvent *)theEvent;
|
||||
- (void)keyUp:(NSEvent *)theEvent;
|
||||
- (BOOL)performKeyEquivalent:(NSEvent *)theEvent;
|
||||
|
||||
- (void)registerDragTypes;
|
||||
- (NSDragOperation)handleDrag:(id <NSDraggingInfo>)sender;
|
||||
|
||||
@end
|
||||
|
||||
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSView);
|
||||
|
||||
#endif //QNSVIEW_H
|
@ -484,6 +484,20 @@ QT_WARNING_POP
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) beforeBeginPaint:(QCocoaBackingStore *)backingStore
|
||||
{
|
||||
if (!m_backingStore.isNull() && m_backingStore.constBits() == backingStore->toImage().constBits()) {
|
||||
m_backingStore = QImage();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
- (void) afterEndPaint:(QCocoaBackingStore *)backingStore
|
||||
{
|
||||
m_backingStore = backingStore->toImage();
|
||||
}
|
||||
|
||||
- (BOOL) hasMask
|
||||
{
|
||||
return m_maskImage != 0;
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user