From 4ff3470a7fc9e8fadc199e5030424b627327a443 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 9 Jul 2014 09:54:12 +0400 Subject: [PATCH] merged changes to ubuntu qt creator build, prepared it --- Telegram/MetaEmoji.pro | 12 +- Telegram/MetaLang.pro | 14 +- Telegram/MetaStyle.pro | 14 +- Telegram/SourceFiles/application.cpp | 2 +- Telegram/SourceFiles/boxes/emojibox.cpp | 2 +- .../SourceFiles/mtproto/mtpConnection.cpp | 2 +- Telegram/SourceFiles/pspecific_linux.cpp | 493 +----------------- Telegram/SourceFiles/pspecific_linux.h | 93 +--- Telegram/SourceFiles/title.cpp | 2 +- Telegram/Telegram.pro | 35 ++ Telegram/metalang_plugin_import.cpp | 13 - Telegram/metastyle_plugin_import.cpp | 13 - Telegram/telegram_plugin_import.cpp | 17 - 13 files changed, 82 insertions(+), 630 deletions(-) delete mode 100644 Telegram/metalang_plugin_import.cpp delete mode 100644 Telegram/metastyle_plugin_import.cpp delete mode 100644 Telegram/telegram_plugin_import.cpp diff --git a/Telegram/MetaEmoji.pro b/Telegram/MetaEmoji.pro index 8bc1723dda..b897bc727f 100644 --- a/Telegram/MetaEmoji.pro +++ b/Telegram/MetaEmoji.pro @@ -2,14 +2,14 @@ QT += core CONFIG(debug, debug|release) { DEFINES += _DEBUG - OBJECTS_DIR = ./../Linux/DebugIntermediateEmoji + OBJECTS_DIR = ./../DebugIntermediateEmoji MOC_DIR = ./GeneratedFiles/Debug - DESTDIR = ./../Linux/DebugEmoji + DESTDIR = ./../DebugEmoji } CONFIG(release, debug|release) { - OBJECTS_DIR = ./../Linux/ReleaseIntermediateEmoji + OBJECTS_DIR = ./../ReleaseIntermediateEmoji MOC_DIR = ./GeneratedFiles/Release - DESTDIR = ./../Linux/ReleaseEmoji + DESTDIR = ./../ReleaseEmoji } macx { @@ -25,7 +25,7 @@ HEADERS += \ ./SourceFiles/_other/memain.h \ ./SourceFiles/_other/genemoji.h \ -INCLUDEPATH += ./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui\ - ./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore\ +INCLUDEPATH += ./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.1/QtGui\ + ./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.1/QtCore\ ./../../Libraries/QtStatic/qtbase/include\ diff --git a/Telegram/MetaLang.pro b/Telegram/MetaLang.pro index abe460d42a..b5c77ad1b2 100644 --- a/Telegram/MetaLang.pro +++ b/Telegram/MetaLang.pro @@ -1,15 +1,15 @@ -T += core +QT += core CONFIG(debug, debug|release) { DEFINES += _DEBUG - OBJECTS_DIR = ./../Linux/DebugIntermediateLang + OBJECTS_DIR = ./../DebugIntermediateLang MOC_DIR = ./GeneratedFiles/Debug - DESTDIR = ./../Linux/DebugLang + DESTDIR = ./../DebugLang } CONFIG(release, debug|release) { - OBJECTS_DIR = ./../Linux/ReleaseIntermediateLang + OBJECTS_DIR = ./../ReleaseIntermediateLang MOC_DIR = ./GeneratedFiles/Release - DESTDIR = ./../Linux/ReleaseLang + DESTDIR = ./../ReleaseLang } macx { @@ -25,7 +25,7 @@ HEADERS += \ ./SourceFiles/_other/mlmain.h \ ./SourceFiles/_other/genlang.h \ -INCLUDEPATH += ./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui\ - ./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore\ +INCLUDEPATH += ./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.1/QtGui\ + ./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.1/QtCore\ ./../../Libraries/QtStatic/qtbase/include\ diff --git a/Telegram/MetaStyle.pro b/Telegram/MetaStyle.pro index f26242a0cb..7526123ab5 100644 --- a/Telegram/MetaStyle.pro +++ b/Telegram/MetaStyle.pro @@ -2,16 +2,18 @@ QT += core CONFIG(debug, debug|release) { DEFINES += _DEBUG - OBJECTS_DIR = ./../Linux/DebugIntermediateStyle + OBJECTS_DIR = ./../DebugIntermediateStyle MOC_DIR = ./GeneratedFiles/Debug - DESTDIR = ./../Linux/DebugStyle + DESTDIR = ./../DebugStyle } CONFIG(release, debug|release) { - OBJECTS_DIR = ./../Linux/ReleaseIntermediateStyle + OBJECTS_DIR = ./../ReleaseIntermediateStyle MOC_DIR = ./GeneratedFiles/Release - DESTDIR = ./../Linux/ReleaseStyle + DESTDIR = ./../ReleaseStyle } +CONFIG += plugin static + macx { QMAKE_INFO_PLIST = ./SourceFiles/_other/Style.plist QMAKE_LFLAGS += -framework Cocoa @@ -25,7 +27,7 @@ HEADERS += \ ./SourceFiles/_other/msmain.h \ ./SourceFiles/_other/genstyles.h \ -INCLUDEPATH += ./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui\ - ./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore\ +INCLUDEPATH += ./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.1/QtGui\ + ./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.1/QtCore\ ./../../Libraries/QtStatic/qtbase/include\ diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 395b23c56d..f570339d4e 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -117,7 +117,7 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv), window = new Window(); - psInstallEventFilter(); + psInstallEventFilter(); updateCheckTimer.setSingleShot(true); diff --git a/Telegram/SourceFiles/boxes/emojibox.cpp b/Telegram/SourceFiles/boxes/emojibox.cpp index 27e2629715..94a9ca0a0a 100644 --- a/Telegram/SourceFiles/boxes/emojibox.cpp +++ b/Telegram/SourceFiles/boxes/emojibox.cpp @@ -98,7 +98,7 @@ void EmojiBox::fillBlocks() { for (uint32 i = 0; i < replacesCount; ++i) { Block block(getEmoji(replaces[i].code), QString::fromUtf8(replaces[i].replace)); currentRow.push_back(block); - if (currentRow.size() == replacesInRow) { + if (int32(currentRow.size()) == replacesInRow) { _blocks.push_back(currentRow); currentRow.resize(0); } diff --git a/Telegram/SourceFiles/mtproto/mtpConnection.cpp b/Telegram/SourceFiles/mtproto/mtpConnection.cpp index a1cdd63d1c..ad786002dd 100644 --- a/Telegram/SourceFiles/mtproto/mtpConnection.cpp +++ b/Telegram/SourceFiles/mtproto/mtpConnection.cpp @@ -404,7 +404,7 @@ namespace { LOG(("TCP Error: bad packet size %1").arg(size * sizeof(mtpPrime))); return mtpBuffer(1, -500); } - if (packet[0] != size * sizeof(mtpPrime)) { + if (packet[0] != int32(size * sizeof(mtpPrime))) { LOG(("TCP Error: bad packet header")); TCP_LOG(("TCP Error: bad packet header, packet: %1").arg(mb(packet, size * sizeof(mtpPrime)).str())); return mtpBuffer(1, -500); diff --git a/Telegram/SourceFiles/pspecific_linux.cpp b/Telegram/SourceFiles/pspecific_linux.cpp index 0efa133505..ee630670d2 100644 --- a/Telegram/SourceFiles/pspecific_linux.cpp +++ b/Telegram/SourceFiles/pspecific_linux.cpp @@ -46,8 +46,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(¬ifyWaitTimer, SIGNAL(timeout()), this, SLOT(psNotifyFire())); - notifyWaitTimer.setSingleShot(true); } void PsMainWindow::psNotIdle() const { @@ -266,497 +264,32 @@ 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 ? ¬ifyWaiters : ¬ifySettingWaiters; - 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(); - } - //_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()); - } - } } 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 _monitorRect; + uint64 _monitorLastGot = 0; } -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; - } +QRect psDesktopRect() { + uint64 tnow = getms(); + if (tnow > _monitorLastGot + 1000 || tnow < _monitorLastGot) { + _monitorLastGot = tnow; + _monitorRect = QApplication::desktop()->availableGeometry(App::wnd()); } - 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)); - } + return _monitorRect; } -void PsMainWindow::psStopHiding() { - if (cCustomNotifies()) { - for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) { - (*i)->stopHiding(); - } - } +void PsMainWindow::psActivateNotify(NotifyWindow *w) { } -void PsMainWindow::psStartHiding() { - if (cCustomNotifies()) { - for (PsNotifyWindows::const_iterator i = notifyWindows.cbegin(), e = notifyWindows.cend(); i != e; ++i) { - (*i)->startHiding(); - } - } +void PsMainWindow::psClearNotifies(PeerId peerId) { } -void PsMainWindow::psUpdateNotifies() { - if (cCustomNotifies()) { - 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()),// 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) { } PsApplication::PsApplication(int &argc, char **argv) : QApplication(argc, argv) { @@ -1092,7 +625,7 @@ void PsUpdateDownloader::unpackUpdate() { LOG(("Update Error: cant read version from downloaded stream, status: %1").arg(stream.status())); return fatalFail(); } - if (version <= AppVersion) { + if (int32(version) <= AppVersion) { LOG(("Update Error: downloaded version %1 is not greater, than mine %2").arg(version).arg(AppVersion)); return fatalFail(); } diff --git a/Telegram/SourceFiles/pspecific_linux.h b/Telegram/SourceFiles/pspecific_linux.h index e23826df32..496986d122 100644 --- a/Telegram/SourceFiles/pspecific_linux.h +++ b/Telegram/SourceFiles/pspecific_linux.h @@ -27,59 +27,7 @@ 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 PsNotifyWindows; +class NotifyWindow; class PsMainWindow : public QMainWindow { Q_OBJECT @@ -115,19 +63,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: @@ -136,7 +80,6 @@ public slots: void psUpdateCounter(); void psSavePosition(Qt::WindowState state = Qt::WindowActive); void psIdleTimeout(); - void psNotifyFire(); protected: @@ -148,26 +91,6 @@ protected: QImage icon256; virtual void setupTrayIcon() { } - - typedef QMap NotifyWhenMap; - typedef QMap NotifyWhenMaps; - NotifyWhenMaps notifyWhenMaps; - struct NotifyWaiter { - NotifyWaiter(MsgId msg, uint64 when) : msg(msg), when(when) { - } - MsgId msg; - uint64 when; - }; - typedef QMap NotifyWaiters; - NotifyWaiters notifyWaiters; - NotifyWaiters notifySettingWaiters; - QTimer notifyWaitTimer; - - typedef QSet NotifyWhenAlert; - typedef QMap NotifyWhenAlerts; - NotifyWhenAlerts notifyWhenAlerts; - - PsNotifyWindows notifyWindows; QTimer psUpdatedPositionTimer; @@ -244,6 +167,8 @@ QString psAppDataPath(); QString psCurrentExeDirectory(int argc, char *argv[]); void psAutoStart(bool start, bool silent = false); +QRect psDesktopRect(); + int psCleanup(); int psFixPrevious(); diff --git a/Telegram/SourceFiles/title.cpp b/Telegram/SourceFiles/title.cpp index 42bb4f8af5..1d9370eaf6 100644 --- a/Telegram/SourceFiles/title.cpp +++ b/Telegram/SourceFiles/title.cpp @@ -216,7 +216,7 @@ HitTestType TitleWidget::hitTest(const QPoint &p) { if (x >= st::titleIconPos.x() && y >= st::titleIconPos.y() && x < st::titleIconPos.x() + st::titleIconRect.pxWidth() && y < st::titleIconPos.y() + st::titleIconRect.pxHeight()) { return HitTestIcon; } else if (false - || (_update.hitTest(p - _update.geometry().topLeft()) == HitTestSysButton) && _update.isVisible() + || (_update.hitTest(p - _update.geometry().topLeft()) == HitTestSysButton && _update.isVisible()) || (_minimize.hitTest(p - _minimize.geometry().topLeft()) == HitTestSysButton) || (_maximize.hitTest(p - _maximize.geometry().topLeft()) == HitTestSysButton) || (_restore.hitTest(p - _restore.geometry().topLeft()) == HitTestSysButton) diff --git a/Telegram/Telegram.pro b/Telegram/Telegram.pro index ac47c805a4..d3b1cb4a01 100644 --- a/Telegram/Telegram.pro +++ b/Telegram/Telegram.pro @@ -28,6 +28,39 @@ linux { HEADERS += ./SourceFiles/pspecific_linux.h } +style_auto_cpp.target = ./GeneratedFiles/style_auto.cpp +style_auto_cpp.depends = FORCE +style_auto_cpp.commands = ./../Linux/DebugStyle/MetaStyle -classes_in ./Resources/style_classes.txt -classes_out ./GeneratedFiles/style_classes.h -styles_in ./Resources/style.txt -styles_out ./GeneratedFiles/style_auto.h -path_to_sprites ./SourceFiles/art/ +style_auto_cpp.depends = ./Resources/style.txt ./Resources/style_classes.txt + +style_auto_h.target = ./GeneratedFiles/style_auto.h +style_auto_h.depends = FORCE +style_auto_h.commands = ./../Linux/DebugStyle/MetaStyle -classes_in ./Resources/style_classes.txt -classes_out ./GeneratedFiles/style_classes.h -styles_in ./Resources/style.txt -styles_out ./GeneratedFiles/style_auto.h -path_to_sprites ./SourceFiles/art/ +style_auto_h.depends = ./Resources/style.txt ./Resources/style_classes.txt + +style_classes_h.target = ./GeneratedFiles/style_classes.h +style_classes_h.depends = FORCE +style_classes_h.commands = ./../Linux/DebugStyle/MetaStyle -classes_in ./Resources/style_classes.txt -classes_out ./GeneratedFiles/style_classes.h -styles_in ./Resources/style.txt -styles_out ./GeneratedFiles/style_auto.h -path_to_sprites ./SourceFiles/art/ +style_classes_h.depends = ./Resources/style.txt ./Resources/style_classes.txt + +lang_cpp.target = ./GeneratedFiles/lang.cpp +lang_cpp.depends = FORCE +lang_cpp.commands = ./../Linux/DebugLang/MetaLang -lang_in ./Resources/lang.txt -lang_out ./GeneratedFiles/lang +lang_cpp.depends = ./Resources/lang.txt + +lang_h.target = ./GeneratedFiles/lang.h +lang_h.depends = FORCE +lang_h.commands = ./../Linux/DebugLang/MetaLang -lang_in ./Resources/lang.txt -lang_out ./GeneratedFiles/lang +lang_h.depends = ./Resources/lang.txt + +hook.depends = style_auto_cpp style_auto_h style_classes_h lang_cpp lang_h +CONFIG(debug,debug|release):hook.target = Makefile.Debug +CONFIG(release,debug|release):hook.target = Makefile.Release + +QMAKE_EXTRA_TARGETS += style_auto_cpp style_auto_h style_classes_h lang_cpp lang_h hook + +PRE_TARGETDEPS += ./GeneratedFiles/style_auto.cpp ./GeneratedFiles/style_auto.h ./GeneratedFiles/style_classes.h ./GeneratedFiles/lang.h ./GeneratedFiles/lang.cpp + SOURCES += \ ./SourceFiles/main.cpp \ ./SourceFiles/stdafx.cpp \ @@ -75,6 +108,7 @@ SOURCES += \ ./SourceFiles/gui/style_core.cpp \ ./SourceFiles/gui/text.cpp \ ./SourceFiles/gui/twidget.cpp \ + ./SourceFiles/gui/switcher.cpp \ ./GeneratedFiles/lang.cpp \ ./GeneratedFiles/style_auto.cpp \ ./SourceFiles/boxes/aboutbox.cpp \ @@ -149,6 +183,7 @@ HEADERS += \ ./SourceFiles/gui/style_core.h \ ./SourceFiles/gui/text.h \ ./SourceFiles/gui/twidget.h \ + ./SourceFiles/gui/switcher.h \ ./GeneratedFiles/lang.h \ ./GeneratedFiles/style_auto.h \ ./GeneratedFiles/style_classes.h \ diff --git a/Telegram/metalang_plugin_import.cpp b/Telegram/metalang_plugin_import.cpp deleted file mode 100644 index 7c0d095425..0000000000 --- a/Telegram/metalang_plugin_import.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// This file is autogenerated by qmake. It imports static plugin classes for -// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS. variables. -#include -Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) -Q_IMPORT_PLUGIN(QDDSPlugin) -Q_IMPORT_PLUGIN(QICNSPlugin) -Q_IMPORT_PLUGIN(QICOPlugin) -Q_IMPORT_PLUGIN(QJp2Plugin) -Q_IMPORT_PLUGIN(QMngPlugin) -Q_IMPORT_PLUGIN(QTgaPlugin) -Q_IMPORT_PLUGIN(QTiffPlugin) -Q_IMPORT_PLUGIN(QWbmpPlugin) -Q_IMPORT_PLUGIN(QWebpPlugin) diff --git a/Telegram/metastyle_plugin_import.cpp b/Telegram/metastyle_plugin_import.cpp deleted file mode 100644 index 7c0d095425..0000000000 --- a/Telegram/metastyle_plugin_import.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// This file is autogenerated by qmake. It imports static plugin classes for -// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS. variables. -#include -Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) -Q_IMPORT_PLUGIN(QDDSPlugin) -Q_IMPORT_PLUGIN(QICNSPlugin) -Q_IMPORT_PLUGIN(QICOPlugin) -Q_IMPORT_PLUGIN(QJp2Plugin) -Q_IMPORT_PLUGIN(QMngPlugin) -Q_IMPORT_PLUGIN(QTgaPlugin) -Q_IMPORT_PLUGIN(QTiffPlugin) -Q_IMPORT_PLUGIN(QWbmpPlugin) -Q_IMPORT_PLUGIN(QWebpPlugin) diff --git a/Telegram/telegram_plugin_import.cpp b/Telegram/telegram_plugin_import.cpp deleted file mode 100644 index 8e9103300e..0000000000 --- a/Telegram/telegram_plugin_import.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// This file is autogenerated by qmake. It imports static plugin classes for -// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS. variables. -#include -Q_IMPORT_PLUGIN(AudioCaptureServicePlugin) -Q_IMPORT_PLUGIN(QM3uPlaylistPlugin) -Q_IMPORT_PLUGIN(AccessibleFactory) -Q_IMPORT_PLUGIN(QGenericEnginePlugin) -Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) -Q_IMPORT_PLUGIN(QDDSPlugin) -Q_IMPORT_PLUGIN(QICNSPlugin) -Q_IMPORT_PLUGIN(QICOPlugin) -Q_IMPORT_PLUGIN(QJp2Plugin) -Q_IMPORT_PLUGIN(QMngPlugin) -Q_IMPORT_PLUGIN(QTgaPlugin) -Q_IMPORT_PLUGIN(QTiffPlugin) -Q_IMPORT_PLUGIN(QWbmpPlugin) -Q_IMPORT_PLUGIN(QWebpPlugin)