search merged to os x version, fixed some retina render, custom notifies code moved to window module

This commit is contained in:
John Preston 2014-07-06 07:32:21 +04:00
parent 29d6bf46c8
commit 1167117ee0
38 changed files with 743 additions and 3679 deletions

View File

@ -30,6 +30,8 @@ counterBG: #b42f35;
counterMuteBG: #777;
counterColor: #fff;
lineWidth: 1px;
transparent: rgba(255, 255, 255, 0);
white: rgba(255, 255, 255, 255);
black: rgba(0, 0, 0, 255);
@ -1000,6 +1002,7 @@ btnCancelSearch: iconedButton(btnNewGroup) {
notifyBG: white;
notifyBorder: #f1f1f1;
notifyBorderWidth: 1px;
notifySlowHide: 4000;
notifyPhotoSize: 62px;
notifyPhotoPos: point(9px, 9px);

View File

@ -113,7 +113,7 @@ namespace App {
Window *w(wnd());
if (w) {
w->tempDirDelete();
w->psClearNotifyFast();
w->notifyClearFast();
w->setupIntro(true);
}
MainWidget *m(main());
@ -1828,7 +1828,7 @@ namespace App {
setQuiting();
if (wnd()) {
wnd()->psClearNotifyFast();
wnd()->notifyClearFast();
}
if (app()) {
app()->quit();

View File

@ -85,6 +85,16 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
QFontDatabase::addApplicationFont(qsl(":/gui/art/OpenSans-Bold.ttf"));
QFontDatabase::addApplicationFont(qsl(":/gui/art/OpenSans-Semibold.ttf"));
{
QImage img(800, 600, QImage::Format_ARGB32_Premultiplied);
QPainter p(&img);
QFont f;
f.setPixelSize(24);
f.setFamily("Open Sans Semibold");
p.setFont(f);
p.drawText(0, 0, "t");
}
float64 dpi = primaryScreen()->logicalDotsPerInch();
if (dpi <= 108) { // 0-96-108
cSetScreenScale(dbisOne);

View File

@ -179,8 +179,7 @@ void AddContactBox::paintEvent(QPaintEvent *e) {
p.fillRect(0, size().height() - st::btnSelectCancel.height - st::scrollDef.bottomsh, _width, st::scrollDef.bottomsh, st::scrollDef.shColor->b);
// paint button sep
p.setPen(st::btnSelectSep->p);
p.drawLine(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::btnSelectCancel.width, size().height() - 1);
p.fillRect(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
// draw box title / text
p.setPen(st::black->p);

View File

@ -587,8 +587,7 @@ void AddParticipantBox::paintEvent(QPaintEvent *e) {
p.fillRect(0, st::participantFilter.height, _width, st::scrollDef.topsh, st::scrollDef.shColor->b);
// paint button sep
p.setPen(st::btnSelectSep->p);
p.drawLine(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::btnSelectCancel.width, size().height() - 1);
p.fillRect(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
// draw box title / text
p.setPen(st::black->p);

View File

@ -82,8 +82,7 @@ void ConfirmBox::paintEvent(QPaintEvent *e) {
p.fillRect(0, _height - st::btnSelectCancel.height - st::scrollDef.bottomsh, _width, st::scrollDef.bottomsh, st::scrollDef.shColor->b);
// paint button sep
p.setPen(st::btnSelectSep->p);
p.drawLine(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::btnSelectCancel.width, _height - 1);
p.fillRect(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
// draw box title / text
p.setFont(st::boxFont->f);

View File

@ -136,8 +136,7 @@ void ConnectionBox::paintEvent(QPaintEvent *e) {
p.fillRect(0, _height - st::btnSelectCancel.height - st::scrollDef.bottomsh, _width, st::scrollDef.bottomsh, st::scrollDef.shColor->b);
// paint button sep
p.setPen(st::btnSelectSep->p);
p.drawLine(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::btnSelectCancel.width, _height - 1);
p.fillRect(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
// draw box title / text
p.setFont(st::addContactTitleFont->f);

View File

@ -479,8 +479,7 @@ void ContactsBox::paintEvent(QPaintEvent *e) {
p.fillRect(0, _addContact.height(), _width, st::scrollDef.topsh, st::scrollDef.shColor->b);
// paint button sep
p.setPen(st::btnSelectSep->p);
p.drawLine(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::btnSelectCancel.width, size().height() - 1);
p.fillRect(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
// draw box title / text
p.setPen(st::black->p);

View File

@ -109,8 +109,7 @@ void DownloadPathBox::paintEvent(QPaintEvent *e) {
p.fillRect(0, _height - st::btnSelectCancel.height - st::scrollDef.bottomsh, _width, st::scrollDef.bottomsh, st::scrollDef.shColor->b);
// paint button sep
p.setPen(st::btnSelectSep->p);
p.drawLine(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::btnSelectCancel.width, _height - 1);
p.fillRect(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
// draw box title / text
p.setFont(st::addContactTitleFont->f);

View File

@ -530,8 +530,7 @@ void NewGroupBox::paintEvent(QPaintEvent *e) {
p.fillRect(0, st::participantFilter.height, _width, st::scrollDef.topsh, st::scrollDef.shColor->b);
// paint button sep
p.setPen(st::btnSelectSep->p);
p.drawLine(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::btnSelectCancel.width, size().height() - 1);
p.fillRect(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
// draw box title / text
p.setPen(st::black->p);
@ -677,8 +676,7 @@ void CreateGroupBox::paintEvent(QPaintEvent *e) {
p.fillRect(0, _height - st::btnSelectCancel.height - st::scrollDef.bottomsh, _width, st::scrollDef.bottomsh, st::scrollDef.shColor->b);
// paint button sep
p.setPen(st::btnSelectSep->p);
p.drawLine(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::btnSelectCancel.width, size().height() - 1);
p.fillRect(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
// draw box title / text
p.setPen(st::black->p);

View File

@ -218,8 +218,7 @@ void PhotoCropBox::paintEvent(QPaintEvent *e) {
p.fillRect(0, _height - st::btnSelectCancel.height - st::scrollDef.bottomsh, _width, st::scrollDef.bottomsh, st::scrollDef.shColor->b);
// paint button sep
p.setPen(st::btnSelectSep->p);
p.drawLine(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::btnSelectCancel.width, _height - 1);
p.fillRect(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
p.setFont(st::boxFont->f);
p.setPen(st::boxGrayTitle->p);

View File

@ -91,8 +91,7 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
p.fillRect(0, _height - st::btnSelectCancel.height - st::scrollDef.bottomsh, _width, st::scrollDef.bottomsh, st::scrollDef.shColor->b);
// paint button sep
p.setPen(st::btnSelectSep->p);
p.drawLine(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::btnSelectCancel.width, _height - 1);
p.fillRect(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
p.setFont(st::boxFont->f);
p.setPen(st::boxGrayTitle->p);

View File

@ -171,7 +171,7 @@ enum {
NoUpdatesTimeout = 180 * 1000, // if nothing is received in 3 min we reconnect
MemoryForImageCache = 64 * 1024 * 1024, // after 64mb of unpacked images we try to clear some memory
NotifyWindows = 3, // 3 desktop notifies at the same time
NotifyWindowsCount = 3, // 3 desktop notifies at the same time
NotifyWaitTimeout = 1200, // 1.2 seconds timeout before notification
NotifySettingSaveTimeout = 1000, // wait 1 second before saving notify setting to server
UpdateChunk = 100 * 1024, // 100kb parts when downloading the update

View File

@ -1169,7 +1169,7 @@ void DialogsWidget::onFilterUpdate() {
list.onFilterUpdate(filterText);
DialogsListWidget::State s = list.state();
bool switcherVisible = (s != DialogsListWidget::DefaultState);
if (switcherVisible && _stateSwitcher.isHidden() || !switcherVisible && !_stateSwitcher.isHidden()) {
if ((switcherVisible && _stateSwitcher.isHidden()) || (!switcherVisible && !_stateSwitcher.isHidden())) {
if (switcherVisible) {
_stateSwitcher.show();
} else {
@ -1232,10 +1232,7 @@ void DialogsWidget::keyPressEvent(QKeyEvent *e) {
void DialogsWidget::paintEvent(QPaintEvent *e) {
QPainter p(this);
if (_drawShadow) {
p.setPen(st::dlgShadowColor->p);
for (int i = 0, w = width() - st::dlgShadow; i < st::dlgShadow; ++i) {
p.drawLine(w + i, 0, w + i, height());
}
p.fillRect(width() - st::dlgShadow, 0, st::dlgShadow, height(), st::dlgShadowColor->b);
}
}

View File

@ -71,10 +71,8 @@ void Dropdown::paintEvent(QPaintEvent *e) {
int32 top = st::dropdownPadding.top() + _buttons.front()->height();
p.setPen(st::dropdownBorderColor->p);
for (int32 i = 1, s = _buttons.size(); i < s; ++i) {
for (int32 e = top + st::dropdownBorder; top < e; ++top) {
p.drawLine(st::dropdownPadding.left(), top, _width - st::dropdownPadding.right() - 1, top);
}
top += _buttons[i]->height();
p.fillRect(st::dropdownPadding.left(), top, _width - st::dropdownPadding.left() - st::dropdownPadding.right(), st::dropdownBorder, st::dropdownBorderColor->b);
top += st::dropdownBorder + _buttons[i]->height();
}
}
}

View File

@ -66,9 +66,9 @@ void BoxShadow::paint(QPainter &p, const QRect &box, const QPoint &shift, int32
if (left && bottom) p.drawPixmap(box.left() - _size + minus + shift.x(), box.bottom() - minus + 1 + shift.y(), _corners, 0, _size, _size, _size);
for (int32 i = 1; i <= count; ++i) {
p.setPen(_colors[i - 1]->p);
if (top) p.drawLine(box.left() + (left ? minus : 0) + shift.x(), box.top() - count + i + shift.y(), box.right() - (right ? minus : 0) + shift.x(), box.top() - count + i + shift.y());
if (right) p.drawLine(box.right() + count - i + shift.x(), box.top() + (top ? minus : 0) + shift.y(), box.right() + count - i + shift.x(), box.bottom() - (bottom ? minus : 0) + shift.y());
if (bottom) p.drawLine(box.right() - (right ? minus : 0) + shift.x(), box.bottom() + count - i + shift.y(), box.left() + (left ? minus : 0) + shift.x(), box.bottom() + count - i + shift.y());
if (left) p.drawLine(box.left() - count + i + shift.x(), box.bottom() - (bottom ? minus : 0) + shift.y(), box.left() - count + i + shift.x(), box.top() + (top ? minus : 0) + shift.y());
if (top) p.fillRect(box.left() + (left ? minus : 0) + shift.x(), box.top() - count + i + shift.y(), box.width() - (right ? minus : 0) - (left ? minus : 0), st::lineWidth, _colors[i - 1]->b);
if (right) p.fillRect(box.right() + count - i + shift.x(), box.top() + (top ? minus : 0) + shift.y(), st::lineWidth, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _colors[i - 1]->b);
if (bottom) p.fillRect(box.left() + (left ? minus : 0) + shift.x(), box.bottom() + count - i + shift.y(), box.width() - (right ? minus : 0) - (left ? minus : 0), st::lineWidth, _colors[i - 1]->b);
if (left) p.fillRect(box.left() - count + i + shift.x(), box.top() + (top ? minus : 0) + shift.y(), st::lineWidth, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _colors[i - 1]->b);
}
}

View File

@ -492,8 +492,7 @@ void CountrySelect::paintEvent(QPaintEvent *e) {
p.fillRect(_innerLeft, _innerTop + st::participantFilter.height, _innerWidth, st::scrollDef.topsh, st::scrollDef.shColor->b);
// paint button sep
p.setPen(st::btnSelectSep->p);
p.drawLine(_innerLeft + st::btnSelectCancel.width, _innerTop + _innerHeight - st::btnSelectCancel.height, _innerLeft + st::btnSelectCancel.width, _innerTop + _innerHeight - 1);
p.fillRect(_innerLeft + st::btnSelectCancel.width, _innerTop + _innerHeight - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
// draw box title / text
p.setPen(st::black->p);

View File

@ -101,8 +101,7 @@ BottomButton::BottomButton(QWidget *w, const QString &t, const style::flatButton
void BottomButton::paintEvent(QPaintEvent *e) {
QPainter p(this);
p.setPen(st::scrollDef.shColor->p);
p.drawLine(0, 0, width(), 0);
p.fillRect(0, 0, width(), st::lineWidth, st::scrollDef.shColor->b);
FlatButton::paintEvent(e);
}

View File

@ -133,10 +133,11 @@ void FlatInput::paintEvent(QPaintEvent *e) {
QPainter p(this);
p.fillRect(rect(), a_bgColor.current());
if (_st.borderWidth) {
p.setPen(a_borderColor.current());
for (uint32 i = 0; i < _st.borderWidth; ++i) {
p.drawRect(i, i, width() - 2 * i - 1, height() - 2 * i - 1);
}
QBrush b(a_borderColor.current());
p.fillRect(0, 0, width() - _st.borderWidth, _st.borderWidth, b);
p.fillRect(width() - _st.borderWidth, 0, _st.borderWidth, height() - _st.borderWidth, b);
p.fillRect(_st.borderWidth, height() - _st.borderWidth, width() - _st.borderWidth, _st.borderWidth, b);
p.fillRect(0, _st.borderWidth, _st.borderWidth, height() - _st.borderWidth, b);
}
if (_st.imgRect.pxWidth()) {
p.drawPixmap(_st.imgPos, App::sprite(), _st.imgRect);

View File

@ -115,10 +115,10 @@ void Switcher::paintEvent(QPaintEvent *e) {
}
}
if (_st.border) {
p.setPen(_st.borderColor->p);
for (uint32 i = 0; i < _st.border; ++i) {
p.drawRect(i, i, width() - 2 * i - 1, height() - 2 * i - 1);
}
p.fillRect(0, 0, width() - _st.border, _st.border, _st.borderColor->b);
p.fillRect(width() - _st.border, 0, _st.border, height() - _st.border, _st.borderColor->b);
p.fillRect(_st.border, height() - _st.border, width() - _st.border, _st.border, _st.borderColor->b);
p.fillRect(0, _st.border, _st.border, height() - _st.border, _st.borderColor->b);
}
}

View File

@ -1253,7 +1253,7 @@ void History::inboxRead(bool byThisInstance) {
if (!dialogs.isEmpty()) {
if (App::main()) App::main()->dlgUpdated(dialogs[0]);
}
App::wnd()->psClearNotify(this);
App::wnd()->notifyClear(this);
clearNotifications();
}
@ -1392,7 +1392,7 @@ void History::loadAround(MsgId msgId) {
if (!loadedAtBottom()) {
clear(true);
}
newLoaded = isEmpty() || last && !last->detached();
newLoaded = isEmpty() || (last && !last->detached());
}
}
}
@ -3462,8 +3462,7 @@ void HistoryUnreadBar::setCount(int32 count) {
void HistoryUnreadBar::draw(QPainter &p, uint32 selection) const {
p.fillRect(0, 1, _history->width, st::unreadBarHeight - 2, st::unreadBarBG->b);
p.setPen(st::unreadBarBorder->p);
p.drawLine(0, st::unreadBarHeight - 1, _history->width, st::unreadBarHeight - 1);
p.fillRect(0, st::unreadBarHeight - st::lineWidth, _history->width, st::lineWidth, st::unreadBarBorder->b);
p.setFont(st::unreadBarFont->f);
p.setPen(st::unreadBarColor->p);
p.drawText(QRect(0, 0, _history->width, st::unreadBarHeight - 1), text, style::al_center);

View File

@ -554,7 +554,7 @@ void HistoryList::mouseReleaseEvent(QMouseEvent *e) {
}
void HistoryList::mouseDoubleClickEvent(QMouseEvent *e) {
if ((_dragAction == Selecting && !_selected.isEmpty() && _selected.cbegin().value() != FullItemSel || _dragAction == NoDrag && (_selected.isEmpty() || _selected.cbegin().value() != FullItemSel)) && _dragSelType == TextSelectLetters && _dragItem) {
if (((_dragAction == Selecting && !_selected.isEmpty() && _selected.cbegin().value() != FullItemSel) || (_dragAction == NoDrag && (_selected.isEmpty() || _selected.cbegin().value() != FullItemSel))) && _dragSelType == TextSelectLetters && _dragItem) {
bool afterDragSymbol, uponSelected;
uint16 symbol;
_dragItem->getSymbol(symbol, afterDragSymbol, uponSelected, _dragStartPos.x(), _dragStartPos.y());
@ -1334,8 +1334,7 @@ void HistoryHider::paintEvent(QPaintEvent *e) {
p.fillRect(box.x(), box.y() + box.height() - st::btnSelectCancel.height - st::scrollDef.bottomsh, box.width(), st::scrollDef.bottomsh, st::scrollDef.shColor->b);
// paint button sep
p.setPen(st::btnSelectSep->p);
p.drawLine(box.x() + st::btnSelectCancel.width, box.y() + box.height() - st::btnSelectCancel.height, box.x() + st::btnSelectCancel.width, box.y() + box.height() - 1);
p.fillRect(box.x() + st::btnSelectCancel.width, box.y() + box.height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
p.setPen(st::black->p);
toText.drawElided(p, box.left() + (box.width() - toTextWidth) / 2, box.top() + st::boxPadding.top(), toTextWidth + 1);
@ -1820,7 +1819,7 @@ void HistoryWidget::newUnreadMsg(History *history, MsgId msgId) {
}
} else {
if (hist != history) {
App::wnd()->psNotify(history, msgId);
App::wnd()->notifySchedule(history, msgId);
}
history->setUnreadCount(history->unreadCount + 1);
}
@ -1830,7 +1829,7 @@ void HistoryWidget::newUnreadMsg(History *history, MsgId msgId) {
if (history->unreadBar) history->unreadBar->destroy();
}
}
App::wnd()->psNotify(history, msgId);
App::wnd()->notifySchedule(history, msgId);
history->setUnreadCount(history->unreadCount + 1);
history->lastWidth = 0;
}
@ -1956,7 +1955,7 @@ void HistoryWidget::messagesReceived(const MTPmessages_Messages &messages, mtpRe
addMessagesToFront(histPreload);
histPreload.clear();
loadMessages();
} else if (down && histPreloadDown.size() || !down && histPreload.size()) {
} else if ((down && histPreloadDown.size()) || (!down && histPreload.size())) {
onListScroll();
} else if (down) {
loadMessagesDown();
@ -2779,7 +2778,7 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown)
}
if (!hist->readyForWork()) return;
if (!initial && !wasAtBottom || loadedDown) {
if ((!initial && !wasAtBottom) || loadedDown) {
_scroll.scrollToY(newSt + addToY);
return;
}

View File

@ -116,7 +116,7 @@ void logsInit() {
static _StreamCreator streamCreator;
if (mainLogStream) return;
#ifdef Q_OS_MAC
#if defined Q_OS_MAC && !defined _DEBUG
cForceWorkingDir(psAppDataPath());
#endif

View File

@ -155,10 +155,7 @@ void TopBarWidget::paintEvent(QPaintEvent *e) {
int a = 0; // optimize shadow-only drawing
}
if (_drawShadow) {
p.setPen(st::titleShadowColor->p);
for (int32 i = 0; i < st::titleShadow; ++i) {
p.drawLine(st::titleShadow, st::topBarHeight + i, width(), st::topBarHeight + i);
}
p.fillRect(st::titleShadow, st::topBarHeight, width() - st::titleShadow, st::titleShadow, st::titleShadowColor->b);
}
}
@ -1314,7 +1311,7 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti
if (peerId) {
if (!history) history = App::history(peerId);
if (isNotifyMuted(setTo)) {
App::wnd()->psClearNotify(history);
App::wnd()->notifyClear(history);
history->setMute(true);
} else {
history->setMute(false);
@ -1344,7 +1341,7 @@ void MainWidget::gotNotifySetting(MTPInputNotifyPeer peer, const MTPPeerNotifySe
}
break;
}
App::wnd()->psNotifySettingGot();
App::wnd()->notifySettingGot();
}
bool MainWidget::failNotifySetting(MTPInputNotifyPeer peer) {

View File

@ -167,7 +167,7 @@ void mtpFileLoader::partLoaded(int32 offset, const MTPupload_File &result) {
}
removeFromQueue();
App::wnd()->update();
App::wnd()->psUpdateNotifies();
App::wnd()->notifyUpdateAll();
}
emit progress(this);
}

View File

@ -474,7 +474,7 @@ class RPCBindedDoneHandlerOwnedReq : public RPCOwnedDoneHandler { // done(b, res
typedef TReturn (TReceiver::*CallbackType)(T, const TResponse &, mtpRequestId);
public:
RPCBindedDoneHandlerOwnedReq(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _b(b), _onDone(onDone) {
RPCBindedDoneHandlerOwnedReq(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone), _b(b) {
}
virtual void operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) const {
if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)(_b, TResponse(from, end), requestId);

View File

@ -44,7 +44,7 @@ namespace {
void MacPrivate::activeSpaceChanged() {
if (App::wnd()) {
App::wnd()->psActivateNotifies();
App::wnd()->notifyActivateAll();
}
}
@ -54,7 +54,7 @@ void MacPrivate::notifyClicked(unsigned long long peer) {
App::wnd()->showFromTray();
App::wnd()->hideSettings();
App::main()->showPeer(history->peer->id, false, true);
App::wnd()->psClearNotify(history);
App::wnd()->notifyClear(history);
}
void MacPrivate::notifyReplied(unsigned long long peer, const char *str) {
@ -67,8 +67,6 @@ PsMainWindow::PsMainWindow(QWidget *parent) : QMainWindow(parent),
posInited(false), trayIcon(0), trayIconMenu(0), icon256(qsl(":/gui/art/iconround256.png")) {
connect(&psIdleTimer, SIGNAL(timeout()), this, SLOT(psIdleTimeout()));
psIdleTimer.setSingleShot(false);
connect(&notifyWaitTimer, SIGNAL(timeout()), this, SLOT(psNotifyFire()));
notifyWaitTimer.setSingleShot(true);
}
void PsMainWindow::psNotIdle() const {
@ -287,497 +285,39 @@ void PsMainWindow::psFlash() {
PsMainWindow::~PsMainWindow() {
finished = true;
psClearNotifyFast();
}
void PsMainWindow::psNotify(History *history, MsgId msgId) {
if (App::quiting() || !history->notifyFrom) return;
bool haveSetting = (history->peer->notify != UnknownNotifySettings);
if (haveSetting) {
if (history->peer->notify != EmptyNotifySettings && history->peer->notify->mute > unixtime()) {
history->clearNotifyFrom();
return;
}
} else {
App::wnd()->getNotifySetting(MTP_inputNotifyPeer(history->peer->input));
}
uint64 ms = getms() + NotifyWaitTimeout;
notifyWhenAlerts[history].insert(ms);
if (cDesktopNotify()) {
NotifyWhenMaps::iterator i = notifyWhenMaps.find(history);
if (i == notifyWhenMaps.end()) {
i = notifyWhenMaps.insert(history, NotifyWhenMap());
}
if (i.value().constFind(msgId) == i.value().cend()) {
i.value().insert(msgId, ms);
}
NotifyWaiters *addTo = haveSetting ? &notifyWaiters : &notifySettingWaiters;
if (addTo->constFind(history) == addTo->cend()) {
addTo->insert(history, NotifyWaiter(msgId, ms));
}
}
if (haveSetting) {
if (!notifyWaitTimer.isActive()) {
notifyWaitTimer.start(NotifyWaitTimeout);
}
}
void PsMainWindow::psClearNotifies(PeerId peerId) {
_private.clearNotifies(peerId);
}
void PsMainWindow::psNotifyFire() {
psShowNextNotify();
}
void PsMainWindow::psNotifySettingGot() {
int32 t = unixtime();
for (NotifyWaiters::iterator i = notifySettingWaiters.begin(); i != notifySettingWaiters.end();) {
History *history = i.key();
if (history->peer->notify == UnknownNotifySettings) {
++i;
} else {
if (history->peer->notify == EmptyNotifySettings || history->peer->notify->mute <= t) {
notifyWaiters.insert(i.key(), i.value());
}
i = notifySettingWaiters.erase(i);
}
}
notifyWaitTimer.stop();
psShowNextNotify();
}
void PsMainWindow::psClearNotify(History *history) {
if (!history) {
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->unlinkHistory();
}
_private.clearNotifies();
for (NotifyWhenMaps::const_iterator i = notifyWhenMaps.cbegin(), e = notifyWhenMaps.cend(); i != e; ++i) {
i.key()->clearNotifyFrom();
}
notifyWaiters.clear();
notifySettingWaiters.clear();
notifyWhenMaps.clear();
return;
}
notifyWaiters.remove(history);
notifySettingWaiters.remove(history);
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->unlinkHistory(history);
}
_private.clearNotifies(history->peer->id);
notifyWhenMaps.remove(history);
notifyWhenAlerts.remove(history);
}
void PsMainWindow::psClearNotifyFast() {
notifyWaiters.clear();
notifySettingWaiters.clear();
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->deleteLater();
}
_private.clearNotifies();
notifyWindows.clear();
notifyWhenMaps.clear();
notifyWhenAlerts.clear();
}
void PsMainWindow::psActivateNotifies() {
if (cCustomNotifies()) {
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
_private.activateWnd((*i)->winId());
}
}
void PsMainWindow::psActivateNotify(NotifyWindow *w) {
_private.activateWnd(w->winId());
}
namespace {
QRect _monitorRect;
uint64 _monitorLastGot = 0;
QRect _desktopRect() {
uint64 tnow = getms();
if (tnow > _monitorLastGot + 1000 || tnow < _monitorLastGot) {
_monitorLastGot = tnow;
_monitorRect = QApplication::desktop()->availableGeometry(App::wnd());
}
return _monitorRect;
}
QRect psDesktopRect() {
uint64 tnow = getms();
if (tnow > _monitorLastGot + 1000 || tnow < _monitorLastGot) {
_monitorLastGot = tnow;
_monitorRect = QApplication::desktop()->availableGeometry(App::wnd());
}
return _monitorRect;
}
void PsMainWindow::psShowNextNotify(PsNotifyWindow *remove) {
if (App::quiting()) return;
int32 count = NotifyWindows;
if (remove) {
for (PsNotifyWindows::iterator i = notifyWindows.begin(), e = notifyWindows.end(); i != e; ++i) {
if ((*i) == remove) {
notifyWindows.erase(i);
break;
}
}
}
uint64 ms = getms(), nextAlert = 0;
bool alert = false;
for (NotifyWhenAlerts::iterator i = notifyWhenAlerts.begin(); i != notifyWhenAlerts.end();) {
while (!i.value().isEmpty() && *i.value().begin() <= ms) {
i.value().erase(i.value().begin());
NotifySettingsPtr n = i.key()->peer->notify;
if (n == EmptyNotifySettings || (n != UnknownNotifySettings && n->mute <= unixtime())) {
alert = true;
}
}
if (i.value().isEmpty()) {
i = notifyWhenAlerts.erase(i);
} else {
if (!nextAlert || nextAlert > *i.value().begin()) {
nextAlert = *i.value().begin();
}
++i;
}
}
if (alert) {
psFlash();
App::playSound();
}
if (cCustomNotifies()) {
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
int32 ind = (*i)->index();
if (ind < 0) continue;
--count;
}
}
if (count <= 0 || !cDesktopNotify()) {
if (nextAlert) {
notifyWaitTimer.start(nextAlert - ms);
}
return;
}
QRect r = _desktopRect();
int32 x = r.x() + r.width() - st::notifyWidth - st::notifyDeltaX, y = r.y() + r.height() - st::notifyHeight - st::notifyDeltaY;
while (count > 0) {
uint64 next = 0;
HistoryItem *notifyItem = 0;
NotifyWaiters::iterator notifyWaiter;
for (NotifyWaiters::iterator i = notifyWaiters.begin(); i != notifyWaiters.end(); ++i) {
History *history = i.key();
if (history->notifyFrom && history->notifyFrom->id != i.value().msg) {
NotifyWhenMaps::iterator j = notifyWhenMaps.find(history);
if (j == notifyWhenMaps.end()) {
history->clearNotifyFrom();
i = notifyWaiters.erase(i);
continue;
}
do {
NotifyWhenMap::const_iterator k = j.value().constFind(history->notifyFrom->id);
if (k != j.value().cend()) {
i.value().msg = k.key();
i.value().when = k.value();
break;
}
history->getNextNotifyFrom();
} while (history->notifyFrom);
}
if (!history->notifyFrom) {
notifyWhenMaps.remove(history);
i = notifyWaiters.erase(i);
continue;
}
uint64 when = i.value().when;
if (!notifyItem || next > when) {
next = when;
notifyItem = history->notifyFrom;
notifyWaiter = i;
}
}
if (notifyItem) {
if (next > ms) {
if (nextAlert && nextAlert < next) {
next = nextAlert;
nextAlert = 0;
}
notifyWaitTimer.start(next - ms);
break;
} else {
if (cCustomNotifies()) {
PsNotifyWindow *notify = new PsNotifyWindow(notifyItem, x, y);
notifyWindows.push_back(notify);
notify->hide();
_private.holdOnTop(notify->winId());
notify->show();
_private.showOverAll(notify->winId());
--count;
} else {
_private.showNotify(notifyItem->history()->peer->id, notifyItem->history()->peer->name, notifyItem->notificationHeader(), notifyItem->notificationText());
}
uint64 ms = getms();
History *history = notifyItem->history();
history->getNextNotifyFrom();
NotifyWhenMaps::iterator j = notifyWhenMaps.find(history);
if (j == notifyWhenMaps.end() || !history->notifyFrom) {
history->clearNotifyFrom();
notifyWaiters.erase(notifyWaiter);
if (j != notifyWhenMaps.end()) notifyWhenMaps.erase(j);
continue;
}
j.value().remove(notifyItem->id);
do {
NotifyWhenMap::const_iterator k = j.value().constFind(history->notifyFrom->id);
if (k != j.value().cend()) {
notifyWaiter.value().msg = k.key();
notifyWaiter.value().when = k.value();
break;
}
history->getNextNotifyFrom();
} while (history->notifyFrom);
if (!history->notifyFrom) {
notifyWaiters.erase(notifyWaiter);
notifyWhenMaps.erase(j);
continue;
}
}
} else {
break;
}
}
if (nextAlert) {
notifyWaitTimer.start(nextAlert - ms);
}
count = NotifyWindows - count;
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
int32 ind = (*i)->index();
if (ind < 0) continue;
--count;
(*i)->moveTo(x, y - count * (st::notifyHeight + st::notifyDeltaY));
}
void PsMainWindow::psNotifyShown(NotifyWindow *w) {
w->hide();
_private.holdOnTop(w->winId());
w->show();
_private.showOverAll(w->winId());
}
void PsMainWindow::psStopHiding() {
if (cCustomNotifies()) {
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->stopHiding();
}
}
}
void PsMainWindow::psStartHiding() {
if (cCustomNotifies()) {
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->startHiding();
}
}
}
void PsMainWindow::psUpdateNotifies() {
if (cCustomNotifies()) {
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->updatePeerPhoto();
}
}
}
PsNotifyWindow::PsNotifyWindow(HistoryItem *item, int32 x, int32 y) : history(item->history()),// started(GetTickCount()),
close(this, st::notifyClose), alphaDuration(st::notifyFastAnim), posDuration(st::notifyFastAnim), hiding(false), _index(0), aOpacity(0), aOpacityFunc(st::notifyFastAnimFunc), aY(y + st::notifyHeight + st::notifyDeltaY) {
int32 w = st::notifyWidth, h = st::notifyHeight;
QImage img(w * cIntRetinaFactor(), h * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
if (cRetina()) img.setDevicePixelRatio(cRetinaFactor());
img.fill(st::notifyBG->c);
{
QPainter p(&img);
p.setPen(st::notifyBorder->p);
p.setBrush(Qt::NoBrush);
p.drawRect(0, 0, w - 1, h - 1);
if (history->peer->photo->loaded()) {
p.drawPixmap(st::notifyPhotoPos.x(), st::notifyPhotoPos.y(), history->peer->photo->pix(st::notifyPhotoSize));
} else {
MTP::clearLoaderPriorities();
peerPhoto = history->peer->photo;
peerPhoto->load(true, true);
}
int32 itemWidth = w - st::notifyPhotoPos.x() - st::notifyPhotoSize - st::notifyTextLeft - st::notifyClosePos.x() - st::notifyClose.width;
QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height);
if (history->peer->chat) {
p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgLeft, rectForName.top() + st::dlgChatImgTop), App::sprite(), st::dlgChatImg);
rectForName.setLeft(rectForName.left() + st::dlgChatImgSkip);
}
QDateTime now(QDateTime::currentDateTime()), lastTime(item->date);
QDate nowDate(now.date()), lastDate(lastTime.date());
QString dt = lastTime.toString(qsl("hh:mm"));
int32 dtWidth = st::dlgHistFont->m.width(dt);
rectForName.setWidth(rectForName.width() - dtWidth - st::dlgDateSkip);
p.setFont(st::dlgDateFont->f);
p.setPen(st::dlgDateColor->p);
p.drawText(rectForName.left() + rectForName.width() + st::dlgDateSkip, rectForName.top() + st::dlgHistFont->ascent, dt);
const HistoryItem *textCachedFor = 0;
Text itemTextCache(itemWidth);
bool active = false;
item->drawInDialog(p, QRect(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyItemTop + st::msgNameFont->height, itemWidth, 2 * st::dlgFont->height), active, textCachedFor, itemTextCache);
p.setPen(st::dlgNameColor->p);
history->nameText.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
}
pm = QPixmap::fromImage(img);
hideTimer.setSingleShot(true);
connect(&hideTimer, SIGNAL(timeout()), this, SLOT(hideByTimer()));
inputTimer.setSingleShot(true);
connect(&inputTimer, SIGNAL(timeout()), this, SLOT(checkLastInput()));
connect(&close, SIGNAL(clicked()), this, SLOT(unlinkHistory()));
close.setAcceptBoth(true);
close.move(w - st::notifyClose.width - st::notifyClosePos.x(), st::notifyClosePos.y());
close.show();
aY.start(y);
setGeometry(x, aY.current(), st::notifyWidth, st::notifyHeight);
aOpacity.start(1);
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
setAttribute(Qt::WA_MacAlwaysShowToolWindow);
show();
setWindowOpacity(aOpacity.current());
alphaDuration = posDuration = st::notifyFastAnim;
anim::start(this);
checkLastInput();
}
void PsNotifyWindow::checkLastInput() {
// TODO
if (true) {
hideTimer.start(st::notifyWaitLongHide);
} else {
inputTimer.start(300);
}
}
void PsNotifyWindow::moveTo(int32 x, int32 y, int32 index) {
if (index >= 0) {
_index = index;
}
move(x, aY.current());
aY.start(y);
aOpacity.restart();
posDuration = st::notifyFastAnim;
anim::start(this);
}
void PsNotifyWindow::updatePeerPhoto() {
if (!peerPhoto->isNull() && peerPhoto->loaded()) {
QImage img(pm.toImage());
{
QPainter p(&img);
p.drawPixmap(st::notifyPhotoPos.x(), st::notifyPhotoPos.y(), peerPhoto->pix(st::notifyPhotoSize));
}
peerPhoto = ImagePtr();
pm = QPixmap::fromImage(img);
update();
}
}
void PsNotifyWindow::unlinkHistory(History *hist) {
if (!hist || hist == history) {
animHide(st::notifyFastAnim, st::notifyFastAnimFunc);
history = 0;
App::wnd()->psShowNextNotify();
}
}
void PsNotifyWindow::enterEvent(QEvent */*e*/) {
if (!history) return;
if (App::wnd()) App::wnd()->psStopHiding();
}
void PsNotifyWindow::leaveEvent(QEvent */*e*/) {
if (!history) return;
App::wnd()->psStartHiding();
}
void PsNotifyWindow::startHiding() {
hideTimer.start(st::notifyWaitShortHide);
}
void PsNotifyWindow::mousePressEvent(QMouseEvent *e) {
if (!history) return;
if (e->button() == Qt::RightButton) {
unlinkHistory();
} else if (history) {
App::wnd()->showFromTray();
App::wnd()->hideSettings();
App::main()->showPeer(history->peer->id, false, true);
unlinkHistory();
e->ignore();
}
}
void PsNotifyWindow::paintEvent(QPaintEvent *e) {
QPainter p(this);
p.drawPixmap(0, 0, pm);
}
void PsNotifyWindow::animHide(float64 duration, anim::transition func) {
if (!history) return;
alphaDuration = duration;
aOpacityFunc = func;
aOpacity.start(0);
aY.restart();
hiding = true;
anim::start(this);
}
void PsNotifyWindow::stopHiding() {
if (!history) return;
alphaDuration = st::notifyFastAnim;
aOpacityFunc = st::notifyFastAnimFunc;
aOpacity.start(1);
aY.restart();
hiding = false;
hideTimer.stop();
anim::start(this);
}
void PsNotifyWindow::hideByTimer() {
if (!history) return;
animHide(st::notifySlowHide, st::notifySlowHideFunc);
}
bool PsNotifyWindow::animStep(float64 ms) {
float64 dtAlpha = ms / alphaDuration, dtPos = ms / posDuration;
if (dtAlpha >= 1) {
aOpacity.finish();
if (hiding) {
deleteLater();
}
} else {
aOpacity.update(dtAlpha, aOpacityFunc);
}
setWindowOpacity(aOpacity.current());
if (dtPos >= 1) {
aY.finish();
} else {
aY.update(dtPos, anim::linear);
}
move(x(), aY.current());
update();
return (dtAlpha < 1 || (!hiding && dtPos < 1));
}
PsNotifyWindow::~PsNotifyWindow() {
if (App::wnd()) App::wnd()->psShowNextNotify(this);
void PsMainWindow::psPlatformNotify(HistoryItem *item) {
_private.showNotify(item->history()->peer->id, item->history()->peer->name, item->notificationHeader(), item->notificationText());
}
PsApplication::PsApplication(int &argc, char **argv) : QApplication(argc, argv) {

View File

@ -29,60 +29,6 @@ inline void psCheckLocalSocket(const QString &serverName) {
}
}
class PsNotifyWindow : public QWidget, public Animated {
Q_OBJECT
public:
PsNotifyWindow(HistoryItem *item, int32 x, int32 y);
void enterEvent(QEvent *e);
void leaveEvent(QEvent *e);
void mousePressEvent(QMouseEvent *e);
void paintEvent(QPaintEvent *e);
bool animStep(float64 ms);
void animHide(float64 duration, anim::transition func);
void startHiding();
void stopHiding();
void moveTo(int32 x, int32 y, int32 index = -1);
void updatePeerPhoto();
int32 index() const {
return history ? _index : -1;
}
~PsNotifyWindow();
public slots:
void hideByTimer();
void checkLastInput();
void unlinkHistory(History *hist = 0);
private:
// DWORD started;
History *history;
IconedButton close;
QPixmap pm;
float64 alphaDuration, posDuration;
QTimer hideTimer, inputTimer;
bool hiding;
int32 _index;
anim::fvalue aOpacity;
anim::transition aOpacityFunc;
anim::ivalue aY;
ImagePtr peerPhoto;
};
typedef QList<PsNotifyWindow*> PsNotifyWindows;
class MacPrivate : public PsMacWindowPrivate {
public:
@ -92,6 +38,8 @@ public:
};
class NotifyWindow;
class PsMainWindow : public QMainWindow {
Q_OBJECT
@ -114,7 +62,6 @@ public:
bool psHandleTitle();
void psFlash();
void psNotifySettingGot();
bool psIsActive(int state = -1) const;
bool psIsOnline(int state) const;
@ -126,19 +73,15 @@ public:
return false;
}
void psNotify(History *history, MsgId msgId);
void psClearNotify(History *history = 0);
void psClearNotifyFast();
void psShowNextNotify(PsNotifyWindow *remove = 0);
void psActivateNotifies();
void psStopHiding();
void psStartHiding();
void psUpdateNotifies();
bool psPosInited() const {
return posInited;
}
void psActivateNotify(NotifyWindow *w);
void psClearNotifies(PeerId peerId = 0);
void psNotifyShown(NotifyWindow *w);
void psPlatformNotify(HistoryItem *item);
~PsMainWindow();
public slots:
@ -147,7 +90,6 @@ public slots:
void psUpdateCounter();
void psSavePosition(Qt::WindowState state = Qt::WindowActive);
void psIdleTimeout();
void psNotifyFire();
protected:
@ -159,26 +101,6 @@ protected:
QImage icon256;
virtual void setupTrayIcon() {
}
typedef QMap<MsgId, uint64> NotifyWhenMap;
typedef QMap<History*, NotifyWhenMap> NotifyWhenMaps;
NotifyWhenMaps notifyWhenMaps;
struct NotifyWaiter {
NotifyWaiter(MsgId msg, uint64 when) : msg(msg), when(when) {
}
MsgId msg;
uint64 when;
};
typedef QMap<History*, NotifyWaiter> NotifyWaiters;
NotifyWaiters notifyWaiters;
NotifyWaiters notifySettingWaiters;
QTimer notifyWaitTimer;
typedef QSet<uint64> NotifyWhenAlert;
typedef QMap<History*, NotifyWhenAlert> NotifyWhenAlerts;
NotifyWhenAlerts notifyWhenAlerts;
PsNotifyWindows notifyWindows;
QTimer psUpdatedPositionTimer;
@ -257,6 +179,8 @@ QString psAppDataPath();
QString psCurrentExeDirectory(int argc, char *argv[]);
void psAutoStart(bool start, bool silent = false);
QRect psDesktopRect();
int psCleanup();
int psFixPrevious();

File diff suppressed because it is too large Load Diff

View File

@ -868,8 +868,6 @@ PsMainWindow::PsMainWindow(QWidget *parent) : QMainWindow(parent), ps_hWnd(0), p
icon32 = icon256.scaledToWidth(32, Qt::SmoothTransformation);
connect(&psIdleTimer, SIGNAL(timeout()), this, SLOT(psIdleTimeout()));
psIdleTimer.setSingleShot(false);
connect(&notifyWaitTimer, SIGNAL(timeout()), this, SLOT(psNotifyFire()));
notifyWaitTimer.setSingleShot(true);
}
void PsMainWindow::psNotIdle() const {
@ -1388,506 +1386,41 @@ PsMainWindow::~PsMainWindow() {
if (ps_menu) DestroyMenu(ps_menu);
psDestroyIcons();
_psShadowWindows.destroy();
psClearNotifyFast();
if (ps_tbHider_hWnd) DestroyWindow(ps_tbHider_hWnd);
}
void PsMainWindow::psNotify(History *history, MsgId msgId) {
if (App::quiting() || !history->currentNotification()) return;
bool haveSetting = (history->peer->notify != UnknownNotifySettings);
if (haveSetting) {
if (history->peer->notify != EmptyNotifySettings && history->peer->notify->mute > unixtime()) {
history->clearNotifications();
return;
}
} else {
App::wnd()->getNotifySetting(MTP_inputNotifyPeer(history->peer->input));
}
uint64 ms = getms() + NotifyWaitTimeout;
notifyWhenAlerts[history].insert(ms);
if (cDesktopNotify()) {
NotifyWhenMaps::iterator i = notifyWhenMaps.find(history);
if (i == notifyWhenMaps.end()) {
i = notifyWhenMaps.insert(history, NotifyWhenMap());
}
if (i.value().constFind(msgId) == i.value().cend()) {
i.value().insert(msgId, ms);
}
NotifyWaiters *addTo = haveSetting ? &notifyWaiters : &notifySettingWaiters;
if (addTo->constFind(history) == addTo->cend()) {
addTo->insert(history, NotifyWaiter(msgId, ms));
}
}
if (haveSetting) {
if (!notifyWaitTimer.isActive()) {
notifyWaitTimer.start(NotifyWaitTimeout);
}
}
}
void PsMainWindow::psNotifyFire() {
psShowNextNotify();
}
void PsMainWindow::psNotifySettingGot() {
int32 t = unixtime();
for (NotifyWaiters::iterator i = notifySettingWaiters.begin(); i != notifySettingWaiters.end();) {
History *history = i.key();
if (history->peer->notify == UnknownNotifySettings) {
++i;
} else {
if (history->peer->notify == EmptyNotifySettings || history->peer->notify->mute <= t) {
notifyWaiters.insert(i.key(), i.value());
}
i = notifySettingWaiters.erase(i);
}
}
notifyWaitTimer.stop();
psShowNextNotify();
}
void PsMainWindow::psClearNotify(History *history) {
if (!history) {
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->unlinkHistory();
}
for (NotifyWhenMaps::const_iterator i = notifyWhenMaps.cbegin(), e = notifyWhenMaps.cend(); i != e; ++i) {
i.key()->clearNotifications();
}
notifyWaiters.clear();
notifySettingWaiters.clear();
notifyWhenMaps.clear();
return;
}
notifyWaiters.remove(history);
notifySettingWaiters.remove(history);
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->unlinkHistory(history);
}
notifyWhenMaps.remove(history);
notifyWhenAlerts.remove(history);
}
void PsMainWindow::psClearNotifyFast() {
notifyWaiters.clear();
notifySettingWaiters.clear();
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->deleteLater();
}
notifyWindows.clear();
notifyWhenMaps.clear();
notifyWhenAlerts.clear();
}
// QApplication::desktop()->availableGeometry(App::wnd()) works not very fine, returns not nearest
namespace {
//RECT _monitorRECT;
QRect _monitorRect;
//uint32 _monitorDelta;
//int32 _wndX, _wndY;
uint64 _monitorLastGot = 0;
//BOOL CALLBACK _monitorRectProc(
//_In_ HMONITOR hMonitor,
//_In_ HDC hdcMonitor,
//_In_ LPRECT lprcMonitor,
//_In_ LPARAM dwData
//) {
// MONITORINFOEX info;
// info.cbSize = sizeof(info);
// GetMonitorInfo(hMonitor, &info);
// int32 centerx = (info.rcWork.right + info.rcWork.left) / 2, centery = (info.rcWork.bottom + info.rcWork.top) / 2;
// uint32 delta = (info.rcWork.right > _wndX && info.rcWork.left <= _wndX && info.rcWork.bottom > _wndY && info.rcWork.top <= _wndY) ? 0 : ((centerx - _wndX) * (centerx - _wndX) + (centery - _wndY) * (centery - _wndY));
// if (delta < _monitorDelta) {
// _monitorDelta = delta;
// _monitorRECT = info.rcWork;
// }
// return !!delta;
//}
QRect _desktopRect() {
uint64 tnow = getms();
if (tnow > _monitorLastGot + 1000 || tnow < _monitorLastGot) {
_monitorLastGot = tnow;
//RECT r;
//GetWindowRect(App::wnd()->psHwnd(), &r);
//_wndX = (r.right + r.left) / 2;
//_wndY = (r.bottom + r.top) / 2;
//_monitorDelta = INT_MAX;
//EnumDisplayMonitors(0, 0, &_monitorRectProc, 0);
//_monitorRect = (_monitorDelta < INT_MAX) ? QRect(_monitorRECT.left, _monitorRECT.top, _monitorRECT.right - _monitorRECT.left, _monitorRECT.bottom - _monitorRECT.top) : QApplication::desktop()->availableGeometry(App::wnd());
HMONITOR hMonitor = MonitorFromWindow(App::wnd()->psHwnd(), MONITOR_DEFAULTTONEAREST);
if (hMonitor) {
MONITORINFOEX info;
info.cbSize = sizeof(info);
GetMonitorInfo(hMonitor, &info);
_monitorRect = QRect(info.rcWork.left, info.rcWork.top, info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top);
} else {
_monitorRect = QApplication::desktop()->availableGeometry(App::wnd());
}
}
return _monitorRect;
}
}
void PsMainWindow::psShowNextNotify(PsNotifyWindow *remove) {
if (App::quiting()) return;
int32 count = NotifyWindows;
if (remove) {
for (PsNotifyWindows::iterator i = notifyWindows.begin(), e = notifyWindows.end(); i != e; ++i) {
if ((*i) == remove) {
notifyWindows.erase(i);
break;
}
}
}
uint64 ms = getms(), nextAlert = 0;
bool alert = false;
for (NotifyWhenAlerts::iterator i = notifyWhenAlerts.begin(); i != notifyWhenAlerts.end();) {
while (!i.value().isEmpty() && *i.value().begin() <= ms) {
i.value().erase(i.value().begin());
NotifySettingsPtr n = i.key()->peer->notify;
if (n == EmptyNotifySettings || n != UnknownNotifySettings && n->mute <= unixtime()) {
alert = true;
}
}
if (i.value().isEmpty()) {
i = notifyWhenAlerts.erase(i);
QRect psDesktopRect() {
uint64 tnow = getms();
if (tnow > _monitorLastGot + 1000 || tnow < _monitorLastGot) {
_monitorLastGot = tnow;
HMONITOR hMonitor = MonitorFromWindow(App::wnd()->psHwnd(), MONITOR_DEFAULTTONEAREST);
if (hMonitor) {
MONITORINFOEX info;
info.cbSize = sizeof(info);
GetMonitorInfo(hMonitor, &info);
_monitorRect = QRect(info.rcWork.left, info.rcWork.top, info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top);
} else {
if (!nextAlert || nextAlert > *i.value().begin()) {
nextAlert = *i.value().begin();
}
++i;
_monitorRect = QApplication::desktop()->availableGeometry(App::wnd());
}
}
if (alert) {
psFlash();
App::playSound();
}
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
int32 ind = (*i)->index();
if (ind < 0) continue;
--count;
}
if (count <= 0 || !cDesktopNotify()) {
if (nextAlert) {
notifyWaitTimer.start(nextAlert - ms);
}
return;
}
QRect r = _desktopRect();
int32 x = r.x() + r.width() - st::notifyWidth - st::notifyDeltaX, y = r.y() + r.height() - st::notifyHeight - st::notifyDeltaY;
while (count > 0) {
uint64 next = 0;
HistoryItem *notifyItem = 0;
NotifyWaiters::iterator notifyWaiter;
for (NotifyWaiters::iterator i = notifyWaiters.begin(); i != notifyWaiters.end(); ++i) {
History *history = i.key();
if (history->currentNotification() && history->currentNotification()->id != i.value().msg) {
NotifyWhenMaps::iterator j = notifyWhenMaps.find(history);
if (j == notifyWhenMaps.end()) {
history->clearNotifications();
i = notifyWaiters.erase(i);
continue;
}
do {
NotifyWhenMap::const_iterator k = j.value().constFind(history->currentNotification()->id);
if (k != j.value().cend()) {
i.value().msg = k.key();
i.value().when = k.value();
break;
}
history->skipNotification();
} while (history->currentNotification());
}
if (!history->currentNotification()) {
notifyWhenMaps.remove(history);
i = notifyWaiters.erase(i);
continue;
}
uint64 when = i.value().when;
if (!notifyItem || next > when) {
next = when;
notifyItem = history->currentNotification();
notifyWaiter = i;
}
}
if (notifyItem) {
if (next > ms) {
if (nextAlert && nextAlert < next) {
next = nextAlert;
nextAlert = 0;
}
notifyWaitTimer.start(next - ms);
break;
} else {
notifyWindows.push_back(new PsNotifyWindow(notifyItem, x, y));
--count;
uint64 ms = getms();
History *history = notifyItem->history();
history->skipNotification();
NotifyWhenMaps::iterator j = notifyWhenMaps.find(history);
if (j == notifyWhenMaps.end() || !history->currentNotification()) {
history->clearNotifications();
notifyWaiters.erase(notifyWaiter);
if (j != notifyWhenMaps.end()) notifyWhenMaps.erase(j);
continue;
}
j.value().remove(notifyItem->id);
do {
NotifyWhenMap::const_iterator k = j.value().constFind(history->currentNotification()->id);
if (k != j.value().cend()) {
notifyWaiter.value().msg = k.key();
notifyWaiter.value().when = k.value();
break;
}
history->skipNotification();
} while (history->currentNotification());
if (!history->currentNotification()) {
notifyWaiters.erase(notifyWaiter);
notifyWhenMaps.erase(j);
continue;
}
}
} else {
break;
}
}
if (nextAlert) {
notifyWaitTimer.start(nextAlert - ms);
}
count = NotifyWindows - count;
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
int32 ind = (*i)->index();
if (ind < 0) continue;
--count;
(*i)->moveTo(x, y - count * (st::notifyHeight + st::notifyDeltaY));
}
return _monitorRect;
}
void PsMainWindow::psStopHiding() {
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->stopHiding();
}
void PsMainWindow::psActivateNotify(NotifyWindow *w) {
}
void PsMainWindow::psStartHiding() {
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->startHiding();
}
void PsMainWindow::psClearNotifies(PeerId peerId) {
}
void PsMainWindow::psUpdateNotifies() {
for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->updatePeerPhoto();
}
void PsMainWindow::psNotifyShown(NotifyWindow *w) {
}
PsNotifyWindow::PsNotifyWindow(HistoryItem *item, int32 x, int32 y) : history(item->history()), aOpacity(0), _index(0), hiding(false), started(GetTickCount()),
alphaDuration(st::notifyFastAnim), posDuration(st::notifyFastAnim), aY(y + st::notifyHeight + st::notifyDeltaY), close(this, st::notifyClose), aOpacityFunc(st::notifyFastAnimFunc) {
int32 w = st::notifyWidth, h = st::notifyHeight;
QImage img(w, h, QImage::Format_ARGB32_Premultiplied);
img.fill(st::notifyBG->c);
{
QPainter p(&img);
p.setPen(st::notifyBorder->p);
p.setBrush(Qt::NoBrush);
p.drawRect(0, 0, w - 1, h - 1);
if (history->peer->photo->loaded()) {
p.drawPixmap(st::notifyPhotoPos.x(), st::notifyPhotoPos.y(), history->peer->photo->pix(st::notifyPhotoSize));
} else {
MTP::clearLoaderPriorities();
peerPhoto = history->peer->photo;
peerPhoto->load(true, true);
}
int32 itemWidth = w - st::notifyPhotoPos.x() - st::notifyPhotoSize - st::notifyTextLeft - st::notifyClosePos.x() - st::notifyClose.width;
QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height);
if (history->peer->chat) {
p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgLeft, rectForName.top() + st::dlgChatImgTop), App::sprite(), st::dlgChatImg);
rectForName.setLeft(rectForName.left() + st::dlgChatImgSkip);
}
QDateTime now(QDateTime::currentDateTime()), lastTime(item->date);
QDate nowDate(now.date()), lastDate(lastTime.date());
QString dt = lastTime.toString(qsl("hh:mm"));
int32 dtWidth = st::dlgHistFont->m.width(dt);
rectForName.setWidth(rectForName.width() - dtWidth - st::dlgDateSkip);
p.setFont(st::dlgDateFont->f);
p.setPen(st::dlgDateColor->p);
p.drawText(rectForName.left() + rectForName.width() + st::dlgDateSkip, rectForName.top() + st::dlgHistFont->ascent, dt);
const HistoryItem *textCachedFor = 0;
Text itemTextCache(itemWidth);
bool active = false;
item->drawInDialog(p, QRect(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyItemTop + st::msgNameFont->height, itemWidth, 2 * st::dlgFont->height), active, textCachedFor, itemTextCache);
p.setPen(st::dlgNameColor->p);
history->nameText.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
}
pm = QPixmap::fromImage(img);
hideTimer.setSingleShot(true);
connect(&hideTimer, SIGNAL(timeout()), this, SLOT(hideByTimer()));
inputTimer.setSingleShot(true);
connect(&inputTimer, SIGNAL(timeout()), this, SLOT(checkLastInput()));
connect(&close, SIGNAL(clicked()), this, SLOT(unlinkHistory()));
close.setAcceptBoth(true);
close.move(w - st::notifyClose.width - st::notifyClosePos.x(), st::notifyClosePos.y());
close.show();
aY.start(y);
setGeometry(x, aY.current(), st::notifyWidth, st::notifyHeight);
aOpacity.start(1);
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
show();
setWindowOpacity(aOpacity.current());
alphaDuration = posDuration = st::notifyFastAnim;
anim::start(this);
checkLastInput();
}
void PsNotifyWindow::checkLastInput() {
LASTINPUTINFO lii;
lii.cbSize = sizeof(LASTINPUTINFO);
BOOL res = GetLastInputInfo(&lii);
if (!res || lii.dwTime >= started) {
hideTimer.start(st::notifyWaitLongHide);
} else {
inputTimer.start(300);
}
}
void PsNotifyWindow::moveTo(int32 x, int32 y, int32 index) {
if (index >= 0) {
_index = index;
}
move(x, aY.current());
aY.start(y);
aOpacity.restart();
posDuration = st::notifyFastAnim;
anim::start(this);
}
void PsNotifyWindow::updatePeerPhoto() {
if (!peerPhoto->isNull() && peerPhoto->loaded()) {
QImage img(pm.toImage());
{
QPainter p(&img);
p.drawPixmap(st::notifyPhotoPos.x(), st::notifyPhotoPos.y(), peerPhoto->pix(st::notifyPhotoSize));
}
peerPhoto = ImagePtr();
pm = QPixmap::fromImage(img);
update();
}
}
void PsNotifyWindow::unlinkHistory(History *hist) {
if (!hist || hist == history) {
animHide(st::notifyFastAnim, st::notifyFastAnimFunc);
history = 0;
App::wnd()->psShowNextNotify();
}
}
void PsNotifyWindow::enterEvent(QEvent *e) {
if (!history) return;
if (App::wnd()) App::wnd()->psStopHiding();
}
void PsNotifyWindow::leaveEvent(QEvent *e) {
if (!history) return;
App::wnd()->psStartHiding();
}
void PsNotifyWindow::startHiding() {
hideTimer.start(st::notifyWaitShortHide);
}
void PsNotifyWindow::mousePressEvent(QMouseEvent *e) {
if (!history) return;
if (e->button() == Qt::RightButton) {
unlinkHistory();
} else if (history) {
App::wnd()->showFromTray();
App::wnd()->hideSettings();
App::main()->showPeer(history->peer->id, 0, false, true);
e->ignore();
}
}
void PsNotifyWindow::paintEvent(QPaintEvent *e) {
QPainter p(this);
p.drawPixmap(0, 0, pm);
}
void PsNotifyWindow::animHide(float64 duration, anim::transition func) {
if (!history) return;
alphaDuration = duration;
aOpacityFunc = func;
aOpacity.start(0);
aY.restart();
hiding = true;
anim::start(this);
}
void PsNotifyWindow::stopHiding() {
if (!history) return;
alphaDuration = st::notifyFastAnim;
aOpacityFunc = st::notifyFastAnimFunc;
aOpacity.start(1);
aY.restart();
hiding = false;
hideTimer.stop();
anim::start(this);
}
void PsNotifyWindow::hideByTimer() {
if (!history) return;
animHide(st::notifySlowHide, st::notifySlowHideFunc);
}
bool PsNotifyWindow::animStep(float64 ms) {
float64 dtAlpha = ms / alphaDuration, dtPos = ms / posDuration;
if (dtAlpha >= 1) {
aOpacity.finish();
if (hiding) {
deleteLater();
}
} else {
aOpacity.update(dtAlpha, aOpacityFunc);
}
setWindowOpacity(aOpacity.current());
if (dtPos >= 1) {
aY.finish();
} else {
aY.update(dtPos, anim::linear);
}
move(x(), aY.current());
update();
return (dtAlpha < 1 || !hiding && dtPos < 1);
}
PsNotifyWindow::~PsNotifyWindow() {
if (App::wnd()) App::wnd()->psShowNextNotify(this);
void PsMainWindow::psPlatformNotify(HistoryItem *item) {
}
PsApplication::PsApplication(int &argc, char **argv) : QApplication(argc, argv) {

View File

@ -23,58 +23,7 @@ inline QString psServerPrefix() {
inline void psCheckLocalSocket(const QString &) {
}
class PsNotifyWindow : public QWidget, public Animated {
Q_OBJECT
public:
PsNotifyWindow(HistoryItem *item, int32 x, int32 y);
void enterEvent(QEvent *e);
void leaveEvent(QEvent *e);
void mousePressEvent(QMouseEvent *e);
void paintEvent(QPaintEvent *e);
bool animStep(float64 ms);
void animHide(float64 duration, anim::transition func);
void startHiding();
void stopHiding();
void moveTo(int32 x, int32 y, int32 index = -1);
void updatePeerPhoto();
int32 index() const {
return history ? _index : -1;
}
~PsNotifyWindow();
public slots:
void hideByTimer();
void checkLastInput();
void unlinkHistory(History *hist = 0);
private:
DWORD started;
History *history;
IconedButton close;
QPixmap pm;
float64 alphaDuration, posDuration;
QTimer hideTimer, inputTimer;
bool hiding;
int32 _index;
anim::fvalue aOpacity;
anim::transition aOpacityFunc;
anim::ivalue aY;
ImagePtr peerPhoto;
};
typedef QList<PsNotifyWindow*> PsNotifyWindows;
class NotifyWindow;
class PsMainWindow : public QMainWindow {
Q_OBJECT
@ -112,18 +61,15 @@ public:
return false;
}
void psNotify(History *history, MsgId msgId);
void psClearNotify(History *history = 0);
void psClearNotifyFast();
void psShowNextNotify(PsNotifyWindow *remove = 0);
void psStopHiding();
void psStartHiding();
void psUpdateNotifies();
bool psPosInited() const {
return posInited;
}
void psActivateNotify(NotifyWindow *w);
void psClearNotifies(PeerId peerId = 0);
void psNotifyShown(NotifyWindow *w);
void psPlatformNotify(HistoryItem *item);
~PsMainWindow();
public slots:
@ -132,7 +78,6 @@ public slots:
void psUpdateCounter();
void psSavePosition(Qt::WindowState state = Qt::WindowActive);
void psIdleTimeout();
void psNotifyFire();
protected:
@ -145,26 +90,6 @@ protected:
virtual void setupTrayIcon() {
}
typedef QMap<MsgId, uint64> NotifyWhenMap;
typedef QMap<History*, NotifyWhenMap> NotifyWhenMaps;
NotifyWhenMaps notifyWhenMaps;
struct NotifyWaiter {
NotifyWaiter(MsgId msg, uint64 when) : msg(msg), when(when) {
}
MsgId msg;
uint64 when;
};
typedef QMap<History*, NotifyWaiter> NotifyWaiters;
NotifyWaiters notifyWaiters;
NotifyWaiters notifySettingWaiters;
QTimer notifyWaitTimer;
typedef QSet<uint64> NotifyWhenAlert;
typedef QMap<History*, NotifyWhenAlert> NotifyWhenAlerts;
NotifyWhenAlerts notifyWhenAlerts;
PsNotifyWindows notifyWindows;
QTimer psUpdatedPositionTimer;
private:
@ -251,6 +176,8 @@ QString psAppDataPath();
QString psCurrentExeDirectory(int argc, char *argv[]);
void psAutoStart(bool start, bool silent = false);
QRect psDesktopRect();
int psCleanup();
int psFixPrevious();

View File

@ -86,6 +86,11 @@ QUrl gUpdateURL = QUrl(qsl("http://tdesktop.com/linux/tupdates/current"));
#endif
void settingsParseArgs(int argc, char *argv[]) {
if (cPlatform() == dbipMac) {
gCustomNotifies = false;
} else {
gCustomNotifies = true;
}
memset_rand(&gInstance, sizeof(gInstance));
gExeDir = psCurrentExeDirectory(argc, argv);
for (int32 i = 0; i < argc; ++i) {

View File

@ -75,11 +75,7 @@ void Slider::setSelected(int32 sel) {
void Slider::paintEvent(QPaintEvent *e) {
QPainter p(this);
p.setPen(_st.color->p);
int32 from = (height() - _st.thikness) / 2, to = from + _st.thikness;
for (int32 i = from; i < to; ++i) {
p.drawLine(0, i, width() - 1, i);
}
p.fillRect(0, (height() - _st.thikness) / 2, width(), _st.thikness, _st.color->b);
int32 x = qFloor(_sel * float64(width() - _st.bar.pxWidth()) / (_count - 1)), y = (height() - _st.bar.pxHeight()) / 2;
p.drawPixmap(QPoint(x, y), App::sprite(), _st.bar);
@ -908,7 +904,7 @@ void SettingsInner::onSoundNotify() {
void SettingsInner::onDesktopNotify() {
cSetDesktopNotify(_desktopNotify.checked());
if (!_desktopNotify.checked()) {
App::wnd()->psClearNotify();
App::wnd()->notifyClear();
}
App::writeUserConfig();
}

View File

@ -76,6 +76,229 @@ void TempDirDeleter::onStart() {
}
}
NotifyWindow::NotifyWindow(HistoryItem *item, int32 x, int32 y) : history(item->history())
#ifdef Q_OS_WIN
, started(GetTickCount())
#endif
, close(this, st::notifyClose)
, alphaDuration(st::notifyFastAnim)
, posDuration(st::notifyFastAnim)
, hiding(false)
, _index(0)
, aOpacity(0)
, aOpacityFunc(st::notifyFastAnimFunc)
, aY(y + st::notifyHeight + st::notifyDeltaY) {
int32 w = st::notifyWidth, h = st::notifyHeight;
QImage img(w * cIntRetinaFactor(), h * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
if (cRetina()) img.setDevicePixelRatio(cRetinaFactor());
img.fill(st::notifyBG->c);
{
QPainter p(&img);
p.fillRect(0, 0, w - st::notifyBorderWidth, st::notifyBorderWidth, st::notifyBorder->b);
p.fillRect(w - st::notifyBorderWidth, 0, st::notifyBorderWidth, h - st::notifyBorderWidth, st::notifyBorder->b);
p.fillRect(st::notifyBorderWidth, h - st::notifyBorderWidth, w - st::notifyBorderWidth, st::notifyBorderWidth, st::notifyBorder->b);
p.fillRect(0, st::notifyBorderWidth, st::notifyBorderWidth, h - st::notifyBorderWidth, st::notifyBorder->b);
if (history->peer->photo->loaded()) {
p.drawPixmap(st::notifyPhotoPos.x(), st::notifyPhotoPos.y(), history->peer->photo->pix(st::notifyPhotoSize));
} else {
MTP::clearLoaderPriorities();
peerPhoto = history->peer->photo;
peerPhoto->load(true, true);
}
int32 itemWidth = w - st::notifyPhotoPos.x() - st::notifyPhotoSize - st::notifyTextLeft - st::notifyClosePos.x() - st::notifyClose.width;
QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height);
if (history->peer->chat) {
p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgLeft, rectForName.top() + st::dlgChatImgTop), App::sprite(), st::dlgChatImg);
rectForName.setLeft(rectForName.left() + st::dlgChatImgSkip);
}
QDateTime now(QDateTime::currentDateTime()), lastTime(item->date);
QDate nowDate(now.date()), lastDate(lastTime.date());
QString dt = lastTime.toString(qsl("hh:mm"));
int32 dtWidth = st::dlgHistFont->m.width(dt);
rectForName.setWidth(rectForName.width() - dtWidth - st::dlgDateSkip);
p.setFont(st::dlgDateFont->f);
p.setPen(st::dlgDateColor->p);
p.drawText(rectForName.left() + rectForName.width() + st::dlgDateSkip, rectForName.top() + st::dlgHistFont->ascent, dt);
const HistoryItem *textCachedFor = 0;
Text itemTextCache(itemWidth);
bool active = false;
item->drawInDialog(p, QRect(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyItemTop + st::msgNameFont->height, itemWidth, 2 * st::dlgFont->height), active, textCachedFor, itemTextCache);
p.setPen(st::dlgNameColor->p);
history->nameText.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
}
pm = QPixmap::fromImage(img);
hideTimer.setSingleShot(true);
connect(&hideTimer, SIGNAL(timeout()), this, SLOT(hideByTimer()));
inputTimer.setSingleShot(true);
connect(&inputTimer, SIGNAL(timeout()), this, SLOT(checkLastInput()));
connect(&close, SIGNAL(clicked()), this, SLOT(unlinkHistory()));
close.setAcceptBoth(true);
close.move(w - st::notifyClose.width - st::notifyClosePos.x(), st::notifyClosePos.y());
close.show();
aY.start(y);
setGeometry(x, aY.current(), st::notifyWidth, st::notifyHeight);
aOpacity.start(1);
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
setAttribute(Qt::WA_MacAlwaysShowToolWindow);
show();
setWindowOpacity(aOpacity.current());
alphaDuration = posDuration = st::notifyFastAnim;
anim::start(this);
checkLastInput();
}
void NotifyWindow::checkLastInput() {
#ifdef Q_OS_WIN
LASTINPUTINFO lii;
lii.cbSize = sizeof(LASTINPUTINFO);
BOOL res = GetLastInputInfo(&lii);
if (!res || lii.dwTime >= started) {
hideTimer.start(st::notifyWaitLongHide);
} else {
inputTimer.start(300);
}
#else
// TODO
if (true) {
hideTimer.start(st::notifyWaitLongHide);
} else {
inputTimer.start(300);
}
#endif
}
void NotifyWindow::moveTo(int32 x, int32 y, int32 index) {
if (index >= 0) {
_index = index;
}
move(x, aY.current());
aY.start(y);
aOpacity.restart();
posDuration = st::notifyFastAnim;
anim::start(this);
}
void NotifyWindow::updatePeerPhoto() {
if (!peerPhoto->isNull() && peerPhoto->loaded()) {
QImage img(pm.toImage());
{
QPainter p(&img);
p.drawPixmap(st::notifyPhotoPos.x(), st::notifyPhotoPos.y(), peerPhoto->pix(st::notifyPhotoSize));
}
peerPhoto = ImagePtr();
pm = QPixmap::fromImage(img);
update();
}
}
void NotifyWindow::unlinkHistory(History *hist) {
if (!hist || hist == history) {
animHide(st::notifyFastAnim, st::notifyFastAnimFunc);
history = 0;
App::wnd()->notifyShowNext();
}
}
void NotifyWindow::enterEvent(QEvent *e) {
if (!history) return;
if (App::wnd()) App::wnd()->notifyStopHiding();
}
void NotifyWindow::leaveEvent(QEvent *e) {
if (!history) return;
App::wnd()->notifyStartHiding();
}
void NotifyWindow::startHiding() {
hideTimer.start(st::notifyWaitShortHide);
}
void NotifyWindow::mousePressEvent(QMouseEvent *e) {
if (!history) return;
if (e->button() == Qt::RightButton) {
unlinkHistory();
} else if (history) {
App::wnd()->showFromTray();
App::wnd()->hideSettings();
App::main()->showPeer(history->peer->id, 0, false, true);
e->ignore();
}
}
void NotifyWindow::paintEvent(QPaintEvent *e) {
QPainter p(this);
p.drawPixmap(0, 0, pm);
}
void NotifyWindow::animHide(float64 duration, anim::transition func) {
if (!history) return;
alphaDuration = duration;
aOpacityFunc = func;
aOpacity.start(0);
aY.restart();
hiding = true;
anim::start(this);
}
void NotifyWindow::stopHiding() {
if (!history) return;
alphaDuration = st::notifyFastAnim;
aOpacityFunc = st::notifyFastAnimFunc;
aOpacity.start(1);
aY.restart();
hiding = false;
hideTimer.stop();
anim::start(this);
}
void NotifyWindow::hideByTimer() {
if (!history) return;
animHide(st::notifySlowHide, st::notifySlowHideFunc);
}
bool NotifyWindow::animStep(float64 ms) {
float64 dtAlpha = ms / alphaDuration, dtPos = ms / posDuration;
if (dtAlpha >= 1) {
aOpacity.finish();
if (hiding) {
deleteLater();
}
} else {
aOpacity.update(dtAlpha, aOpacityFunc);
}
setWindowOpacity(aOpacity.current());
if (dtPos >= 1) {
aY.finish();
} else {
aY.update(dtPos, anim::linear);
}
move(x(), aY.current());
update();
return (dtAlpha < 1 || (!hiding && dtPos < 1));
}
NotifyWindow::~NotifyWindow() {
if (App::wnd()) App::wnd()->notifyShowNext(this);
}
Window::Window(QWidget *parent) : PsMainWindow(parent),
intro(0), main(0), settings(0), layer(0), layerBG(0), _topWidget(0),
_connecting(0), _tempDeleter(0), _tempDeleterThread(0), myIcon(QPixmap::fromImage(icon256)), dragging(false), _inactivePress(false) {
@ -93,6 +316,9 @@ Window::Window(QWidget *parent) : PsMainWindow(parent),
_inactiveTimer.setSingleShot(true);
connect(&_inactiveTimer, SIGNAL(timeout()), this, SLOT(onInactiveTimer()));
connect(&notifyWaitTimer, SIGNAL(timeout()), this, SLOT(notifyFire()));
notifyWaitTimer.setSingleShot(true);
}
void Window::inactivePress(bool inactive) {
@ -650,7 +876,282 @@ void Window::onTempDirClearFailed() {
emit tempDirClearFailed();
}
void Window::notifySchedule(History *history, MsgId msgId) {
if (App::quiting() || !history->currentNotification()) return;
bool haveSetting = (history->peer->notify != UnknownNotifySettings);
if (haveSetting) {
if (history->peer->notify != EmptyNotifySettings && history->peer->notify->mute > unixtime()) {
history->clearNotifications();
return;
}
} else {
App::wnd()->getNotifySetting(MTP_inputNotifyPeer(history->peer->input));
}
uint64 ms = getms() + NotifyWaitTimeout;
notifyWhenAlerts[history].insert(ms);
if (cDesktopNotify()) {
NotifyWhenMaps::iterator i = notifyWhenMaps.find(history);
if (i == notifyWhenMaps.end()) {
i = notifyWhenMaps.insert(history, NotifyWhenMap());
}
if (i.value().constFind(msgId) == i.value().cend()) {
i.value().insert(msgId, ms);
}
NotifyWaiters *addTo = haveSetting ? &notifyWaiters : &notifySettingWaiters;
if (addTo->constFind(history) == addTo->cend()) {
addTo->insert(history, NotifyWaiter(msgId, ms));
}
}
if (haveSetting) {
if (!notifyWaitTimer.isActive()) {
notifyWaitTimer.start(NotifyWaitTimeout);
}
}
}
void Window::notifyFire() {
notifyShowNext();
}
void Window::notifyClear(History *history) {
if (!history) {
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->unlinkHistory();
}
psClearNotifies();
for (NotifyWhenMaps::const_iterator i = notifyWhenMaps.cbegin(), e = notifyWhenMaps.cend(); i != e; ++i) {
i.key()->clearNotifications();
}
notifyWaiters.clear();
notifySettingWaiters.clear();
notifyWhenMaps.clear();
return;
}
notifyWaiters.remove(history);
notifySettingWaiters.remove(history);
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->unlinkHistory(history);
}
psClearNotifies(history->peer->id);
notifyWhenMaps.remove(history);
notifyWhenAlerts.remove(history);
}
void Window::notifyClearFast() {
notifyWaiters.clear();
notifySettingWaiters.clear();
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->deleteLater();
}
psClearNotifies();
notifyWindows.clear();
notifyWhenMaps.clear();
notifyWhenAlerts.clear();
}
void Window::notifySettingGot() {
int32 t = unixtime();
for (NotifyWaiters::iterator i = notifySettingWaiters.begin(); i != notifySettingWaiters.end();) {
History *history = i.key();
if (history->peer->notify == UnknownNotifySettings) {
++i;
} else {
if (history->peer->notify == EmptyNotifySettings || history->peer->notify->mute <= t) {
notifyWaiters.insert(i.key(), i.value());
}
i = notifySettingWaiters.erase(i);
}
}
notifyWaitTimer.stop();
notifyShowNext();
}
void Window::notifyShowNext(NotifyWindow *remove) {
if (App::quiting()) return;
int32 count = NotifyWindowsCount;
if (remove) {
for (NotifyWindows::iterator i = notifyWindows.begin(), e = notifyWindows.end(); i != e; ++i) {
if ((*i) == remove) {
notifyWindows.erase(i);
break;
}
}
}
uint64 ms = getms(), nextAlert = 0;
bool alert = false;
for (NotifyWhenAlerts::iterator i = notifyWhenAlerts.begin(); i != notifyWhenAlerts.end();) {
while (!i.value().isEmpty() && *i.value().begin() <= ms) {
i.value().erase(i.value().begin());
NotifySettingsPtr n = i.key()->peer->notify;
if (n == EmptyNotifySettings || (n != UnknownNotifySettings && n->mute <= unixtime())) {
alert = true;
}
}
if (i.value().isEmpty()) {
i = notifyWhenAlerts.erase(i);
} else {
if (!nextAlert || nextAlert > *i.value().begin()) {
nextAlert = *i.value().begin();
}
++i;
}
}
if (alert) {
psFlash();
App::playSound();
}
if (cCustomNotifies()) {
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
int32 ind = (*i)->index();
if (ind < 0) continue;
--count;
}
}
if (count <= 0 || !cDesktopNotify()) {
if (nextAlert) {
notifyWaitTimer.start(nextAlert - ms);
}
return;
}
QRect r = psDesktopRect();
int32 x = r.x() + r.width() - st::notifyWidth - st::notifyDeltaX, y = r.y() + r.height() - st::notifyHeight - st::notifyDeltaY;
while (count > 0) {
uint64 next = 0;
HistoryItem *notifyItem = 0;
NotifyWaiters::iterator notifyWaiter;
for (NotifyWaiters::iterator i = notifyWaiters.begin(); i != notifyWaiters.end(); ++i) {
History *history = i.key();
if (history->currentNotification() && history->currentNotification()->id != i.value().msg) {
NotifyWhenMaps::iterator j = notifyWhenMaps.find(history);
if (j == notifyWhenMaps.end()) {
history->clearNotifications();
i = notifyWaiters.erase(i);
continue;
}
do {
NotifyWhenMap::const_iterator k = j.value().constFind(history->currentNotification()->id);
if (k != j.value().cend()) {
i.value().msg = k.key();
i.value().when = k.value();
break;
}
history->skipNotification();
} while (history->currentNotification());
}
if (!history->currentNotification()) {
notifyWhenMaps.remove(history);
i = notifyWaiters.erase(i);
continue;
}
uint64 when = i.value().when;
if (!notifyItem || next > when) {
next = when;
notifyItem = history->currentNotification();
notifyWaiter = i;
}
}
if (notifyItem) {
if (next > ms) {
if (nextAlert && nextAlert < next) {
next = nextAlert;
nextAlert = 0;
}
notifyWaitTimer.start(next - ms);
break;
} else {
if (cCustomNotifies()) {
NotifyWindow *notify = new NotifyWindow(notifyItem, x, y);
notifyWindows.push_back(notify);
psNotifyShown(notify);
--count;
} else {
psPlatformNotify(notifyItem);
}
uint64 ms = getms();
History *history = notifyItem->history();
history->skipNotification();
NotifyWhenMaps::iterator j = notifyWhenMaps.find(history);
if (j == notifyWhenMaps.end() || !history->currentNotification()) {
history->clearNotifications();
notifyWaiters.erase(notifyWaiter);
if (j != notifyWhenMaps.end()) notifyWhenMaps.erase(j);
continue;
}
j.value().remove(notifyItem->id);
do {
NotifyWhenMap::const_iterator k = j.value().constFind(history->currentNotification()->id);
if (k != j.value().cend()) {
notifyWaiter.value().msg = k.key();
notifyWaiter.value().when = k.value();
break;
}
history->skipNotification();
} while (history->currentNotification());
if (!history->currentNotification()) {
notifyWaiters.erase(notifyWaiter);
notifyWhenMaps.erase(j);
continue;
}
}
} else {
break;
}
}
if (nextAlert) {
notifyWaitTimer.start(nextAlert - ms);
}
count = NotifyWindowsCount - count;
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
int32 ind = (*i)->index();
if (ind < 0) continue;
--count;
(*i)->moveTo(x, y - count * (st::notifyHeight + st::notifyDeltaY));
}
}
void Window::notifyStopHiding() {
if (cCustomNotifies()) {
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->stopHiding();
}
}
}
void Window::notifyStartHiding() {
if (cCustomNotifies()) {
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->startHiding();
}
}
}
void Window::notifyUpdateAll() {
if (cCustomNotifies()) {
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
(*i)->updatePeerPhoto();
}
}
}
void Window::notifyActivateAll() {
if (cCustomNotifies()) {
for (NotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) {
psActivateNotify(*i);
}
}
}
Window::~Window() {
notifyClearFast();
delete _tempDeleter;
delete _tempDeleterThread;
delete _connecting;

View File

@ -66,6 +66,61 @@ signals:
};
class NotifyWindow : public QWidget, public Animated {
Q_OBJECT
public:
NotifyWindow(HistoryItem *item, int32 x, int32 y);
void enterEvent(QEvent *e);
void leaveEvent(QEvent *e);
void mousePressEvent(QMouseEvent *e);
void paintEvent(QPaintEvent *e);
bool animStep(float64 ms);
void animHide(float64 duration, anim::transition func);
void startHiding();
void stopHiding();
void moveTo(int32 x, int32 y, int32 index = -1);
void updatePeerPhoto();
int32 index() const {
return history ? _index : -1;
}
~NotifyWindow();
public slots:
void hideByTimer();
void checkLastInput();
void unlinkHistory(History *hist = 0);
private:
#ifdef Q_OS_WIN
DWORD started;
#endif
History *history;
IconedButton close;
QPixmap pm;
float64 alphaDuration, posDuration;
QTimer hideTimer, inputTimer;
bool hiding;
int32 _index;
anim::fvalue aOpacity;
anim::transition aOpacityFunc;
anim::ivalue aY;
ImagePtr peerPhoto;
};
typedef QList<NotifyWindow*> NotifyWindows;
class Window : public PsMainWindow {
Q_OBJECT
@ -150,6 +205,16 @@ public:
TempDirState tempDirState();
void tempDirDelete();
void notifySettingGot();
void notifySchedule(History *history, MsgId msgId);
void notifyClear(History *history = 0);
void notifyClearFast();
void notifyShowNext(NotifyWindow *remove = 0);
void notifyStopHiding();
void notifyStartHiding();
void notifyUpdateAll();
void notifyActivateAll();
public slots:
void checkHistoryActivation(int state = -1);
@ -165,6 +230,8 @@ public slots:
void onTempDirCleared();
void onTempDirClearFailed();
void notifyFire();
signals:
@ -202,6 +269,27 @@ private:
bool _inactivePress;
QTimer _inactiveTimer;
typedef QMap<MsgId, uint64> NotifyWhenMap;
typedef QMap<History*, NotifyWhenMap> NotifyWhenMaps;
NotifyWhenMaps notifyWhenMaps;
struct NotifyWaiter {
NotifyWaiter(MsgId msg, uint64 when) : msg(msg), when(when) {
}
MsgId msg;
uint64 when;
};
typedef QMap<History*, NotifyWaiter> NotifyWaiters;
NotifyWaiters notifyWaiters;
NotifyWaiters notifySettingWaiters;
QTimer notifyWaitTimer;
typedef QSet<uint64> NotifyWhenAlert;
typedef QMap<History*, NotifyWhenAlert> NotifyWhenAlerts;
NotifyWhenAlerts notifyWhenAlerts;
NotifyWindows notifyWindows;
};
#endif // MAINWINDOW_H

View File

@ -11,7 +11,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.5.5</string>
<string>0.5.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NOTE</key>

View File

@ -40,6 +40,8 @@
06EABCC49D2EEE4076322BE7 /* moc_mtp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 924D4939FD169BB4B8AEB1C9 /* moc_mtp.cpp */; settings = {ATTRIBUTES = (); }; };
07055CC4194EE85B0008DEF6 /* libcrypto.a in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 07055CC3194EE85B0008DEF6 /* libcrypto.a */; };
0749CE69194D723400345D61 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 07C3AF24194335ED0016CFF1 /* Images.xcassets */; };
07C4753B1967DF1C00CAAFE9 /* switcher.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07C475391967DF1C00CAAFE9 /* switcher.cpp */; };
07C4753F1967E37300CAAFE9 /* moc_switcher.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07C4753E1967E37300CAAFE9 /* moc_switcher.cpp */; };
0A49F3A5DC0680FB31519670 /* phoneinput.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 7C8F9CA4FCE8AF8FCCCB961E /* phoneinput.cpp */; settings = {ATTRIBUTES = (); }; };
0CB7DE9A54CC9BF86FB7B5CA /* mtp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 6D50D70712776D7ED3B00E5C /* mtp.cpp */; settings = {ATTRIBUTES = (); }; };
0F0FC25286E16E5F78962FEE /* moc_newgroupbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 69FE16874104731CE2A66E0D /* moc_newgroupbox.cpp */; settings = {ATTRIBUTES = (); }; };
@ -241,6 +243,9 @@
07C3AF2819433ABF0016CFF1 /* lang.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = lang.txt; path = Resources/lang.txt; sourceTree = SOURCE_ROOT; };
07C3AF2919433ABF0016CFF1 /* style_classes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = style_classes.txt; path = Resources/style_classes.txt; sourceTree = SOURCE_ROOT; };
07C3AF2A19433ABF0016CFF1 /* style.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = style.txt; path = Resources/style.txt; sourceTree = SOURCE_ROOT; };
07C475391967DF1C00CAAFE9 /* switcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = switcher.cpp; path = SourceFiles/gui/switcher.cpp; sourceTree = SOURCE_ROOT; };
07C4753A1967DF1C00CAAFE9 /* switcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = switcher.h; path = SourceFiles/gui/switcher.h; sourceTree = SOURCE_ROOT; };
07C4753E1967E37300CAAFE9 /* moc_switcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_switcher.cpp; path = GeneratedFiles/Debug/moc_switcher.cpp; sourceTree = SOURCE_ROOT; };
08A7682548FB7E671FF03822 /* boxshadow.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = boxshadow.cpp; path = SourceFiles/gui/boxshadow.cpp; sourceTree = "<absolute>"; };
098EA7CE256AAFAE4A17EB77 /* introcode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = introcode.h; path = SourceFiles/intro/introcode.h; sourceTree = "<absolute>"; };
09FD01F2BD652EB838A296D8 /* application.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = application.h; path = SourceFiles/application.h; sourceTree = "<absolute>"; };
@ -757,6 +762,7 @@
7C8F9CA4FCE8AF8FCCCB961E /* phoneinput.cpp */,
6E1859D714E4471E053D90C9 /* scrollarea.cpp */,
420A06A32B66D250142B4B6D /* style_core.cpp */,
07C475391967DF1C00CAAFE9 /* switcher.cpp */,
135FD3715BFDC50AD7B00E04 /* text.cpp */,
BB1602EA641643DE565005B1 /* twidget.cpp */,
85FABD67716E36CD8B3CA4FA /* animation.h */,
@ -775,6 +781,7 @@
F1B68FFCE8AE823F6D45EB06 /* phoneinput.h */,
83A36F229E897566E011B79E /* scrollarea.h */,
0FC38EE7F29EF895925A2C49 /* style_core.h */,
07C4753A1967DF1C00CAAFE9 /* switcher.h */,
6E8FD0ED1B60D43929944CD2 /* text.h */,
507CCEEC4CBA3E3BD6EEDED1 /* twidget.h */,
);
@ -994,6 +1001,7 @@
801973D3334D0FCA849CF485 /* Debug */ = {
isa = PBXGroup;
children = (
07C4753E1967E37300CAAFE9 /* moc_switcher.cpp */,
E181C525E21A16F2D4396CA7 /* moc_application.cpp */,
3B3ED09AB00290D78CF1181B /* moc_dialogswidget.cpp */,
AC9B5F6FB4B984C8D76F7AE2 /* moc_dropdown.cpp */,
@ -1360,11 +1368,13 @@
E9F1CE7F9B18C7C85A50E62D /* style_auto.cpp in Compile Sources */,
EBE29731916DB43BF49FE7A4 /* aboutbox.cpp in Compile Sources */,
4426AF526AAD86D6F73CE36F /* addcontactbox.cpp in Compile Sources */,
07C4753B1967DF1C00CAAFE9 /* switcher.cpp in Compile Sources */,
830CB6F547B8C80A569A0271 /* addparticipantbox.cpp in Compile Sources */,
A0A6B97F7DBEC81004EC9461 /* confirmbox.cpp in Compile Sources */,
4FEA8F51B7BC7CAC71347A1A /* connectionbox.cpp in Compile Sources */,
298BFAB73BF182297584F96F /* contactsbox.cpp in Compile Sources */,
BA41D511A9BBCA09365DF88C /* downloadpathbox.cpp in Compile Sources */,
07C4753F1967E37300CAAFE9 /* moc_switcher.cpp in Compile Sources */,
3ABE4F9B2264F770D944106D /* emojibox.cpp in Compile Sources */,
7422A321DF80CF9FAC7CB51B /* newgroupbox.cpp in Compile Sources */,
77B998AC22A13EF3DDEE07AC /* photocropbox.cpp in Compile Sources */,
@ -1491,9 +1501,9 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 0.5.4;
CURRENT_PROJECT_VERSION = 0.5.6;
DYLIB_COMPATIBILITY_VERSION = 0.5;
DYLIB_CURRENT_VERSION = 0.5.5;
DYLIB_CURRENT_VERSION = 0.5.6;
FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast;
@ -1615,10 +1625,10 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.5.4;
CURRENT_PROJECT_VERSION = 0.5.6;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 0.5;
DYLIB_CURRENT_VERSION = 0.5.5;
DYLIB_CURRENT_VERSION = 0.5.6;
FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;

View File

@ -40,7 +40,7 @@ compilers: GeneratedFiles/qrc_telegram.cpp GeneratedFiles/Debug/moc_application.
GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_countrycodeinput.cpp\
GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp\
GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp\
GeneratedFiles/Debug/moc_phoneinput.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp\
GeneratedFiles/Debug/moc_switcher.cpp GeneratedFiles/Debug/moc_phoneinput.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp\
GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_addparticipantbox.cpp\
GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp\
GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_newgroupbox.cpp\
@ -88,9 +88,9 @@ GeneratedFiles/qrc_telegram.cpp: SourceFiles/telegram.qrc \
SourceFiles/art/chatcolor2.png
/usr/local/Qt-5.3.0/bin/rcc -name telegram SourceFiles/telegram.qrc -o GeneratedFiles/qrc_telegram.cpp
compiler_moc_header_make_all: GeneratedFiles/Debug/moc_application.cpp GeneratedFiles/Debug/moc_dialogswidget.cpp GeneratedFiles/Debug/moc_dropdown.cpp GeneratedFiles/Debug/moc_fileuploader.cpp GeneratedFiles/Debug/moc_historywidget.cpp GeneratedFiles/Debug/moc_layerwidget.cpp GeneratedFiles/Debug/moc_profilewidget.cpp GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_mainwidget.cpp GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_mtp.cpp GeneratedFiles/Debug/moc_mtpConnection.cpp GeneratedFiles/Debug/moc_mtpDC.cpp GeneratedFiles/Debug/moc_mtpFileLoader.cpp GeneratedFiles/Debug/moc_mtpSession.cpp GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_countrycodeinput.cpp GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp GeneratedFiles/Debug/moc_phoneinput.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_addparticipantbox.cpp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_newgroupbox.cpp GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_intro.cpp GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_introsignup.cpp GeneratedFiles/Debug/moc_pspecific_mac.cpp
compiler_moc_header_make_all: GeneratedFiles/Debug/moc_application.cpp GeneratedFiles/Debug/moc_dialogswidget.cpp GeneratedFiles/Debug/moc_dropdown.cpp GeneratedFiles/Debug/moc_fileuploader.cpp GeneratedFiles/Debug/moc_historywidget.cpp GeneratedFiles/Debug/moc_layerwidget.cpp GeneratedFiles/Debug/moc_profilewidget.cpp GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_mainwidget.cpp GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_mtp.cpp GeneratedFiles/Debug/moc_mtpConnection.cpp GeneratedFiles/Debug/moc_mtpDC.cpp GeneratedFiles/Debug/moc_mtpFileLoader.cpp GeneratedFiles/Debug/moc_mtpSession.cpp GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_countrycodeinput.cpp GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp GeneratedFiles/Debug/moc_switcher.cpp GeneratedFiles/Debug/moc_phoneinput.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_addparticipantbox.cpp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_newgroupbox.cpp GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_intro.cpp GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_introsignup.cpp GeneratedFiles/Debug/moc_pspecific_mac.cpp
compiler_moc_header_clean:
-$(DEL_FILE) GeneratedFiles/Debug/moc_application.cpp GeneratedFiles/Debug/moc_dialogswidget.cpp GeneratedFiles/Debug/moc_dropdown.cpp GeneratedFiles/Debug/moc_fileuploader.cpp GeneratedFiles/Debug/moc_historywidget.cpp GeneratedFiles/Debug/moc_layerwidget.cpp GeneratedFiles/Debug/moc_profilewidget.cpp GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_mainwidget.cpp GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_mtp.cpp GeneratedFiles/Debug/moc_mtpConnection.cpp GeneratedFiles/Debug/moc_mtpDC.cpp GeneratedFiles/Debug/moc_mtpFileLoader.cpp GeneratedFiles/Debug/moc_mtpSession.cpp GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_countrycodeinput.cpp GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp GeneratedFiles/Debug/moc_phoneinput.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_addparticipantbox.cpp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_newgroupbox.cpp GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_intro.cpp GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_introsignup.cpp GeneratedFiles/Debug/moc_pspecific_mac.cpp
-$(DEL_FILE) GeneratedFiles/Debug/moc_application.cpp GeneratedFiles/Debug/moc_dialogswidget.cpp GeneratedFiles/Debug/moc_dropdown.cpp GeneratedFiles/Debug/moc_fileuploader.cpp GeneratedFiles/Debug/moc_historywidget.cpp GeneratedFiles/Debug/moc_layerwidget.cpp GeneratedFiles/Debug/moc_profilewidget.cpp GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_mainwidget.cpp GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_mtp.cpp GeneratedFiles/Debug/moc_mtpConnection.cpp GeneratedFiles/Debug/moc_mtpDC.cpp GeneratedFiles/Debug/moc_mtpFileLoader.cpp GeneratedFiles/Debug/moc_mtpSession.cpp GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_countrycodeinput.cpp GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp GeneratedFiles/Debug/moc_switcher.cpp GeneratedFiles/Debug/moc_phoneinput.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_addparticipantbox.cpp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_newgroupbox.cpp GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_intro.cpp GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_introsignup.cpp GeneratedFiles/Debug/moc_pspecific_mac.cpp
GeneratedFiles/Debug/moc_application.cpp: ../../Libraries/QtStatic/qtbase/include/QtNetwork/QLocalSocket \
../../Libraries/QtStatic/qtbase/include/QtNetwork/QLocalServer \
../../Libraries/QtStatic/qtbase/include/QtNetwork/QNetworkReply \
@ -377,6 +377,20 @@ GeneratedFiles/Debug/moc_flattextarea.cpp: ../../Libraries/QtStatic/qtbase/inclu
SourceFiles/gui/flattextarea.h
/usr/local/Qt-5.3.0/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.3.0/mkspecs/macx-clang -I. -I/usr/local/Qt-5.3.0/include/QtGui/5.3.0/QtGui -I/usr/local/Qt-5.3.0/include/QtCore/5.3.0/QtCore -I/usr/local/Qt-5.3.0/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.3.0/include -I/usr/local/Qt-5.3.0/include/QtMultimedia -I/usr/local/Qt-5.3.0/include/QtWidgets -I/usr/local/Qt-5.3.0/include/QtNetwork -I/usr/local/Qt-5.3.0/include/QtGui -I/usr/local/Qt-5.3.0/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/gui/flattextarea.h -o GeneratedFiles/Debug/moc_flattextarea.cpp
GeneratedFiles/Debug/moc_switcher.cpp: ../../Libraries/QtStatic/qtbase/include/QtWidgets/QWidget \
SourceFiles/gui/twidget.h \
SourceFiles/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/gui/animation.h \
SourceFiles/types.h \
../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \
SourceFiles/logs.h \
../../Libraries/QtStatic/qtbase/include/QtCore/QTimer \
../../Libraries/QtStatic/qtbase/include/QtGui/QColor \
SourceFiles/gui/switcher.h
/usr/local/Qt-5.3.0/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.3.0/mkspecs/macx-clang -I. -I/usr/local/Qt-5.3.0/include/QtGui/5.3.0/QtGui -I/usr/local/Qt-5.3.0/include/QtCore/5.3.0/QtCore -I/usr/local/Qt-5.3.0/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.3.0/include -I/usr/local/Qt-5.3.0/include/QtMultimedia -I/usr/local/Qt-5.3.0/include/QtWidgets -I/usr/local/Qt-5.3.0/include/QtNetwork -I/usr/local/Qt-5.3.0/include/QtGui -I/usr/local/Qt-5.3.0/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/gui/switcher.h -o GeneratedFiles/Debug/moc_switcher.cpp
GeneratedFiles/Debug/moc_phoneinput.cpp: SourceFiles/gui/flatinput.h \
../../Libraries/QtStatic/qtbase/include/QtWidgets/QLineEdit \
SourceFiles/style.h \