Version 0.10.9: langs updated, moved shadow icons to separate files.
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 89 KiB |
@ -68,7 +68,7 @@ semiboldButtonBlueText: #2b99d5;
|
||||
wndMinHeight: 480px;
|
||||
wndDefWidth: 800px;
|
||||
wndDefHeight: 600px;
|
||||
wndShadow: sprite(209px, 46px, 19px, 19px);
|
||||
wndShadow: icon {{ "window_shadow", windowShadowFg }};
|
||||
wndShadowShift: 1px;
|
||||
|
||||
layerAlpha: 0.5;
|
||||
@ -298,10 +298,11 @@ solidScroll: flatScroll {
|
||||
duration: 150;
|
||||
hiding: 0;
|
||||
}
|
||||
defaultDropdownShadow: icon {{ "dropdown_shadow", windowShadowFg }};
|
||||
defaultPopupMenu: PopupMenu {
|
||||
skip: 5px;
|
||||
|
||||
shadow: sprite(241px, 46px, 6px, 6px);
|
||||
shadow: defaultDropdownShadow;
|
||||
shadowShift: 1px;
|
||||
|
||||
itemBg: white;
|
||||
@ -320,7 +321,7 @@ defaultPopupMenu: PopupMenu {
|
||||
separatorWidth: 1px;
|
||||
separatorFg: #f1f1f1;
|
||||
|
||||
arrow: sprite(0px, 126px, 4px, 7px);
|
||||
arrow: icon {{ "dropdown_submenu_arrow", #373737 }};
|
||||
|
||||
duration: 120;
|
||||
|
||||
@ -687,7 +688,7 @@ btnIntroNext: flatButton(btnDefNext, btnDefBig) {
|
||||
radius: buttonRadius;
|
||||
}
|
||||
|
||||
boxShadow: sprite(363px, 50px, 15px, 15px);
|
||||
boxShadow: icon {{ "box_shadow", windowShadowFg }};
|
||||
boxShadowShift: 2px;
|
||||
|
||||
introCountry: countryInput {
|
||||
@ -1211,12 +1212,12 @@ btnBotKbHide: iconedButton(btnAttachEmoji) {
|
||||
downIcon: sprite(373px, 95px, 23px, 14px);
|
||||
downIconPos: point(5px, 17px);
|
||||
}
|
||||
broadcastToggle: flatCheckbox {
|
||||
silentToggle: flatCheckbox {
|
||||
textColor: black;
|
||||
bgColor: white;
|
||||
disColor: black;
|
||||
|
||||
width: 34px;
|
||||
width: 33px;
|
||||
height: 46px;
|
||||
duration: 200;
|
||||
bgFunc: transition(easeOutCirc);
|
||||
@ -1224,24 +1225,14 @@ broadcastToggle: flatCheckbox {
|
||||
|
||||
font: normalFont;
|
||||
|
||||
imageRect: sprite(18px, 125px, 22px, 21px);
|
||||
chkImageRect: sprite(40px, 125px, 22px, 21px);
|
||||
overImageRect: sprite(40px, 104px, 22px, 21px);
|
||||
chkOverImageRect: sprite(40px, 125px, 22px, 21px);
|
||||
disImageRect: sprite(18px, 125px, 22px, 21px);
|
||||
chkDisImageRect: sprite(18px, 125px, 22px, 21px);
|
||||
|
||||
imagePos: point(6px, 12px);
|
||||
}
|
||||
silentToggle: flatCheckbox(broadcastToggle) {
|
||||
width: 33px;
|
||||
|
||||
imageRect: sprite(354px, 242px, 21px, 21px);
|
||||
chkImageRect: sprite(354px, 221px, 21px, 21px);
|
||||
overImageRect: sprite(375px, 242px, 21px, 21px);
|
||||
chkOverImageRect: sprite(375px, 221px, 21px, 21px);
|
||||
disImageRect: sprite(354px, 242px, 21px, 21px);
|
||||
chkDisImageRect: sprite(354px, 221px, 21px, 21px);
|
||||
|
||||
imagePos: point(6px, 12px);
|
||||
}
|
||||
btnRecordAudio: sprite(379px, 390px, 16px, 24px);
|
||||
btnRecordAudioActive: sprite(379px, 366px, 16px, 24px);
|
||||
@ -1538,17 +1529,15 @@ dropdownDef: dropdown {
|
||||
borderColor: #ebebeb;
|
||||
|
||||
padding: margins(10px, 10px, 10px, 10px);
|
||||
shadow: sprite(241px, 46px, 6px, 6px);
|
||||
shadow: defaultDropdownShadow;
|
||||
shadowShift: 1px;
|
||||
|
||||
duration: 150;
|
||||
width: 0px;
|
||||
}
|
||||
|
||||
defaultInnerDropdownShadow: icon {{ "dropdown_shadow", windowShadowFg }};
|
||||
defaultInnerDropdown: InnerDropdown {
|
||||
padding: margins(10px, 10px, 10px, 10px);
|
||||
shadow: defaultInnerDropdownShadow;
|
||||
shadow: defaultDropdownShadow;
|
||||
shadowShift: 1px;
|
||||
|
||||
duration: 150;
|
||||
@ -1838,7 +1827,7 @@ mvControlSize: 90px;
|
||||
mvIconSize: size(60px, 56px);
|
||||
|
||||
mvDropdown: dropdown(dropdownDef) {
|
||||
shadow: sprite(0px, 0px, 0px, 0px);
|
||||
shadow: icon {};
|
||||
padding: margins(11px, 12px, 11px, 12px);
|
||||
|
||||
border: 0px;
|
||||
@ -1863,7 +1852,7 @@ mvButton: iconedButton(btnDefIconed) {
|
||||
duration: 0;
|
||||
}
|
||||
mvPopupMenu: PopupMenu(defaultPopupMenu) {
|
||||
shadow: sprite(0px, 0px, 0px, 0px);
|
||||
shadow: icon {};
|
||||
|
||||
itemBg: #383838;
|
||||
itemBgOver: #505050;
|
||||
|
@ -233,7 +233,7 @@ dropdown {
|
||||
borderColor: color;
|
||||
|
||||
padding: margins;
|
||||
shadow: sprite;
|
||||
shadow: icon;
|
||||
shadowShift: pixels;
|
||||
|
||||
duration: int;
|
||||
@ -255,7 +255,7 @@ InnerDropdown {
|
||||
PopupMenu {
|
||||
skip: pixels;
|
||||
|
||||
shadow: sprite;
|
||||
shadow: icon;
|
||||
shadowShift: pixels;
|
||||
|
||||
itemBg: color;
|
||||
@ -273,7 +273,7 @@ PopupMenu {
|
||||
separatorWidth: pixels;
|
||||
separatorFg: color;
|
||||
|
||||
arrow: sprite;
|
||||
arrow: icon;
|
||||
|
||||
duration: int;
|
||||
|
||||
|
BIN
Telegram/Resources/icons/box_shadow.png
Normal file
After Width: | Height: | Size: 190 B |
BIN
Telegram/Resources/icons/box_shadow@2x.png
Normal file
After Width: | Height: | Size: 294 B |
BIN
Telegram/Resources/icons/dropdown_submenu_arrow.png
Normal file
After Width: | Height: | Size: 119 B |
BIN
Telegram/Resources/icons/dropdown_submenu_arrow@2x.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
Telegram/Resources/icons/window_shadow.png
Normal file
After Width: | Height: | Size: 225 B |
BIN
Telegram/Resources/icons/window_shadow@2x.png
Normal file
After Width: | Height: | Size: 372 B |
@ -772,12 +772,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
"lng_allow_bot" = "허용";
|
||||
|
||||
"lng_bot_start" = "시작";
|
||||
"lng_bot_choose_group" = "Select a Group";
|
||||
"lng_bot_choose_group" = "그룹방 선택";
|
||||
"lng_bot_no_groups" = "그룹이 존재하지 않습니다.";
|
||||
"lng_bot_groups_not_found" = "그룹을 찾을 수 없습니다.";
|
||||
"lng_bot_sure_invite" = "<<{group}>>에 봇을 추가 하시겠습니까?";
|
||||
"lng_bot_already_in_group" = "봇이 이미 그룹의 멤버입니다.";
|
||||
"lng_bot_choose_chat" = "Select a Chat";
|
||||
"lng_bot_choose_chat" = "채팅방 선택";
|
||||
"lng_bot_no_chats" = "채팅방이 없습니다.";
|
||||
"lng_bot_chats_not_found" = "채팅방을 찾 을 수 없음";
|
||||
"lng_bot_sure_share_game" = "{user}에게 게임을 공유하겠습니까?";
|
||||
@ -787,10 +787,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
"lng_user_typing" = "{user}님이 입력중입니다.";
|
||||
"lng_users_typing" = "{user}님과 {second_user}님이 입력중입니다.";
|
||||
"lng_many_typing" = "{count:_not_used_|#명이|#명이} 입력중입니다";
|
||||
"lng_playing_game" = "playing a game";
|
||||
"lng_user_playing_game" = "{user} is playing a game";
|
||||
"lng_users_playing_game" = "{user} and {second_user} are playing a game";
|
||||
"lng_many_playing_game" = "{count:_not_used_|# is|# are} playing a game";
|
||||
"lng_playing_game" = "게임 중";
|
||||
"lng_user_playing_game" = "{user}님이 게임 중입니다.";
|
||||
"lng_users_playing_game" = "{user}님과 {second_user}님이 게임 중입니다.";
|
||||
"lng_many_playing_game" = "{count:_not_used_|#명이|#명이} 게임 중입니다";
|
||||
"lng_send_action_record_video" = "비디오 녹화 중";
|
||||
"lng_user_action_record_video" = "{user}님이 녹화중입니다";
|
||||
"lng_send_action_upload_video" = "비디오 전송 중";
|
||||
|
@ -28,6 +28,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "lang.h"
|
||||
#include "boxes/confirmbox.h"
|
||||
#include "ui/filedialog.h"
|
||||
#include "ui/popupmenu.h"
|
||||
#include "langloaderplain.h"
|
||||
#include "localstorage.h"
|
||||
#include "autoupdater.h"
|
||||
|
@ -160,7 +160,7 @@ void AbstractBox::resizeMaxHeight(int32 newWidth, int32 maxHeight) {
|
||||
move(r.left(), newTop);
|
||||
}
|
||||
}
|
||||
parentWidget()->update(geometry().united(g).marginsAdded(QMargins(st::boxShadow.pxWidth(), st::boxShadow.pxHeight(), st::boxShadow.pxWidth(), st::boxShadow.pxHeight())));
|
||||
parentWidget()->update(geometry().united(g).marginsAdded(QMargins(st::boxShadow.width(), st::boxShadow.height(), st::boxShadow.width(), st::boxShadow.height())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ private:
|
||||
int _dragging = -1;
|
||||
int _above = -1;
|
||||
|
||||
BoxShadow _aboveShadow;
|
||||
Ui::RectShadow _aboveShadow;
|
||||
|
||||
int32 _scrollbar = 0;
|
||||
};
|
||||
|
@ -769,10 +769,6 @@ structure::Value ParsedFile::readIconValue() {
|
||||
}
|
||||
}
|
||||
|
||||
if (parts.empty()) {
|
||||
logErrorUnexpectedToken() << "at least one icon part";
|
||||
return {};
|
||||
}
|
||||
return { structure::data::icon { parts } };
|
||||
}
|
||||
file_.putBack();
|
||||
|
@ -27,6 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "core/qthelp_regex.h"
|
||||
#include "core/qthelp_url.h"
|
||||
#include "localstorage.h"
|
||||
#include "ui/popupmenu.h"
|
||||
|
||||
QString UrlClickHandler::copyToClipboardContextItemText() const {
|
||||
return lang(isEmail() ? lng_context_copy_email : lng_context_copy_link);
|
||||
|
@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "dialogs/dialogs_layout.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "ui/buttons/round_button.h"
|
||||
#include "ui/popupmenu.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "lang.h"
|
||||
#include "application.h"
|
||||
|
@ -22,7 +22,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
|
||||
#include "window/section_widget.h"
|
||||
|
||||
class MainWidget;
|
||||
namespace Dialogs {
|
||||
class Row;
|
||||
class FakeRow;
|
||||
@ -33,6 +32,9 @@ namespace Ui {
|
||||
class RoundButton;
|
||||
} // namespace Ui
|
||||
|
||||
class MainWidget;
|
||||
class PopupMenu;
|
||||
|
||||
enum DialogsSearchRequestType {
|
||||
DialogsSearchFromStart,
|
||||
DialogsSearchFromOffset,
|
||||
|
@ -122,7 +122,7 @@ void Dropdown::resizeEvent(QResizeEvent *e) {
|
||||
}
|
||||
|
||||
void Dropdown::paintEvent(QPaintEvent *e) {
|
||||
QPainter p(this);
|
||||
Painter p(this);
|
||||
|
||||
if (_a_appearance.animating()) {
|
||||
p.setOpacity(a_opacity.current());
|
||||
@ -358,7 +358,7 @@ void DragArea::setText(const QString &text, const QString &subtext) {
|
||||
}
|
||||
|
||||
void DragArea::paintEvent(QPaintEvent *e) {
|
||||
QPainter p(this);
|
||||
Painter p(this);
|
||||
|
||||
if (_a_appearance.animating()) {
|
||||
p.setOpacity(a_opacity.current());
|
||||
|
@ -21,7 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#pragma once
|
||||
|
||||
#include "ui/twidget.h"
|
||||
#include "ui/boxshadow.h"
|
||||
#include "ui/effects/rect_shadow.h"
|
||||
|
||||
class Dropdown : public TWidget {
|
||||
Q_OBJECT
|
||||
@ -91,7 +91,7 @@ private:
|
||||
|
||||
QTimer _hideTimer;
|
||||
|
||||
BoxShadow _shadow;
|
||||
Ui::RectShadow _shadow;
|
||||
|
||||
};
|
||||
|
||||
@ -101,13 +101,6 @@ class DragArea : public TWidget {
|
||||
public:
|
||||
DragArea(QWidget *parent);
|
||||
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void dragEnterEvent(QDragEnterEvent *e);
|
||||
void dragLeaveEvent(QDragLeaveEvent *e);
|
||||
void dropEvent(QDropEvent *e);
|
||||
void dragMoveEvent(QDragMoveEvent *e);
|
||||
|
||||
void setText(const QString &text, const QString &subtext);
|
||||
|
||||
void otherEnter();
|
||||
@ -127,6 +120,14 @@ public:
|
||||
).contains(QRect(mapFromGlobal(globalRect.topLeft()), globalRect.size()));
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void mouseMoveEvent(QMouseEvent *e) override;
|
||||
void dragEnterEvent(QDragEnterEvent *e) override;
|
||||
void dragLeaveEvent(QDragLeaveEvent *e) override;
|
||||
void dropEvent(QDropEvent *e) override;
|
||||
void dragMoveEvent(QDragMoveEvent *e) override;
|
||||
|
||||
signals:
|
||||
void dropped(const QMimeData *data);
|
||||
|
||||
@ -143,7 +144,7 @@ private:
|
||||
anim::cvalue a_color;
|
||||
Animation _a_appearance;
|
||||
|
||||
BoxShadow _shadow;
|
||||
Ui::RectShadow _shadow;
|
||||
|
||||
QString _text, _subtext;
|
||||
|
||||
|
@ -28,13 +28,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
FieldAutocomplete::FieldAutocomplete(QWidget *parent) : TWidget(parent)
|
||||
, _scroll(this, st::mentionScroll)
|
||||
, _inner(this, &_mrows, &_hrows, &_brows, &_srows)
|
||||
, _chat(0)
|
||||
, _user(0)
|
||||
, _channel(0)
|
||||
, _hiding(false)
|
||||
, a_opacity(0)
|
||||
, _a_appearance(animation(this, &FieldAutocomplete::step_appearance))
|
||||
, _shadow(st::dropdownDef.shadow) {
|
||||
, _a_appearance(animation(this, &FieldAutocomplete::step_appearance)) {
|
||||
_hideTimer.setSingleShot(true);
|
||||
connect(&_hideTimer, SIGNAL(timeout()), this, SLOT(hideStart()));
|
||||
|
||||
|
@ -21,7 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#pragma once
|
||||
|
||||
#include "ui/twidget.h"
|
||||
#include "ui/boxshadow.h"
|
||||
#include "ui/effects/rect_shadow.h"
|
||||
|
||||
namespace internal {
|
||||
|
||||
@ -91,9 +91,10 @@ public slots:
|
||||
|
||||
void showStart();
|
||||
|
||||
private:
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
private:
|
||||
void updateFiltered(bool resetScroll = false);
|
||||
void recount(bool resetScroll = false);
|
||||
|
||||
@ -108,9 +109,9 @@ private:
|
||||
ChildWidget<ScrollArea> _scroll;
|
||||
ChildWidget<internal::FieldAutocompleteInner> _inner;
|
||||
|
||||
ChatData *_chat;
|
||||
UserData *_user;
|
||||
ChannelData *_channel;
|
||||
ChatData *_chat = nullptr;
|
||||
UserData *_user = nullptr;
|
||||
ChannelData *_channel = nullptr;
|
||||
EmojiPtr _emoji;
|
||||
enum class Type {
|
||||
Mentions,
|
||||
@ -124,14 +125,13 @@ private:
|
||||
bool _addInlineBots;
|
||||
|
||||
int32 _width, _height;
|
||||
bool _hiding;
|
||||
bool _hiding = false;
|
||||
|
||||
anim::fvalue a_opacity;
|
||||
Animation _a_appearance;
|
||||
|
||||
QTimer _hideTimer;
|
||||
|
||||
BoxShadow _shadow;
|
||||
friend class internal::FieldAutocompleteInner;
|
||||
|
||||
};
|
||||
|
@ -2638,85 +2638,53 @@ void BotKeyboard::updateSelected() {
|
||||
}
|
||||
|
||||
HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : TWidget(parent)
|
||||
, _sharedContact(0)
|
||||
, _forwardSelected(forwardSelected)
|
||||
, _sendPath(false)
|
||||
, _send(this, lang(lng_forward_send), st::defaultBoxButton)
|
||||
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||
, offered(0)
|
||||
, a_opacity(0, 1)
|
||||
, _a_appearance(animation(this, &HistoryHider::step_appearance))
|
||||
, hiding(false)
|
||||
, _forwardRequest(0)
|
||||
, toTextWidth(0)
|
||||
, shadow(st::boxShadow) {
|
||||
, _shadow(st::boxShadow) {
|
||||
init();
|
||||
}
|
||||
|
||||
HistoryHider::HistoryHider(MainWidget *parent, UserData *sharedContact) : TWidget(parent)
|
||||
, _sharedContact(sharedContact)
|
||||
, _forwardSelected(false)
|
||||
, _sendPath(false)
|
||||
, _send(this, lang(lng_forward_send), st::defaultBoxButton)
|
||||
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||
, offered(0)
|
||||
, a_opacity(0, 1)
|
||||
, _a_appearance(animation(this, &HistoryHider::step_appearance))
|
||||
, hiding(false)
|
||||
, _forwardRequest(0)
|
||||
, toTextWidth(0)
|
||||
, shadow(st::boxShadow) {
|
||||
, _shadow(st::boxShadow) {
|
||||
init();
|
||||
}
|
||||
|
||||
HistoryHider::HistoryHider(MainWidget *parent) : TWidget(parent)
|
||||
, _sharedContact(0)
|
||||
, _forwardSelected(false)
|
||||
, _sendPath(true)
|
||||
, _send(this, lang(lng_forward_send), st::defaultBoxButton)
|
||||
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||
, offered(0)
|
||||
, a_opacity(0, 1)
|
||||
, _a_appearance(animation(this, &HistoryHider::step_appearance))
|
||||
, hiding(false)
|
||||
, _forwardRequest(0)
|
||||
, toTextWidth(0)
|
||||
, shadow(st::boxShadow) {
|
||||
, _shadow(st::boxShadow) {
|
||||
init();
|
||||
}
|
||||
|
||||
HistoryHider::HistoryHider(MainWidget *parent, const QString &botAndQuery) : TWidget(parent)
|
||||
, _sharedContact(0)
|
||||
, _forwardSelected(false)
|
||||
, _sendPath(false)
|
||||
, _botAndQuery(botAndQuery)
|
||||
, _send(this, lang(lng_forward_send), st::defaultBoxButton)
|
||||
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||
, offered(0)
|
||||
, a_opacity(0, 1)
|
||||
, _a_appearance(animation(this, &HistoryHider::step_appearance))
|
||||
, hiding(false)
|
||||
, _forwardRequest(0)
|
||||
, toTextWidth(0)
|
||||
, shadow(st::boxShadow) {
|
||||
, _shadow(st::boxShadow) {
|
||||
init();
|
||||
}
|
||||
|
||||
HistoryHider::HistoryHider(MainWidget *parent, const QString &url, const QString &text) : TWidget(parent)
|
||||
, _sharedContact(0)
|
||||
, _forwardSelected(false)
|
||||
, _sendPath(false)
|
||||
, _shareUrl(url)
|
||||
, _shareText(text)
|
||||
, _send(this, lang(lng_forward_send), st::defaultBoxButton)
|
||||
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||
, offered(0)
|
||||
, a_opacity(0, 1)
|
||||
, _a_appearance(animation(this, &HistoryHider::step_appearance))
|
||||
, hiding(false)
|
||||
, _forwardRequest(0)
|
||||
, toTextWidth(0)
|
||||
, shadow(st::boxShadow) {
|
||||
, _shadow(st::boxShadow) {
|
||||
init();
|
||||
}
|
||||
|
||||
@ -2736,7 +2704,7 @@ void HistoryHider::step_appearance(float64 ms, bool timer) {
|
||||
if (dt >= 1) {
|
||||
_a_appearance.stop();
|
||||
a_opacity.finish();
|
||||
if (hiding) {
|
||||
if (_hiding) {
|
||||
QTimer::singleShot(0, this, SLOT(deleteLater()));
|
||||
}
|
||||
} else {
|
||||
@ -2752,45 +2720,45 @@ bool HistoryHider::withConfirm() const {
|
||||
|
||||
void HistoryHider::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
if (!hiding || !cacheForAnim.isNull() || !offered) {
|
||||
if (!_hiding || !_cacheForAnim.isNull() || !_offered) {
|
||||
p.setOpacity(a_opacity.current() * st::layerAlpha);
|
||||
p.fillRect(rect(), st::layerBg->b);
|
||||
p.setOpacity(a_opacity.current());
|
||||
}
|
||||
if (cacheForAnim.isNull() || !offered) {
|
||||
p.setFont(st::forwardFont->f);
|
||||
if (offered) {
|
||||
shadow.paint(p, box, st::boxShadowShift);
|
||||
if (_cacheForAnim.isNull() || !_offered) {
|
||||
p.setFont(st::forwardFont);
|
||||
if (_offered) {
|
||||
_shadow.paint(p, _box, st::boxShadowShift);
|
||||
|
||||
// fill bg
|
||||
p.fillRect(box, st::boxBg->b);
|
||||
p.fillRect(_box, st::boxBg);
|
||||
|
||||
p.setPen(st::black->p);
|
||||
toText.drawElided(p, box.left() + st::boxPadding.left(), box.top() + st::boxPadding.top(), toTextWidth + 2);
|
||||
p.setPen(st::black);
|
||||
_toText.drawElided(p, _box.left() + st::boxPadding.left(), _box.top() + st::boxPadding.top(), _toTextWidth + 2);
|
||||
} else {
|
||||
int32 w = st::forwardMargins.left() + _chooseWidth + st::forwardMargins.right(), h = st::forwardMargins.top() + st::forwardFont->height + st::forwardMargins.bottom();
|
||||
App::roundRect(p, (width() - w) / 2, (height() - st::titleHeight - h) / 2, w, h, st::forwardBg, ForwardCorners);
|
||||
|
||||
p.setPen(st::white->p);
|
||||
p.drawText(box, lang(_botAndQuery.isEmpty() ? lng_forward_choose : lng_inline_switch_choose), QTextOption(style::al_center));
|
||||
p.setPen(st::white);
|
||||
p.drawText(_box, lang(_botAndQuery.isEmpty() ? lng_forward_choose : lng_inline_switch_choose), QTextOption(style::al_center));
|
||||
}
|
||||
} else {
|
||||
p.drawPixmap(box.left(), box.top(), cacheForAnim);
|
||||
p.drawPixmap(_box.left(), _box.top(), _cacheForAnim);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryHider::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Escape) {
|
||||
if (offered) {
|
||||
offered = 0;
|
||||
resizeEvent(0);
|
||||
if (_offered) {
|
||||
_offered = nullptr;
|
||||
resizeEvent(nullptr);
|
||||
update();
|
||||
App::main()->dialogsActivate();
|
||||
} else {
|
||||
startHide();
|
||||
}
|
||||
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||
if (offered) {
|
||||
if (_offered) {
|
||||
forward();
|
||||
}
|
||||
}
|
||||
@ -2798,19 +2766,19 @@ void HistoryHider::keyPressEvent(QKeyEvent *e) {
|
||||
|
||||
void HistoryHider::mousePressEvent(QMouseEvent *e) {
|
||||
if (e->button() == Qt::LeftButton) {
|
||||
if (!box.contains(e->pos())) {
|
||||
if (!_box.contains(e->pos())) {
|
||||
startHide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryHider::startHide() {
|
||||
if (hiding) return;
|
||||
hiding = true;
|
||||
if (_hiding) return;
|
||||
_hiding = true;
|
||||
if (Adaptive::OneColumn()) {
|
||||
QTimer::singleShot(0, this, SLOT(deleteLater()));
|
||||
} else {
|
||||
if (offered) cacheForAnim = myGrab(this, box);
|
||||
if (_offered) _cacheForAnim = myGrab(this, _box);
|
||||
if (_forwardRequest) MTP::cancel(_forwardRequest);
|
||||
a_opacity.start(0);
|
||||
_send.hide();
|
||||
@ -2820,17 +2788,17 @@ void HistoryHider::startHide() {
|
||||
}
|
||||
|
||||
void HistoryHider::forward() {
|
||||
if (!hiding && offered) {
|
||||
if (!_hiding && _offered) {
|
||||
if (_sharedContact) {
|
||||
parent()->onShareContact(offered->id, _sharedContact);
|
||||
parent()->onShareContact(_offered->id, _sharedContact);
|
||||
} else if (_sendPath) {
|
||||
parent()->onSendPaths(offered->id);
|
||||
parent()->onSendPaths(_offered->id);
|
||||
} else if (!_shareUrl.isEmpty()) {
|
||||
parent()->onShareUrl(offered->id, _shareUrl, _shareText);
|
||||
parent()->onShareUrl(_offered->id, _shareUrl, _shareText);
|
||||
} else if (!_botAndQuery.isEmpty()) {
|
||||
parent()->onInlineSwitchChosen(offered->id, _botAndQuery);
|
||||
parent()->onInlineSwitchChosen(_offered->id, _botAndQuery);
|
||||
} else {
|
||||
parent()->onForward(offered->id, _forwardSelected ? ForwardSelectedMessages : ForwardContextMessage);
|
||||
parent()->onForward(_offered->id, _forwardSelected ? ForwardSelectedMessages : ForwardContextMessage);
|
||||
}
|
||||
}
|
||||
emit forwarded();
|
||||
@ -2847,8 +2815,8 @@ MainWidget *HistoryHider::parent() {
|
||||
|
||||
void HistoryHider::resizeEvent(QResizeEvent *e) {
|
||||
int32 w = st::boxWidth, h = st::boxPadding.top() + st::boxPadding.bottom();
|
||||
if (offered) {
|
||||
if (!hiding) {
|
||||
if (_offered) {
|
||||
if (!_hiding) {
|
||||
_send.show();
|
||||
_cancel.show();
|
||||
}
|
||||
@ -2858,22 +2826,22 @@ void HistoryHider::resizeEvent(QResizeEvent *e) {
|
||||
_send.hide();
|
||||
_cancel.hide();
|
||||
}
|
||||
box = QRect((width() - w) / 2, (height() - st::titleHeight - h) / 2, w, h);
|
||||
_send.moveToRight(width() - (box.x() + box.width()) + st::boxButtonPadding.right(), box.y() + h - st::boxButtonPadding.bottom() - _send.height());
|
||||
_cancel.moveToRight(width() - (box.x() + box.width()) + st::boxButtonPadding.right() + _send.width() + st::boxButtonPadding.left(), _send.y());
|
||||
_box = QRect((width() - w) / 2, (height() - st::titleHeight - h) / 2, w, h);
|
||||
_send.moveToRight(width() - (_box.x() + _box.width()) + st::boxButtonPadding.right(), _box.y() + h - st::boxButtonPadding.bottom() - _send.height());
|
||||
_cancel.moveToRight(width() - (_box.x() + _box.width()) + st::boxButtonPadding.right() + _send.width() + st::boxButtonPadding.left(), _send.y());
|
||||
}
|
||||
|
||||
bool HistoryHider::offerPeer(PeerId peer) {
|
||||
if (!peer) {
|
||||
offered = 0;
|
||||
toText.setText(st::boxTextFont, QString());
|
||||
toTextWidth = 0;
|
||||
resizeEvent(0);
|
||||
_offered = nullptr;
|
||||
_toText.setText(st::boxTextFont, QString());
|
||||
_toTextWidth = 0;
|
||||
resizeEvent(nullptr);
|
||||
return false;
|
||||
}
|
||||
offered = App::peer(peer);
|
||||
_offered = App::peer(peer);
|
||||
LangString phrase;
|
||||
QString recipient = offered->isUser() ? offered->name : '\xAB' + offered->name + '\xBB';
|
||||
QString recipient = _offered->isUser() ? _offered->name : '\xAB' + _offered->name + '\xBB';
|
||||
if (_sharedContact) {
|
||||
phrase = lng_forward_share_contact(lt_recipient, recipient);
|
||||
} else if (_sendPath) {
|
||||
@ -2887,35 +2855,35 @@ bool HistoryHider::offerPeer(PeerId peer) {
|
||||
phrase = lng_forward_send_file_confirm(lt_name, name, lt_recipient, recipient);
|
||||
}
|
||||
} else if (!_shareUrl.isEmpty()) {
|
||||
PeerId to = offered->id;
|
||||
offered = 0;
|
||||
PeerId to = _offered->id;
|
||||
_offered = nullptr;
|
||||
if (parent()->onShareUrl(to, _shareUrl, _shareText)) {
|
||||
startHide();
|
||||
}
|
||||
return false;
|
||||
} else if (!_botAndQuery.isEmpty()) {
|
||||
PeerId to = offered->id;
|
||||
offered = 0;
|
||||
PeerId to = _offered->id;
|
||||
_offered = nullptr;
|
||||
if (parent()->onInlineSwitchChosen(to, _botAndQuery)) {
|
||||
startHide();
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
PeerId to = offered->id;
|
||||
offered = 0;
|
||||
PeerId to = _offered->id;
|
||||
_offered = nullptr;
|
||||
if (parent()->onForward(to, _forwardSelected ? ForwardSelectedMessages : ForwardContextMessage)) {
|
||||
startHide();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
toText.setText(st::boxTextFont, phrase, _textNameOptions);
|
||||
toTextWidth = toText.maxWidth();
|
||||
if (toTextWidth > box.width() - st::boxPadding.left() - st::boxButtonPadding.right()) {
|
||||
toTextWidth = box.width() - st::boxPadding.left() - st::boxButtonPadding.right();
|
||||
_toText.setText(st::boxTextFont, phrase, _textNameOptions);
|
||||
_toTextWidth = _toText.maxWidth();
|
||||
if (_toTextWidth > _box.width() - st::boxPadding.left() - st::boxButtonPadding.right()) {
|
||||
_toTextWidth = _box.width() - st::boxPadding.left() - st::boxButtonPadding.right();
|
||||
}
|
||||
|
||||
resizeEvent(0);
|
||||
resizeEvent(nullptr);
|
||||
update();
|
||||
setFocus();
|
||||
|
||||
@ -2923,11 +2891,11 @@ bool HistoryHider::offerPeer(PeerId peer) {
|
||||
}
|
||||
|
||||
QString HistoryHider::offeredText() const {
|
||||
return toText.originalText();
|
||||
return _toText.originalText();
|
||||
}
|
||||
|
||||
bool HistoryHider::wasOffered() const {
|
||||
return !!offered;
|
||||
return _offered != nullptr;
|
||||
}
|
||||
|
||||
HistoryHider::~HistoryHider() {
|
||||
|
@ -21,7 +21,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#pragma once
|
||||
|
||||
#include "localimageloader.h"
|
||||
#include "ui/boxshadow.h"
|
||||
#include "ui/effects/rect_shadow.h"
|
||||
#include "ui/popupmenu.h"
|
||||
#include "history/history_common.h"
|
||||
#include "history/field_autocomplete.h"
|
||||
#include "window/section_widget.h"
|
||||
@ -479,30 +480,31 @@ private:
|
||||
void init();
|
||||
MainWidget *parent();
|
||||
|
||||
UserData *_sharedContact;
|
||||
bool _forwardSelected, _sendPath;
|
||||
UserData *_sharedContact = nullptr;
|
||||
bool _forwardSelected = false;
|
||||
bool _sendPath = false;
|
||||
|
||||
QString _shareUrl, _shareText;
|
||||
QString _botAndQuery;
|
||||
|
||||
BoxButton _send, _cancel;
|
||||
PeerData *offered;
|
||||
PeerData *_offered = nullptr;
|
||||
|
||||
anim::fvalue a_opacity;
|
||||
Animation _a_appearance;
|
||||
|
||||
QRect box;
|
||||
bool hiding;
|
||||
QRect _box;
|
||||
bool _hiding = false;
|
||||
|
||||
mtpRequestId _forwardRequest;
|
||||
mtpRequestId _forwardRequest = 0;
|
||||
|
||||
int32 _chooseWidth;
|
||||
int _chooseWidth = 0;
|
||||
|
||||
Text toText;
|
||||
int32 toTextWidth;
|
||||
QPixmap cacheForAnim;
|
||||
Text _toText;
|
||||
int32 _toTextWidth = 0;
|
||||
QPixmap _cacheForAnim;
|
||||
|
||||
BoxShadow shadow;
|
||||
Ui::RectShadow _shadow;
|
||||
|
||||
};
|
||||
|
||||
|
@ -83,7 +83,7 @@ private:
|
||||
QRect _box, _hiddenSpecialBox;
|
||||
float64 _opacity = 0.;
|
||||
|
||||
BoxShadow _shadow;
|
||||
Ui::RectShadow _shadow;
|
||||
|
||||
};
|
||||
|
||||
|
@ -20,7 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/boxshadow.h"
|
||||
#include "ui/effects/rect_shadow.h"
|
||||
|
||||
class LayerWidget : public TWidget {
|
||||
Q_OBJECT
|
||||
|
@ -43,7 +43,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "apiwrap.h"
|
||||
#include "settings/settings_widget.h"
|
||||
|
||||
ConnectingWidget::ConnectingWidget(QWidget *parent, const QString &text, const QString &reconnect) : QWidget(parent), _shadow(st::boxShadow), _reconnect(this, QString()) {
|
||||
ConnectingWidget::ConnectingWidget(QWidget *parent, const QString &text, const QString &reconnect) : QWidget(parent)
|
||||
, _shadow(st::boxShadow)
|
||||
, _reconnect(this, QString()) {
|
||||
set(text, reconnect);
|
||||
connect(&_reconnect, SIGNAL(clicked()), this, SLOT(onReconnect()));
|
||||
}
|
||||
@ -57,21 +59,21 @@ void ConnectingWidget::set(const QString &text, const QString &reconnect) {
|
||||
} else {
|
||||
_reconnect.setText(reconnect);
|
||||
_reconnect.show();
|
||||
_reconnect.move(st::connectingPadding.left() + _textWidth, st::boxShadow.pxHeight() + st::connectingPadding.top());
|
||||
_reconnect.move(st::connectingPadding.left() + _textWidth, st::boxShadow.height() + st::connectingPadding.top());
|
||||
_reconnectWidth = _reconnect.width();
|
||||
}
|
||||
resize(st::connectingPadding.left() + _textWidth + _reconnectWidth + st::connectingPadding.right() + st::boxShadow.pxWidth(), st::boxShadow.pxHeight() + st::connectingPadding.top() + st::linkFont->height + st::connectingPadding.bottom());
|
||||
resize(st::connectingPadding.left() + _textWidth + _reconnectWidth + st::connectingPadding.right() + st::boxShadow.width(), st::boxShadow.height() + st::connectingPadding.top() + st::linkFont->height + st::connectingPadding.bottom());
|
||||
update();
|
||||
}
|
||||
|
||||
void ConnectingWidget::paintEvent(QPaintEvent *e) {
|
||||
QPainter p(this);
|
||||
Painter p(this);
|
||||
|
||||
_shadow.paint(p, QRect(0, st::boxShadow.pxHeight(), width() - st::boxShadow.pxWidth(), height() - st::boxShadow.pxHeight()), 0, BoxShadow::Top | BoxShadow::Right);
|
||||
p.fillRect(0, st::boxShadow.pxHeight(), width() - st::boxShadow.pxWidth(), height() - st::boxShadow.pxHeight(), st::connectingBG->b);
|
||||
_shadow.paint(p, QRect(0, st::boxShadow.height(), width() - st::boxShadow.width(), height() - st::boxShadow.height()), 0, Ui::RectShadow::Side::Top | Ui::RectShadow::Side::Right);
|
||||
p.fillRect(0, st::boxShadow.height(), width() - st::boxShadow.width(), height() - st::boxShadow.height(), st::connectingBG->b);
|
||||
p.setFont(st::linkFont->f);
|
||||
p.setPen(st::connectingColor->p);
|
||||
p.drawText(st::connectingPadding.left(), st::boxShadow.pxHeight() + st::connectingPadding.top() + st::linkFont->ascent, _text);
|
||||
p.drawText(st::connectingPadding.left(), st::boxShadow.height() + st::connectingPadding.top() + st::linkFont->ascent, _text);
|
||||
}
|
||||
|
||||
void ConnectingWidget::onReconnect() {
|
||||
|
@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
|
||||
#include "title.h"
|
||||
#include "pspecific.h"
|
||||
#include "ui/boxshadow.h"
|
||||
#include "ui/effects/rect_shadow.h"
|
||||
#include "platform/platform_main_window.h"
|
||||
|
||||
class MediaView;
|
||||
@ -54,7 +54,7 @@ public slots:
|
||||
|
||||
private:
|
||||
|
||||
BoxShadow _shadow;
|
||||
Ui::RectShadow _shadow;
|
||||
QString _text;
|
||||
int32 _textWidth;
|
||||
LinkButton _reconnect;
|
||||
|
@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "mainwindow.h"
|
||||
#include "application.h"
|
||||
#include "ui/filedialog.h"
|
||||
#include "ui/popupmenu.h"
|
||||
#include "media/media_clip_reader.h"
|
||||
#include "media/view/media_clip_controller.h"
|
||||
#include "styles/style_mediaview.h"
|
||||
|
@ -29,6 +29,8 @@ class Controller;
|
||||
} // namespace Clip
|
||||
} // namespace Media
|
||||
|
||||
class PopupMenu;
|
||||
|
||||
struct AudioPlaybackState;
|
||||
|
||||
class MediaView : public TWidget, public RPCSender, public ClickHandlerHost {
|
||||
|
@ -21,6 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#pragma once
|
||||
|
||||
#include "window/section_widget.h"
|
||||
#include "ui/popupmenu.h"
|
||||
|
||||
namespace Overview {
|
||||
namespace Layout {
|
||||
|
@ -138,12 +138,12 @@ public:
|
||||
}
|
||||
|
||||
bool init(QColor c) {
|
||||
_fullsize = st::wndShadow.rect().width();
|
||||
_fullsize = st::wndShadow.width();
|
||||
_shift = st::wndShadowShift;
|
||||
QImage cornersImage(_fullsize, _fullsize, QImage::Format_ARGB32_Premultiplied);
|
||||
{
|
||||
Painter p(&cornersImage);
|
||||
p.drawSprite(0, 0, st::wndShadow);
|
||||
st::wndShadow.paint(p, 0, 0, _fullsize);
|
||||
}
|
||||
if (rtl()) cornersImage = cornersImage.mirrored(true, false);
|
||||
uchar *bits = cornersImage.bits();
|
||||
@ -253,6 +253,12 @@ public:
|
||||
SelectObject(dcs[i], bitmaps[i]);
|
||||
}
|
||||
|
||||
QStringList alphasForLog;
|
||||
for_const (auto alpha, _alphas) {
|
||||
alphasForLog.append(QString::number(alpha));
|
||||
}
|
||||
LOG(("Window Shadow: %1").arg(alphasForLog.join(", ")));
|
||||
|
||||
initCorners();
|
||||
return true;
|
||||
}
|
||||
|
@ -72,8 +72,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "ui/flatinput.h"
|
||||
#include "ui/flattextarea.h"
|
||||
#include "ui/flatbutton.h"
|
||||
#include "ui/boxshadow.h"
|
||||
#include "ui/popupmenu.h"
|
||||
#include "ui/scrollarea.h"
|
||||
#include "ui/images.h"
|
||||
#include "ui/text/text.h"
|
||||
|
@ -48,8 +48,8 @@ EmojiColorPicker::EmojiColorPicker() : TWidget()
|
||||
setMouseTracking(true);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
int32 w = st::emojiPanSize.width() * (EmojiColorsCount + 1) + 4 * st::emojiColorsPadding + st::emojiColorsSep + st::dropdownDef.shadow.pxWidth() * 2;
|
||||
int32 h = 2 * st::emojiColorsPadding + st::emojiPanSize.height() + st::dropdownDef.shadow.pxHeight() * 2;
|
||||
int32 w = st::emojiPanSize.width() * (EmojiColorsCount + 1) + 4 * st::emojiColorsPadding + st::emojiColorsSep + st::dropdownDef.shadow.width() * 2;
|
||||
int32 h = 2 * st::emojiColorsPadding + st::emojiPanSize.height() + st::dropdownDef.shadow.height() * 2;
|
||||
resize(w, h);
|
||||
|
||||
_hideTimer.setSingleShot(true);
|
||||
@ -84,7 +84,7 @@ void EmojiColorPicker::paintEvent(QPaintEvent *e) {
|
||||
p.setClipRect(e->rect());
|
||||
}
|
||||
|
||||
int32 w = st::dropdownDef.shadow.pxWidth(), h = st::dropdownDef.shadow.pxHeight();
|
||||
int32 w = st::dropdownDef.shadow.width(), h = st::dropdownDef.shadow.height();
|
||||
QRect r = QRect(w, h, width() - 2 * w, height() - 2 * h);
|
||||
_shadow.paint(p, r, st::dropdownDef.shadowShift);
|
||||
|
||||
@ -174,7 +174,7 @@ void EmojiColorPicker::step_selected(uint64 ms, bool timer) {
|
||||
_hovers[index] = (i.key() > 0) ? dt : (1 - dt);
|
||||
++i;
|
||||
}
|
||||
toUpdate += QRect(st::dropdownDef.shadow.pxWidth() + st::emojiColorsPadding + index * st::emojiPanSize.width() + (index ? 2 * st::emojiColorsPadding + st::emojiColorsSep : 0), st::dropdownDef.shadow.pxHeight() + st::emojiColorsPadding, st::emojiPanSize.width(), st::emojiPanSize.height());
|
||||
toUpdate += QRect(st::dropdownDef.shadow.width() + st::emojiColorsPadding + index * st::emojiPanSize.width() + (index ? 2 * st::emojiColorsPadding + st::emojiColorsSep : 0), st::dropdownDef.shadow.height() + st::emojiColorsPadding, st::emojiPanSize.width(), st::emojiPanSize.height());
|
||||
}
|
||||
if (timer) rtlupdate(toUpdate.boundingRect());
|
||||
if (_emojiAnimations.isEmpty()) _a_selected.stop();
|
||||
@ -191,7 +191,7 @@ void EmojiColorPicker::hideStart(bool fast) {
|
||||
emit hidden();
|
||||
} else {
|
||||
if (_cache.isNull()) {
|
||||
int32 w = st::dropdownDef.shadow.pxWidth(), h = st::dropdownDef.shadow.pxHeight();
|
||||
int32 w = st::dropdownDef.shadow.width(), h = st::dropdownDef.shadow.height();
|
||||
_cache = myGrab(this, QRect(w, h, width() - 2 * w, height() - 2 * h));
|
||||
clearSelection(true);
|
||||
}
|
||||
@ -213,7 +213,7 @@ void EmojiColorPicker::showStart() {
|
||||
return;
|
||||
}
|
||||
if (_cache.isNull()) {
|
||||
int32 w = st::dropdownDef.shadow.pxWidth(), h = st::dropdownDef.shadow.pxHeight();
|
||||
int32 w = st::dropdownDef.shadow.width(), h = st::dropdownDef.shadow.height();
|
||||
_cache = myGrab(this, QRect(w, h, width() - 2 * w, height() - 2 * h));
|
||||
clearSelection(true);
|
||||
}
|
||||
@ -237,9 +237,9 @@ void EmojiColorPicker::clearSelection(bool fast) {
|
||||
void EmojiColorPicker::updateSelected() {
|
||||
int32 selIndex = -1;
|
||||
QPoint p(mapFromGlobal(_lastMousePos));
|
||||
int32 sx = rtl() ? (width() - p.x()) : p.x(), y = p.y() - st::dropdownDef.shadow.pxHeight() - st::emojiColorsPadding;
|
||||
int32 sx = rtl() ? (width() - p.x()) : p.x(), y = p.y() - st::dropdownDef.shadow.height() - st::emojiColorsPadding;
|
||||
if (y >= 0 && y < st::emojiPanSize.height()) {
|
||||
int32 x = sx - st::dropdownDef.shadow.pxWidth() - st::emojiColorsPadding;
|
||||
int32 x = sx - st::dropdownDef.shadow.width() - st::emojiColorsPadding;
|
||||
if (x >= 0 && x < st::emojiPanSize.width()) {
|
||||
selIndex = 0;
|
||||
} else {
|
||||
@ -275,7 +275,7 @@ void EmojiColorPicker::updateSelected() {
|
||||
void EmojiColorPicker::drawVariant(Painter &p, int variant) {
|
||||
float64 hover = _hovers[variant];
|
||||
|
||||
QPoint w(st::dropdownDef.shadow.pxWidth() + st::emojiColorsPadding + variant * st::emojiPanSize.width() + (variant ? 2 * st::emojiColorsPadding + st::emojiColorsSep : 0), st::dropdownDef.shadow.pxHeight() + st::emojiColorsPadding);
|
||||
QPoint w(st::dropdownDef.shadow.width() + st::emojiColorsPadding + variant * st::emojiPanSize.width() + (variant ? 2 * st::emojiColorsPadding + st::emojiColorsSep : 0), st::dropdownDef.shadow.height() + st::emojiColorsPadding);
|
||||
if (hover > 0) {
|
||||
p.setOpacity(hover);
|
||||
QPoint tl(w);
|
||||
|
@ -21,7 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#pragma once
|
||||
|
||||
#include "ui/twidget.h"
|
||||
#include "ui/boxshadow.h"
|
||||
#include "ui/effects/rect_shadow.h"
|
||||
|
||||
namespace InlineBots {
|
||||
namespace Layout {
|
||||
@ -108,7 +108,7 @@ private:
|
||||
|
||||
QTimer _hideTimer;
|
||||
|
||||
BoxShadow _shadow;
|
||||
Ui::RectShadow _shadow;
|
||||
|
||||
};
|
||||
|
||||
@ -616,7 +616,7 @@ private:
|
||||
|
||||
QTimer _hideTimer;
|
||||
|
||||
BoxShadow _shadow;
|
||||
Ui::RectShadow _shadow;
|
||||
|
||||
FlatRadiobutton _recent, _people, _nature, _food, _activity, _travel, _objects, _symbols;
|
||||
QList<internal::StickerIcon> _icons;
|
||||
|
@ -1161,7 +1161,7 @@ void DocumentData::setattributes(const QVector<MTPDocumentAttribute> &attributes
|
||||
}
|
||||
} break;
|
||||
case mtpc_documentAttributeVideo: {
|
||||
const auto &d(attributes[i].c_documentAttributeVideo());
|
||||
auto &d = attributes[i].c_documentAttributeVideo();
|
||||
if (type == FileDocument) {
|
||||
type = VideoDocument;
|
||||
}
|
||||
@ -1169,7 +1169,7 @@ void DocumentData::setattributes(const QVector<MTPDocumentAttribute> &attributes
|
||||
dimensions = QSize(d.vw.v, d.vh.v);
|
||||
} break;
|
||||
case mtpc_documentAttributeAudio: {
|
||||
const auto &d(attributes[i].c_documentAttributeAudio());
|
||||
auto &d = attributes[i].c_documentAttributeAudio();
|
||||
if (type == FileDocument) {
|
||||
if (d.is_voice()) {
|
||||
type = VoiceDocument;
|
||||
|
@ -1,191 +0,0 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
It is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
In addition, as a special exception, the copyright holders give permission
|
||||
to link the code of portions of this program with the OpenSSL library.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "boxshadow.h"
|
||||
|
||||
BoxShadow::BoxShadow(const style::sprite &topLeft) : _size(topLeft.pxWidth()), _pixsize(_size * cIntRetinaFactor()) {
|
||||
if (!_size) return;
|
||||
|
||||
QImage cornersImage(_pixsize * 2, _pixsize * 2, QImage::Format_ARGB32_Premultiplied);
|
||||
cornersImage.setDevicePixelRatio(cRetinaFactor());
|
||||
{
|
||||
Painter p(&cornersImage);
|
||||
p.drawSprite(QPoint(rtl() ? _size : 0, 0), topLeft);
|
||||
}
|
||||
if (rtl()) cornersImage = cornersImage.mirrored(true, false);
|
||||
uchar *bits = cornersImage.bits();
|
||||
if (bits) {
|
||||
for (
|
||||
quint32 *p = (quint32*)bits, *end = (quint32*)(bits + cornersImage.byteCount());
|
||||
p < end;
|
||||
++p
|
||||
) {
|
||||
*p = (*p ^ 0x00ffffff) << 24;
|
||||
}
|
||||
}
|
||||
{
|
||||
QPainter p(&cornersImage);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
QImage m = cornersImage.mirrored();
|
||||
m.setDevicePixelRatio(cRetinaFactor());
|
||||
p.drawImage(0, _size, m, 0, _pixsize, _pixsize, _pixsize);
|
||||
}
|
||||
{
|
||||
QPainter p(&cornersImage);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
QImage m = cornersImage.mirrored(true, false);
|
||||
m.setDevicePixelRatio(cRetinaFactor());
|
||||
p.drawImage(_size, 0, m, _pixsize, 0, _pixsize, _pixsize * 2);
|
||||
}
|
||||
_colors.reserve(_pixsize);
|
||||
uchar prev = 0;
|
||||
for (int i = 0; i < _pixsize; ++i) {
|
||||
uchar a = (cornersImage.pixel(QPoint(i, _pixsize - 1)) >> 24);
|
||||
if (a < prev) break;
|
||||
|
||||
_colors.push_back(style::color(0, 0, 0, a));
|
||||
prev = a;
|
||||
}
|
||||
if (cRetina()) {
|
||||
_left = App::pixmapFromImageInPlace(cornersImage.copy(0, _pixsize - 1, _colors.size(), 1));
|
||||
_left.setDevicePixelRatio(cRetinaFactor());
|
||||
_top = App::pixmapFromImageInPlace(cornersImage.copy(_pixsize - 1, 0, 1, _colors.size()));
|
||||
_top.setDevicePixelRatio(cRetinaFactor());
|
||||
_right = App::pixmapFromImageInPlace(cornersImage.copy(_pixsize * 2 - _colors.size(), _pixsize, _colors.size(), 1));
|
||||
_right.setDevicePixelRatio(cRetinaFactor());
|
||||
_bottom = App::pixmapFromImageInPlace(cornersImage.copy(_pixsize, _pixsize * 2 - _colors.size(), 1, _colors.size()));
|
||||
_bottom.setDevicePixelRatio(cRetinaFactor());
|
||||
}
|
||||
_corners = App::pixmapFromImageInPlace(std_::move(cornersImage));
|
||||
_corners.setDevicePixelRatio(cRetinaFactor());
|
||||
}
|
||||
|
||||
void BoxShadow::paint(QPainter &p, const QRect &box, int32 shifty, int32 flags) {
|
||||
if (!_size) return;
|
||||
|
||||
int32 rshifty = shifty * cIntRetinaFactor();
|
||||
int32 count = _colors.size(), countsize = count / cIntRetinaFactor(), minus = _size - countsize + shifty;
|
||||
bool left = (flags & Left), top = (flags & Top), right = (flags & Right), bottom = (flags & Bottom);
|
||||
if (left && top) p.drawPixmap(box.left() - _size + minus, box.top() - _size + minus + shifty, _corners, 0, 0, _pixsize, _pixsize);
|
||||
if (right && top) p.drawPixmap(box.left() + box.width() - minus, box.top() - _size + minus + shifty, _corners, _pixsize, 0, _pixsize, _pixsize);
|
||||
if (right && bottom) p.drawPixmap(box.left() + box.width() - minus, box.top() + box.height() - minus + shifty, _corners, _pixsize, _pixsize, _pixsize, _pixsize);
|
||||
if (left && bottom) p.drawPixmap(box.left() - _size + minus, box.top() + box.height() - minus + shifty, _corners, 0, _pixsize, _pixsize, _pixsize);
|
||||
if (cRetina()) {
|
||||
bool wasSmooth = p.renderHints().testFlag(QPainter::SmoothPixmapTransform);
|
||||
if (wasSmooth) p.setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||
if (left) p.drawPixmap(box.left() - countsize + shifty, box.top() + (top ? minus : 0) + shifty, countsize - shifty, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _left, 0, 0, count - rshifty, 1);
|
||||
if (top) p.drawPixmap(box.left() + (left ? minus : 0), box.top() - countsize + 2 * shifty, box.width() - (right ? minus : 0) - (left ? minus : 0), countsize - 2 * shifty, _top, 0, 0, 1, count - 2 * rshifty);
|
||||
if (right) p.drawPixmap(box.left() + box.width(), box.top() + (top ? minus : 0) + shifty, countsize - shifty, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _right, rshifty, 0, count - rshifty, 1);
|
||||
if (bottom) p.drawPixmap(box.left() + (left ? minus : 0), box.top() + box.height(), box.width() - (right ? minus : 0) - (left ? minus : 0), countsize, _bottom, 0, 0, 1, count);
|
||||
if (wasSmooth) p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
} else {
|
||||
p.setPen(Qt::NoPen);
|
||||
for (int32 i = 0; i < count; ++i) {
|
||||
if (left && i + shifty < count) p.fillRect(box.left() - count + i + shifty, box.top() + (top ? minus : 0) + shifty, 1, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _colors[i]->b);
|
||||
if (top && i + 2 * shifty < count) p.fillRect(box.left() + (left ? minus : 0), box.top() - count + i + 2 * shifty, box.width() - (right ? minus : 0) - (left ? minus : 0), 1, _colors[i]->b);
|
||||
if (right && i + shifty < count) p.fillRect(box.left() + box.width() + count - i - shifty - 1, box.top() + (top ? minus : 0) + shifty, 1, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _colors[i]->b);
|
||||
if (bottom) p.fillRect(box.left() + (left ? minus : 0), box.top() + box.height() + count - i - 1, box.width() - (right ? minus : 0) - (left ? minus : 0), 1, _colors[i]->b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
style::margins BoxShadow::getDimensions(int32 shifty) const {
|
||||
int32 d = _colors.size() / cIntRetinaFactor();
|
||||
return style::margins(d - shifty, d - 2 * shifty, d - shifty, d);
|
||||
}
|
||||
|
||||
namespace Ui {
|
||||
|
||||
RectShadow::RectShadow(const style::icon &topLeft) : _size(topLeft.width()), _pixsize(_size * cIntRetinaFactor()) {
|
||||
if (!_size) return;
|
||||
|
||||
QImage cornersImage(_pixsize * 2, _pixsize * 2, QImage::Format_ARGB32_Premultiplied);
|
||||
cornersImage.setDevicePixelRatio(cRetinaFactor());
|
||||
{
|
||||
Painter p(&cornersImage);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
topLeft.paint(p, QPoint(0, 0), _size);
|
||||
}
|
||||
if (rtl()) cornersImage = cornersImage.mirrored(true, false);
|
||||
{
|
||||
QPainter p(&cornersImage);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
QImage m = cornersImage.mirrored();
|
||||
m.setDevicePixelRatio(cRetinaFactor());
|
||||
p.drawImage(0, _size, m, 0, _pixsize, _pixsize, _pixsize);
|
||||
}
|
||||
{
|
||||
QPainter p(&cornersImage);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
QImage m = cornersImage.mirrored(true, false);
|
||||
m.setDevicePixelRatio(cRetinaFactor());
|
||||
p.drawImage(_size, 0, m, _pixsize, 0, _pixsize, _pixsize * 2);
|
||||
}
|
||||
|
||||
uchar prev = 0;
|
||||
for (int i = 0; i < _pixsize; ++i) {
|
||||
uchar a = (cornersImage.pixel(QPoint(i, _pixsize - 1)) >> 24);
|
||||
if (a < prev) break;
|
||||
|
||||
++_thickness;
|
||||
prev = a;
|
||||
}
|
||||
|
||||
_left = App::pixmapFromImageInPlace(cornersImage.copy(0, _pixsize - 1, _thickness, 1));
|
||||
_left.setDevicePixelRatio(cRetinaFactor());
|
||||
_top = App::pixmapFromImageInPlace(cornersImage.copy(_pixsize - 1, 0, 1, _thickness));
|
||||
_top.setDevicePixelRatio(cRetinaFactor());
|
||||
_right = App::pixmapFromImageInPlace(cornersImage.copy(_pixsize * 2 - _thickness, _pixsize, _thickness, 1));
|
||||
_right.setDevicePixelRatio(cRetinaFactor());
|
||||
_bottom = App::pixmapFromImageInPlace(cornersImage.copy(_pixsize, _pixsize * 2 - _thickness, 1, _thickness));
|
||||
_bottom.setDevicePixelRatio(cRetinaFactor());
|
||||
|
||||
_corners = App::pixmapFromImageInPlace(std_::move(cornersImage));
|
||||
_corners.setDevicePixelRatio(cRetinaFactor());
|
||||
}
|
||||
|
||||
void RectShadow::paint(Painter &p, const QRect &box, int shifty, Sides sides) {
|
||||
if (!_size) return;
|
||||
|
||||
int32 rshifty = shifty * cIntRetinaFactor();
|
||||
int32 count = _thickness, countsize = count / cIntRetinaFactor(), minus = _size - countsize + shifty;
|
||||
bool left = (sides & Side::Left), top = (sides & Side::Top), right = (sides & Side::Right), bottom = (sides & Side::Bottom);
|
||||
if (left && top) p.drawPixmap(box.left() - _size + minus, box.top() - _size + minus + shifty, _corners, 0, 0, _pixsize, _pixsize);
|
||||
if (right && top) p.drawPixmap(box.left() + box.width() - minus, box.top() - _size + minus + shifty, _corners, _pixsize, 0, _pixsize, _pixsize);
|
||||
if (right && bottom) p.drawPixmap(box.left() + box.width() - minus, box.top() + box.height() - minus + shifty, _corners, _pixsize, _pixsize, _pixsize, _pixsize);
|
||||
if (left && bottom) p.drawPixmap(box.left() - _size + minus, box.top() + box.height() - minus + shifty, _corners, 0, _pixsize, _pixsize, _pixsize);
|
||||
|
||||
bool wasSmooth = p.renderHints().testFlag(QPainter::SmoothPixmapTransform);
|
||||
if (wasSmooth) p.setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||
if (left) p.drawPixmap(box.left() - countsize + shifty, box.top() + (top ? minus : 0) + shifty, countsize - shifty, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _left, 0, 0, count - rshifty, 1);
|
||||
if (top) p.drawPixmap(box.left() + (left ? minus : 0), box.top() - countsize + 2 * shifty, box.width() - (right ? minus : 0) - (left ? minus : 0), countsize - 2 * shifty, _top, 0, 0, 1, count - 2 * rshifty);
|
||||
if (right) p.drawPixmap(box.left() + box.width(), box.top() + (top ? minus : 0) + shifty, countsize - shifty, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _right, rshifty, 0, count - rshifty, 1);
|
||||
if (bottom) p.drawPixmap(box.left() + (left ? minus : 0), box.top() + box.height(), box.width() - (right ? minus : 0) - (left ? minus : 0), countsize, _bottom, 0, 0, 1, count);
|
||||
if (wasSmooth) p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
}
|
||||
|
||||
style::margins RectShadow::getDimensions(int32 shifty) const {
|
||||
int d = _thickness / cIntRetinaFactor();
|
||||
return style::margins(d - shifty, d - 2 * shifty, d - shifty, d);
|
||||
}
|
||||
|
||||
} // namespace Ui
|
@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "ui/flatinput.h"
|
||||
#include "ui/scrollarea.h"
|
||||
#include "ui/flatbutton.h"
|
||||
#include "ui/boxshadow.h"
|
||||
#include "ui/effects/rect_shadow.h"
|
||||
#include "boxes/abstractbox.h"
|
||||
|
||||
QString findValidCode(QString fullCode);
|
||||
|
101
Telegram/SourceFiles/ui/effects/rect_shadow.cpp
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
It is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
In addition, as a special exception, the copyright holders give permission
|
||||
to link the code of portions of this program with the OpenSSL library.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "ui/effects/rect_shadow.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
RectShadow::RectShadow(const style::icon &topLeft) : _size(topLeft.width()), _pixsize(_size * cIntRetinaFactor()) {
|
||||
if (!_size) return;
|
||||
|
||||
QImage cornersImage(_pixsize * 2, _pixsize * 2, QImage::Format_ARGB32_Premultiplied);
|
||||
cornersImage.setDevicePixelRatio(cRetinaFactor());
|
||||
{
|
||||
Painter p(&cornersImage);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
topLeft.paint(p, QPoint(0, 0), _size);
|
||||
}
|
||||
if (rtl()) cornersImage = cornersImage.mirrored(true, false);
|
||||
{
|
||||
QPainter p(&cornersImage);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
QImage m = cornersImage.mirrored();
|
||||
m.setDevicePixelRatio(cRetinaFactor());
|
||||
p.drawImage(0, _size, m, 0, _pixsize, _pixsize, _pixsize);
|
||||
}
|
||||
{
|
||||
QPainter p(&cornersImage);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
QImage m = cornersImage.mirrored(true, false);
|
||||
m.setDevicePixelRatio(cRetinaFactor());
|
||||
p.drawImage(_size, 0, m, _pixsize, 0, _pixsize, _pixsize * 2);
|
||||
}
|
||||
|
||||
uchar prev = 0;
|
||||
for (int i = 0; i < _pixsize; ++i) {
|
||||
uchar a = (cornersImage.pixel(QPoint(i, _pixsize - 1)) >> 24);
|
||||
if (a < prev) break;
|
||||
|
||||
++_thickness;
|
||||
prev = a;
|
||||
}
|
||||
|
||||
_left = App::pixmapFromImageInPlace(cornersImage.copy(0, _pixsize - 1, _thickness, 1));
|
||||
_left.setDevicePixelRatio(cRetinaFactor());
|
||||
_top = App::pixmapFromImageInPlace(cornersImage.copy(_pixsize - 1, 0, 1, _thickness));
|
||||
_top.setDevicePixelRatio(cRetinaFactor());
|
||||
_right = App::pixmapFromImageInPlace(cornersImage.copy(_pixsize * 2 - _thickness, _pixsize, _thickness, 1));
|
||||
_right.setDevicePixelRatio(cRetinaFactor());
|
||||
_bottom = App::pixmapFromImageInPlace(cornersImage.copy(_pixsize, _pixsize * 2 - _thickness, 1, _thickness));
|
||||
_bottom.setDevicePixelRatio(cRetinaFactor());
|
||||
|
||||
_corners = App::pixmapFromImageInPlace(std_::move(cornersImage));
|
||||
_corners.setDevicePixelRatio(cRetinaFactor());
|
||||
}
|
||||
|
||||
void RectShadow::paint(Painter &p, const QRect &box, int shifty, Sides sides) {
|
||||
if (!_size) return;
|
||||
|
||||
int32 rshifty = shifty * cIntRetinaFactor();
|
||||
int32 count = _thickness, countsize = count / cIntRetinaFactor(), minus = _size - countsize + shifty;
|
||||
bool left = (sides & Side::Left), top = (sides & Side::Top), right = (sides & Side::Right), bottom = (sides & Side::Bottom);
|
||||
if (left && top) p.drawPixmap(box.left() - _size + minus, box.top() - _size + minus + shifty, _corners, 0, 0, _pixsize, _pixsize);
|
||||
if (right && top) p.drawPixmap(box.left() + box.width() - minus, box.top() - _size + minus + shifty, _corners, _pixsize, 0, _pixsize, _pixsize);
|
||||
if (right && bottom) p.drawPixmap(box.left() + box.width() - minus, box.top() + box.height() - minus + shifty, _corners, _pixsize, _pixsize, _pixsize, _pixsize);
|
||||
if (left && bottom) p.drawPixmap(box.left() - _size + minus, box.top() + box.height() - minus + shifty, _corners, 0, _pixsize, _pixsize, _pixsize);
|
||||
|
||||
bool wasSmooth = p.renderHints().testFlag(QPainter::SmoothPixmapTransform);
|
||||
if (wasSmooth) p.setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||
if (left) p.drawPixmap(box.left() - countsize + shifty, box.top() + (top ? minus : 0) + shifty, countsize - shifty, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _left, 0, 0, count - rshifty, 1);
|
||||
if (top) p.drawPixmap(box.left() + (left ? minus : 0), box.top() - countsize + 2 * shifty, box.width() - (right ? minus : 0) - (left ? minus : 0), countsize - 2 * shifty, _top, 0, 0, 1, count - 2 * rshifty);
|
||||
if (right) p.drawPixmap(box.left() + box.width(), box.top() + (top ? minus : 0) + shifty, countsize - shifty, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _right, rshifty, 0, count - rshifty, 1);
|
||||
if (bottom) p.drawPixmap(box.left() + (left ? minus : 0), box.top() + box.height(), box.width() - (right ? minus : 0) - (left ? minus : 0), countsize, _bottom, 0, 0, 1, count);
|
||||
if (wasSmooth) p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
}
|
||||
|
||||
style::margins RectShadow::getDimensions(int32 shifty) const {
|
||||
if (!_size) return style::margins(0, 0, 0, 0);
|
||||
|
||||
int d = _thickness / cIntRetinaFactor();
|
||||
return style::margins(d - shifty, d - 2 * shifty, d - shifty, d);
|
||||
}
|
||||
|
||||
} // namespace Ui
|
@ -20,29 +20,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
class BoxShadow {
|
||||
public:
|
||||
|
||||
enum {
|
||||
Left = 1,
|
||||
Top = 2,
|
||||
Right = 4,
|
||||
Bottom = 8
|
||||
};
|
||||
|
||||
BoxShadow(const style::sprite &topLeft);
|
||||
|
||||
void paint(QPainter &p, const QRect &box, int32 shifty, int32 flags = Left | Top | Right | Bottom);
|
||||
style::margins getDimensions(int32 shifty) const;
|
||||
|
||||
private:
|
||||
|
||||
int32 _size, _pixsize;
|
||||
QPixmap _corners, _left, _top, _right, _bottom;
|
||||
QVector<style::color> _colors;
|
||||
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
|
||||
class RectShadow {
|
||||
@ -62,7 +39,6 @@ public:
|
||||
style::margins getDimensions(int shifty) const;
|
||||
|
||||
private:
|
||||
|
||||
int _size, _pixsize;
|
||||
int _thickness = 0;
|
||||
QPixmap _corners, _left, _top, _right, _bottom;
|
||||
@ -70,4 +46,4 @@ private:
|
||||
};
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(RectShadow::Sides);
|
||||
|
||||
} // namespace Ui
|
||||
} // namespace Ui
|
@ -21,6 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "stdafx.h"
|
||||
#include "ui/flatinput.h"
|
||||
|
||||
#include "ui/popupmenu.h"
|
||||
#include "mainwindow.h"
|
||||
#include "countryinput.h"
|
||||
#include "lang.h"
|
||||
|
@ -19,8 +19,9 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "ui/flatlabel.h"
|
||||
|
||||
#include "ui/popupmenu.h"
|
||||
#include "mainwindow.h"
|
||||
#include "lang.h"
|
||||
|
||||
|
@ -20,6 +20,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
class PopupMenu;
|
||||
|
||||
class FlatLabel : public TWidget, public ClickHandlerHost {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -21,6 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "stdafx.h"
|
||||
#include "flattextarea.h"
|
||||
|
||||
#include "ui/popupmenu.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
QByteArray FlatTextarea::serializeTagsList(const TagList &tags) {
|
||||
|
@ -20,7 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/boxshadow.h"
|
||||
#include "ui/effects/rect_shadow.h"
|
||||
|
||||
class ScrollArea;
|
||||
|
||||
|
@ -25,43 +25,27 @@
|
||||
|
||||
#include "lang.h"
|
||||
|
||||
PopupMenu::PopupMenu(const style::PopupMenu &st) : TWidget(0)
|
||||
PopupMenu::PopupMenu(const style::PopupMenu &st) : TWidget(nullptr)
|
||||
, _st(st)
|
||||
, _menu(0)
|
||||
, _parent(0)
|
||||
, _itemHeight(_st.itemPadding.top() + _st.itemFont->height + _st.itemPadding.bottom())
|
||||
, _separatorHeight(_st.separatorPadding.top() + _st.separatorWidth + _st.separatorPadding.bottom())
|
||||
, _mouseSelection(false)
|
||||
, _shadow(_st.shadow)
|
||||
, _selected(-1)
|
||||
, _childMenuIndex(-1)
|
||||
, a_opacity(1)
|
||||
, _a_hide(animation(this, &PopupMenu::step_hide))
|
||||
, _deleteOnHide(true)
|
||||
, _triggering(false)
|
||||
, _deleteLater(false) {
|
||||
, _a_hide(animation(this, &PopupMenu::step_hide)) {
|
||||
init();
|
||||
}
|
||||
|
||||
PopupMenu::PopupMenu(QMenu *menu, const style::PopupMenu &st) : TWidget(0)
|
||||
, _st(st)
|
||||
, _menu(menu)
|
||||
, _parent(0)
|
||||
, _itemHeight(_st.itemPadding.top() + _st.itemFont->height + _st.itemPadding.bottom())
|
||||
, _separatorHeight(_st.separatorPadding.top() + _st.separatorWidth + _st.separatorPadding.bottom())
|
||||
, _mouseSelection(false)
|
||||
, _shadow(_st.shadow)
|
||||
, _selected(-1)
|
||||
, _childMenuIndex(-1)
|
||||
, a_opacity(1)
|
||||
, _a_hide(animation(this, &PopupMenu::step_hide))
|
||||
, _deleteOnHide(true)
|
||||
, _triggering(false)
|
||||
, _deleteLater(false) {
|
||||
, _a_hide(animation(this, &PopupMenu::step_hide)) {
|
||||
init();
|
||||
QList<QAction*> actions(menu->actions());
|
||||
for (int32 i = 0, l = actions.size(); i < l; ++i) {
|
||||
addAction(actions.at(i));
|
||||
for (auto action : menu->actions()) {
|
||||
addAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +101,7 @@ int32 PopupMenu::processAction(QAction *a, int32 index, int32 w) {
|
||||
int32 textw = _st.itemFont->width(texts.at(0));
|
||||
int32 goodw = _padding.left() + _st.itemPadding.left() + textw + _st.itemPadding.right() + _padding.right();
|
||||
if (_menus.at(index)) {
|
||||
goodw += _st.itemPadding.left() + _st.arrow.pxWidth();
|
||||
goodw += _st.itemPadding.left() + _st.arrow.width();
|
||||
} else if (texts.size() > 1) {
|
||||
goodw += _st.itemPadding.left() + _st.itemFont->width(texts.at(1));
|
||||
}
|
||||
@ -212,7 +196,7 @@ void PopupMenu::paintEvent(QPaintEvent *e) {
|
||||
p.setPen(selected ? _st.itemFgOver : (enabled ? _st.itemFg : _st.itemFgDisabled));
|
||||
p.drawTextLeft(_st.itemPadding.left(), _st.itemPadding.top(), _inner.width(), _texts.at(i));
|
||||
if (_menus.at(i)) {
|
||||
p.drawSpriteRight(_st.itemPadding.right(), (_itemHeight - _st.arrow.pxHeight()) / 2, _inner.width(), _st.arrow);
|
||||
_st.arrow.paint(p, _inner.width() - _st.itemPadding.right() - _st.arrow.width(), (_itemHeight - _st.arrow.height()) / 2, _inner.width());
|
||||
} else if (!_shortcutTexts.at(i).isEmpty()) {
|
||||
p.setPen(selected ? _st.itemFgShortcutOver : (enabled ? _st.itemFgShortcut : _st.itemFgShortcutDisabled));
|
||||
p.drawTextRight(_st.itemPadding.right(), _st.itemPadding.top(), _inner.width(), _shortcutTexts.at(i));
|
||||
|
@ -18,12 +18,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui/text/text.h"
|
||||
#include "ui/effects/rect_shadow.h"
|
||||
|
||||
class PopupMenu : public TWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
PopupMenu(const style::PopupMenu &st = st::defaultPopupMenu);
|
||||
PopupMenu(QMenu *menu, const style::PopupMenu &st = st::defaultPopupMenu);
|
||||
QAction *addAction(const QString &text, const QObject *receiver, const char* member);
|
||||
@ -41,23 +41,20 @@ public:
|
||||
~PopupMenu();
|
||||
|
||||
protected:
|
||||
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void leaveEvent(QEvent *e);
|
||||
void enterEvent(QEvent *e);
|
||||
void focusOutEvent(QFocusEvent *e);
|
||||
void hideEvent(QHideEvent *e);
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
void mouseMoveEvent(QMouseEvent *e) override;
|
||||
void mousePressEvent(QMouseEvent *e) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
void enterEvent(QEvent *e) override;
|
||||
void focusOutEvent(QFocusEvent *e) override;
|
||||
void hideEvent(QHideEvent *e) override;
|
||||
|
||||
public slots:
|
||||
|
||||
void actionChanged();
|
||||
|
||||
private:
|
||||
|
||||
void updateSelected();
|
||||
|
||||
void childHiding(PopupMenu *child);
|
||||
@ -85,10 +82,10 @@ private:
|
||||
|
||||
typedef QVector<PopupMenu*> PopupMenus;
|
||||
|
||||
QMenu *_menu;
|
||||
QMenu *_menu = nullptr;
|
||||
Actions _actions;
|
||||
PopupMenus _menus;
|
||||
PopupMenu *_parent;
|
||||
PopupMenu *_parent = nullptr;
|
||||
QStringList _texts, _shortcutTexts;
|
||||
|
||||
int32 _itemHeight, _separatorHeight;
|
||||
@ -96,16 +93,19 @@ private:
|
||||
style::margins _padding;
|
||||
|
||||
QPoint _mouse;
|
||||
bool _mouseSelection;
|
||||
bool _mouseSelection = false;
|
||||
|
||||
BoxShadow _shadow;
|
||||
int32 _selected, _childMenuIndex;
|
||||
Ui::RectShadow _shadow;
|
||||
int _selected = -1;
|
||||
int _childMenuIndex = -1;
|
||||
|
||||
QPixmap _cache;
|
||||
anim::fvalue a_opacity;
|
||||
Animation _a_hide;
|
||||
|
||||
bool _deleteOnHide, _triggering, _deleteLater;
|
||||
bool _deleteOnHide = true;
|
||||
bool _triggering = false;
|
||||
bool _deleteLater = false;
|
||||
|
||||
};
|
||||
|
||||
@ -123,7 +123,6 @@ class PopupTooltip : public TWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
bool eventFilter(QObject *o, QEvent *e);
|
||||
|
||||
static void Show(int32 delay, const AbstractTooltipShower *shower);
|
||||
@ -132,18 +131,15 @@ public:
|
||||
~PopupTooltip();
|
||||
|
||||
public slots:
|
||||
|
||||
void onShow();
|
||||
void onWndActiveChanged();
|
||||
void onHideByLeave();
|
||||
|
||||
protected:
|
||||
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void hideEvent(QHideEvent *e);
|
||||
|
||||
private:
|
||||
|
||||
PopupTooltip();
|
||||
|
||||
void popup(const QPoint &p, const QString &text, const style::Tooltip *st);
|
||||
|
@ -412,6 +412,8 @@
|
||||
'<(src_loc)/ui/effects/fade_animation.h',
|
||||
'<(src_loc)/ui/effects/radial_animation.cpp',
|
||||
'<(src_loc)/ui/effects/radial_animation.h',
|
||||
'<(src_loc)/ui/effects/rect_shadow.cpp',
|
||||
'<(src_loc)/ui/effects/rect_shadow.h',
|
||||
'<(src_loc)/ui/style/style_core.cpp',
|
||||
'<(src_loc)/ui/style/style_core.h',
|
||||
'<(src_loc)/ui/style/style_core_color.cpp',
|
||||
@ -439,8 +441,6 @@
|
||||
'<(src_loc)/ui/widgets/widget_slide_wrap.h',
|
||||
'<(src_loc)/ui/animation.cpp',
|
||||
'<(src_loc)/ui/animation.h',
|
||||
'<(src_loc)/ui/boxshadow.cpp',
|
||||
'<(src_loc)/ui/boxshadow.h',
|
||||
'<(src_loc)/ui/button.cpp',
|
||||
'<(src_loc)/ui/button.h',
|
||||
'<(src_loc)/ui/popupmenu.cpp',
|
||||
|