From 9fec887044aae5342d8b766f7f205ce00245de17 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 21 Feb 2016 15:47:30 +0300 Subject: [PATCH 1/6] langs updated, link click async in overviewwidget --- Telegram/Resources/lang.strings | 3 ++- Telegram/SourceFiles/langs/lang_de.strings | 2 +- Telegram/SourceFiles/langs/lang_it.strings | 4 ++-- Telegram/SourceFiles/overviewwidget.cpp | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Telegram/Resources/lang.strings b/Telegram/Resources/lang.strings index a03f486635..93d274595e 100644 --- a/Telegram/Resources/lang.strings +++ b/Telegram/Resources/lang.strings @@ -262,6 +262,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_bg_from_gallery" = "Choose from gallery"; "lng_settings_bg_from_file" = "Choose from file"; "lng_settings_bg_tile" = "Tile background"; +"lng_settings_adaptive_wide" = "Adaptive layout for wide screens"; "lng_backgrounds_header" = "Choose your new chat background"; @@ -836,7 +837,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_new_version_wrap" = "Telegram Desktop was updated to version {version}\n\n{changes}\n\nFull version history is available here:\n{link}"; "lng_new_version_minor" = "— Bug fixes and other minor improvements"; -"lng_new_version_text" = "— New waveform visualizations for voice messages\n— Sticker suggestions when you type an emoji"; +"lng_new_version_text" = "— Adaptive layout for wide screens switch added to Settings\n— Linux version crash fix"; "lng_menu_insert_unicode" = "Insert Unicode control character"; diff --git a/Telegram/SourceFiles/langs/lang_de.strings b/Telegram/SourceFiles/langs/lang_de.strings index 364c5849a8..f9ea8f55ec 100644 --- a/Telegram/SourceFiles/langs/lang_de.strings +++ b/Telegram/SourceFiles/langs/lang_de.strings @@ -525,7 +525,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_migrate_reached" = "Limit von {count:_not_used_|# Mitglied|# Mitgliedern} erreicht"; "lng_profile_migrate_about" = "Für weitere Funktionen und um das Limit aufzuheben in Supergruppe ändern:"; -"lng_profile_migrate_feature1" = "— Bis zu {count:_not_used_|# Mitglied|# ;Mitglieder} sind nun möglich"; +"lng_profile_migrate_feature1" = "— Bis zu {count:_not_used_|# Mitglied|# Mitglieder} sind nun möglich"; "lng_profile_migrate_feature2" = "— Neue Mitglieder sehen gesamten Verlauf"; "lng_profile_migrate_feature3" = "— Admins können alle Nachrichten löschen"; "lng_profile_migrate_feature4" = "— Mitteilungen sind standardmäßig stumm"; diff --git a/Telegram/SourceFiles/langs/lang_it.strings b/Telegram/SourceFiles/langs/lang_it.strings index c1d8564f62..fac88aef7a 100644 --- a/Telegram/SourceFiles/langs/lang_it.strings +++ b/Telegram/SourceFiles/langs/lang_it.strings @@ -33,7 +33,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_open_from_tray" = "Apri Telegram"; "lng_minimize_to_tray" = "Riduci a icona"; "lng_quit_from_tray" = "Chiudi Telegram"; -"lng_tray_icon_text" = "Telegram è ancora attivo qui,\npuoi cambiarlo nelle impostazioni.\nSe l'icona scompare dall'area di notifica,\npuoi ripristinarla dalle icone nascoste."; +"lng_tray_icon_text" = "Telegram è ancora attivo qui,\npuoi cambiarlo nelle impostazioni.\nSe l'icona scompare dall'area di notifica,\npuoi trascinarla qui dalle icone nascoste."; "lng_month1" = "Gennaio"; "lng_month2" = "Febbraio"; @@ -276,7 +276,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_download_path_dir_radio" = "Cartella personalizzata, pulita a mano"; "lng_download_path_choose" = "Scegli il percorso di download"; "lng_sure_clear_downloads" = "Vuoi eliminare tutti i file scaricati nella cartella temporanea? Sarà fatto automaticamente alla disconnessione o alla disinstallazione del programma"; -"lng_download_path_failed" = "Il download del file non può iniziare. Potrebbe accadere a causa di un'errata posizione di download.\n\nPuoi cambiare il percorso di download nelle Impostazioni."; +"lng_download_path_failed" = "Il download del file non può iniziare. La causa potrebbe essere una posizione sbagliata per i download.\n\nPuoi cambiare il percorso di download nelle Impostazioni."; "lng_download_path_settings" = "Impostazioni"; "lng_download_finish_failed" = "Il download del file non può essere concluso.\n\nVuoi riprovare?"; "lng_download_path_clearing" = "Eliminazione.."; diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index f00799cf63..ad6c8473a5 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -560,8 +560,9 @@ void OverviewInner::dragActionFinish(const QPoint &screenPos, Qt::MouseButton bu } } if (needClick) { - needClick->onClick(button); + DEBUG_LOG(("Will click link: %1 (%2) %3").arg(needClick->text()).arg(needClick->readable()).arg(needClick->encoded())); dragActionCancel(); + App::activateTextLink(needClick, button); return; } if (_dragAction == PrepareSelect && !needClick && !_dragWasInactive && !_selected.isEmpty() && _selected.cbegin().value() == FullSelection) { From fb0f2971c0cb7e6e9694539e102a6a2878f3bff2 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 21 Feb 2016 16:00:46 +0300 Subject: [PATCH 2/6] fixed some possible crashes, fixed copy selected text to clipboard --- Telegram/SourceFiles/apiwrap.cpp | 4 +++- Telegram/SourceFiles/application.cpp | 4 +++- Telegram/SourceFiles/dialogswidget.cpp | 2 ++ Telegram/SourceFiles/historywidget.cpp | 8 ++++---- Telegram/SourceFiles/profilewidget.cpp | 18 ++++++++++-------- Telegram/SourceFiles/structs.cpp | 22 ++++++++++++---------- Telegram/SourceFiles/window.cpp | 2 +- 7 files changed, 35 insertions(+), 25 deletions(-) diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index ac90340590..e529b1f74d 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -346,7 +346,9 @@ void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result, mtpRequestI App::feedUsers(MTP_vector(1, d.vuser), false); App::feedPhoto(d.vprofile_photo); App::feedUserLink(MTP_int(peerToUser(peer->id)), d.vlink.c_contacts_link().vmy_link, d.vlink.c_contacts_link().vforeign_link, false); - App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), d.vnotify_settings); + if (App::main()) { + App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), d.vnotify_settings); + } peer->asUser()->setBotInfo(d.vbot_info); peer->asUser()->blocked = mtpIsTrue(d.vblocked) ? UserIsBlocked : UserIsNotBlocked; diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index f9c77dfc0f..b414fdb399 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -925,7 +925,9 @@ void AppClass::checkLocalTime() { void AppClass::onAppStateChanged(Qt::ApplicationState state) { checkLocalTime(); - _window->updateIsActive((state == Qt::ApplicationActive) ? cOnlineFocusTimeout() : cOfflineBlurTimeout()); + if (_window) { + _window->updateIsActive((state == Qt::ApplicationActive) ? cOnlineFocusTimeout() : cOfflineBlurTimeout()); + } if (state != Qt::ApplicationActive) { PopupTooltip::Hide(); } diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 889580af44..fca26a14b1 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -1366,6 +1366,8 @@ void DialogsInner::selectSkipPage(int32 pixels, int32 direction) { } void DialogsInner::loadPeerPhotos(int32 yFrom) { + if (!parentWidget()) return; + int32 yTo = yFrom + parentWidget()->height() * 5; MTP::clearLoaderPriorities(); if (_state == DefaultState) { diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index a7e5a35958..35ca99daae 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -844,10 +844,10 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { } else { uint16 symbol, selFrom = (_selected.cbegin().value() >> 16) & 0xFFFF, selTo = _selected.cbegin().value() & 0xFFFF; hasSelected = (selTo > selFrom) ? 1 : 0; - if (_dragItem && _dragItem == App::hoveredItem()) { - QPoint mousePos(mapMouseToItem(mapFromGlobal(_dragPos), _dragItem)); + if (App::mousedItem() && App::mousedItem() == App::hoveredItem()) { + QPoint mousePos(mapMouseToItem(mapFromGlobal(_dragPos), App::mousedItem())); bool afterDragSymbol, uponSymbol; - _dragItem->getSymbol(symbol, afterDragSymbol, uponSymbol, mousePos.x(), mousePos.y()); + App::mousedItem()->getSymbol(symbol, afterDragSymbol, uponSymbol, mousePos.x(), mousePos.y()); if (uponSymbol && symbol >= selFrom && symbol < selTo) { isUponSelected = 1; } @@ -7148,7 +7148,7 @@ void HistoryWidget::drawRecording(Painter &p) { } void HistoryWidget::paintEvent(QPaintEvent *e) { - if (App::wnd() && App::wnd()->contentOverlapped(this, e)) return; + if (!App::main() || (App::wnd() && App::wnd()->contentOverlapped(this, e))) return; Painter p(this); QRect r(e->rect()); diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index 313709f181..665ed2b668 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -1077,6 +1077,15 @@ void ProfileInner::mouseReleaseEvent(QMouseEvent *e) { connect(box, SIGNAL(confirmed()), this, SLOT(onKickConfirm())); Ui::showLayer(box); } + + _kickDown = 0; + if (!_photoLink && (_peerUser || (_peerChat && !_peerChat->canEdit()) || (_peerChannel && !_amCreator))) { + setCursor((_kickOver || _kickDown || textlnkOver()) ? style::cur_pointer : style::cur_default); + } else { + setCursor((_kickOver || _kickDown || _photoOver || textlnkOver()) ? style::cur_pointer : style::cur_default); + } + update(); + if (textlnkDown()) { TextLinkPtr lnk = textlnkDown(); textlnkDown(TextLinkPtr()); @@ -1087,17 +1096,10 @@ void ProfileInner::mouseReleaseEvent(QMouseEvent *e) { if (reBotCommand().match(lnk->encoded()).hasMatch()) { Ui::showPeerHistory(_peer, ShowAtTheEndMsgId); } - lnk->onClick(e->button()); + App::activateTextLink(lnk, e->button()); } } } - _kickDown = 0; - if (!_photoLink && (_peerUser || (_peerChat && !_peerChat->canEdit()) || (_peerChannel && !_amCreator))) { - setCursor((_kickOver || _kickDown || textlnkOver()) ? style::cur_pointer : style::cur_default); - } else { - setCursor((_kickOver || _kickDown || _photoOver || textlnkOver()) ? style::cur_pointer : style::cur_default); - } - update(); } void ProfileInner::onKickConfirm() { diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index 3803850684..1c05b266ab 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -688,11 +688,12 @@ void PhotoCancelLink::onClick(Qt::MouseButton button) const { if (!data->date) return; if (data->uploading()) { - HistoryItem *item = App::hoveredLinkItem() ? App::hoveredLinkItem() : (App::contextItem() ? App::contextItem() : 0); - if (HistoryMessage *msg = item->toHistoryMessage()) { - if (msg->getMedia() && msg->getMedia()->type() == MediaTypePhoto && static_cast(msg->getMedia())->photo() == data) { - App::contextItem(item); - App::main()->deleteLayer(-2); + if (HistoryItem *item = App::hoveredLinkItem() ? App::hoveredLinkItem() : (App::contextItem() ? App::contextItem() : 0)) { + if (HistoryMessage *msg = item->toHistoryMessage()) { + if (msg->getMedia() && msg->getMedia()->type() == MediaTypePhoto && static_cast(msg->getMedia())->photo() == data) { + App::contextItem(item); + App::main()->deleteLayer(-2); + } } } } else { @@ -964,11 +965,12 @@ void DocumentCancelLink::onClick(Qt::MouseButton button) const { if (!data->date) return; if (data->uploading()) { - HistoryItem *item = App::hoveredLinkItem() ? App::hoveredLinkItem() : (App::contextItem() ? App::contextItem() : 0); - if (HistoryMessage *msg = item->toHistoryMessage()) { - if (msg->getMedia() && msg->getMedia()->getDocument() == data) { - App::contextItem(item); - App::main()->deleteLayer(-2); + if (HistoryItem *item = App::hoveredLinkItem() ? App::hoveredLinkItem() : (App::contextItem() ? App::contextItem() : 0)) { + if (HistoryMessage *msg = item->toHistoryMessage()) { + if (msg->getMedia() && msg->getMedia()->getDocument() == data) { + App::contextItem(item); + App::main()->deleteLayer(-2); + } } } } else { diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp index 52f823b27e..1209ffc3e0 100644 --- a/Telegram/SourceFiles/window.cpp +++ b/Telegram/SourceFiles/window.cpp @@ -2730,7 +2730,7 @@ void LastCrashedWindow::onUpdateFailed() { void LastCrashedWindow::onContinue() { if (SignalHandlers::restart() == SignalHandlers::CantOpen) { new NotStartedWindow(); - } else { + } else if (!Global::started()) { Sandbox::launch(); } close(); From fc9d75b4f01fed32f3b4d5827ac47c5724ea5787 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 21 Feb 2016 17:27:54 +0300 Subject: [PATCH 3/6] adaptive layout checkbox added to settings --- Telegram/SourceFiles/facades.cpp | 2 ++ Telegram/SourceFiles/facades.h | 3 ++- Telegram/SourceFiles/historywidget.cpp | 1 + Telegram/SourceFiles/localstorage.cpp | 9 +++++++ Telegram/SourceFiles/settingswidget.cpp | 36 +++++++++++++++++++++++-- Telegram/SourceFiles/settingswidget.h | 5 +++- Telegram/SourceFiles/types.h | 1 + 7 files changed, 53 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index e6b3c22f0a..4ddf6aa6b4 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -348,6 +348,7 @@ namespace Sandbox { struct GlobalDataStruct { uint64 LaunchId = 0; Adaptive::Layout AdaptiveLayout = Adaptive::NormalLayout; + bool AdaptiveForWide = true; }; GlobalDataStruct *GlobalData = 0; @@ -370,5 +371,6 @@ namespace Global { DefineReadOnlyVar(Global, uint64, LaunchId); DefineVar(Global, Adaptive::Layout, AdaptiveLayout); + DefineVar(Global, bool, AdaptiveForWide); }; diff --git a/Telegram/SourceFiles/facades.h b/Telegram/SourceFiles/facades.h index 328773f2de..5d54267d54 100644 --- a/Telegram/SourceFiles/facades.h +++ b/Telegram/SourceFiles/facades.h @@ -139,6 +139,7 @@ namespace Global { DeclareReadOnlyVar(uint64, LaunchId); DeclareVar(Adaptive::Layout, AdaptiveLayout); + DeclareVar(bool, AdaptiveForWide); }; @@ -150,6 +151,6 @@ namespace Adaptive { return Global::AdaptiveLayout() == NormalLayout; } inline bool Wide() { - return Global::AdaptiveLayout() == WideLayout; + return Global::AdaptiveForWide() && (Global::AdaptiveLayout() == WideLayout); } } diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 35ca99daae..e0883fe375 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -4690,6 +4690,7 @@ void HistoryWidget::doneShow() { void HistoryWidget::updateAdaptiveLayout() { _sideShadow.setVisible(!Adaptive::OneColumn()); + update(); } void HistoryWidget::animStop() { diff --git a/Telegram/SourceFiles/localstorage.cpp b/Telegram/SourceFiles/localstorage.cpp index da64f2cb96..bc7757d133 100644 --- a/Telegram/SourceFiles/localstorage.cpp +++ b/Telegram/SourceFiles/localstorage.cpp @@ -1121,6 +1121,14 @@ namespace { } } break; + case dbiAdaptiveForWide: { + qint32 v; + stream >> v; + if (!_checkStreamStatus(stream)) return false; + + Global::SetAdaptiveForWide(v == 1); + } break; + case dbiAutoLock: { qint32 v; stream >> v; @@ -1506,6 +1514,7 @@ namespace { EncryptedDescriptor data(size); data.stream << quint32(dbiSendKey) << qint32(cCtrlEnter() ? dbiskCtrlEnter : dbiskEnter); data.stream << quint32(dbiTileBackground) << qint32(cTileBackground() ? 1 : 0); + data.stream << quint32(dbiAdaptiveForWide) << qint32(Global::AdaptiveForWide() ? 1 : 0); data.stream << quint32(dbiAutoLock) << qint32(cAutoLock()); data.stream << quint32(dbiReplaceEmojis) << qint32(cReplaceEmojis() ? 1 : 0); data.stream << quint32(dbiDefaultAttach) << qint32(cDefaultAttach()); diff --git a/Telegram/SourceFiles/settingswidget.cpp b/Telegram/SourceFiles/settingswidget.cpp index 36c4fa1df0..89e0925c5e 100644 --- a/Telegram/SourceFiles/settingswidget.cpp +++ b/Telegram/SourceFiles/settingswidget.cpp @@ -187,6 +187,7 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent) , _backFromGallery(this, lang(lng_settings_bg_from_gallery)) , _backFromFile(this, lang(lng_settings_bg_from_file)) , _tileBackground(this, lang(lng_settings_bg_tile), cTileBackground()) +, _adaptiveForWide(this, lang(lng_settings_adaptive_wide), Global::AdaptiveForWide()) , _needBackgroundUpdate(false) // advanced @@ -310,6 +311,7 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent) connect(&_backFromGallery, SIGNAL(clicked()), this, SLOT(onBackFromGallery())); connect(&_backFromFile, SIGNAL(clicked()), this, SLOT(onBackFromFile())); connect(&_tileBackground, SIGNAL(changed()), this, SLOT(onTileBackground())); + connect(&_adaptiveForWide, SIGNAL(changed()), this, SLOT(onAdaptiveForWide())); // advanced connect(&_passcodeEdit, SIGNAL(clicked()), this, SLOT(onPasscode())); @@ -635,6 +637,10 @@ void SettingsInner::paintEvent(QPaintEvent *e) { top += st::setBackgroundSize; top += st::setLittleSkip; top += _tileBackground.height(); + if (Global::AdaptiveLayout() == Adaptive::WideLayout) { + top += st::setLittleSkip; + top += _adaptiveForWide.height(); + } } // advanced @@ -753,6 +759,10 @@ void SettingsInner::resizeEvent(QResizeEvent *e) { top += st::setLittleSkip; _tileBackground.move(_left, top); top += _tileBackground.height(); + if (Global::AdaptiveLayout() == Adaptive::WideLayout) { + top += st::setLittleSkip; + _adaptiveForWide.move(_left, top); top += _adaptiveForWide.height(); + } } // advanced @@ -855,6 +865,11 @@ void SettingsInner::mousePressEvent(QMouseEvent *e) { void SettingsInner::contextMenuEvent(QContextMenuEvent *e) { } +void SettingsInner::updateAdaptiveLayout() { + showAll(); + resizeEvent(0); +} + void SettingsInner::step_photo(float64 ms, bool timer) { float64 dt = ms / st::setPhotoDuration; if (dt >= 1) { @@ -1093,10 +1108,16 @@ void SettingsInner::showAll() { _backFromGallery.show(); _backFromFile.show(); _tileBackground.show(); + if (Global::AdaptiveLayout() == Adaptive::WideLayout) { + _adaptiveForWide.show(); + } else { + _adaptiveForWide.hide(); + } } else { _backFromGallery.hide(); _backFromFile.hide(); _tileBackground.hide(); + _adaptiveForWide.hide(); } // advanced @@ -1628,6 +1649,16 @@ void SettingsInner::onTileBackground() { } } +void SettingsInner::onAdaptiveForWide() { + if (Global::AdaptiveForWide() != _adaptiveForWide.checked()) { + Global::SetAdaptiveForWide(_adaptiveForWide.checked()); + if (App::wnd()) { + App::wnd()->updateAdaptiveLayout(); + } + Local::writeUserSettings(); + } +} + void SettingsInner::onDontAskDownloadPath() { cSetAskDownloadPath(!_dontAskDownloadPath.checked()); Local::writeUserSettings(); @@ -1898,10 +1929,11 @@ void SettingsWidget::updateAdaptiveLayout() { } else { _close.show(); } + _inner.updateAdaptiveLayout(); + resizeEvent(0); } -void SettingsWidget::updateDisplayNotify() -{ +void SettingsWidget::updateDisplayNotify() { _inner.enableDisplayNotify(cDesktopNotify()); } diff --git a/Telegram/SourceFiles/settingswidget.h b/Telegram/SourceFiles/settingswidget.h index 08499ca60d..65e222fcb3 100644 --- a/Telegram/SourceFiles/settingswidget.h +++ b/Telegram/SourceFiles/settingswidget.h @@ -71,6 +71,8 @@ public: void mousePressEvent(QMouseEvent *e); void contextMenuEvent(QContextMenuEvent *e); + void updateAdaptiveLayout(); + void step_photo(float64 ms, bool timer); void updateSize(int32 newWidth); @@ -156,6 +158,7 @@ public slots: void onBackFromGallery(); void onBackFromFile(); void onTileBackground(); + void onAdaptiveForWide(); void onLocalStorageClear(); @@ -273,7 +276,7 @@ private: // chat background QPixmap _background; LinkButton _backFromGallery, _backFromFile; - FlatCheckbox _tileBackground; + FlatCheckbox _tileBackground, _adaptiveForWide; bool _needBackgroundUpdate; // advanced diff --git a/Telegram/SourceFiles/types.h b/Telegram/SourceFiles/types.h index b93bf822d3..99f12ef31c 100644 --- a/Telegram/SourceFiles/types.h +++ b/Telegram/SourceFiles/types.h @@ -352,6 +352,7 @@ enum DataBlockId { dbiSavedGifsLimit = 0x35, dbiShowingSavedGifs = 0x36, dbiAutoPlay = 0x37, + dbiAdaptiveForWide = 0x38, dbiEncryptedWithSalt = 333, dbiEncrypted = 444, From 23a8090a7337ce75ee01baf4df586d0409cd1ba4 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 21 Feb 2016 17:45:07 +0300 Subject: [PATCH 4/6] static linked openssl in Qt, gobject dynamic linked, moved gtk/appindicator init after Qt Application creation, trying to enable rdynamic flag --- QTCREATOR.md | 13 +++++++++- Telegram/Build.sh | 4 +-- Telegram/FixMake.sh | 9 ++++--- Telegram/SourceFiles/pspecific.h | 5 ++++ Telegram/SourceFiles/pspecific_linux.cpp | 31 ++++++++++++++---------- Telegram/SourceFiles/pspecific_mac.cpp | 8 ++++++ Telegram/SourceFiles/pspecific_wnd.cpp | 8 ++++++ Telegram/SourceFiles/types.cpp | 4 +++ Telegram/Telegram.pro | 6 ++--- 9 files changed, 65 insertions(+), 23 deletions(-) diff --git a/QTCREATOR.md b/QTCREATOR.md index 9576e30dd5..28184888b9 100644 --- a/QTCREATOR.md +++ b/QTCREATOR.md @@ -101,6 +101,17 @@ then go to **/home/user/TBuild/Libraries/openal-soft/build** and run make sudo make install +####OpenSSL + +In Terminal go to **/home/user/TBuild/Libraries** and run + + git clone https://github.com/openssl/openssl + cd openssl + git checkout OpenSSL_1_0_1-stable + ./config + make + sudo make install + ####libxkbcommon (required for Fcitx Qt plugin) In Terminal go to **/home/user/TBuild/Libraries** and run @@ -136,7 +147,7 @@ Install some packages for Qt (see **/home/user/TBuild/Libraries/QtStatic/qtbase/ In Terminal go to **/home/user/TBuild/Libraries/QtStatic** and there run - ./configure -release -opensource -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb -qt-xkbcommon-x11 -no-opengl -static -nomake examples -nomake tests + OPENSSL_LIBS='/usr/local/ssl/lib/libssl.a /usr/local/ssl/lib/libcrypto.a' ./configure -release -opensource -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb -qt-xkbcommon-x11 -no-opengl -static -openssl-linked -nomake examples -nomake tests make -j4 sudo make -j4 install diff --git a/Telegram/Build.sh b/Telegram/Build.sh index f7a64597ff..615639257f 100755 --- a/Telegram/Build.sh +++ b/Telegram/Build.sh @@ -111,14 +111,14 @@ if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ]; then mkdir -p "$WorkPath/ReleaseIntermediateUpdater" cd "$WorkPath/ReleaseIntermediateUpdater" - /usr/local/Qt-5.5.1/bin/qmake "$HomePath/Updater.pro" + /usr/local/Qt-5.5.1/bin/qmake "$HomePath/Updater.pro" -r -spec linux-g++ make echo "Updater build complete!" cd "$HomePath" mkdir -p "$WorkPath/ReleaseIntermediate" cd "$WorkPath/ReleaseIntermediate" - /usr/local/Qt-5.5.1/bin/qmake "$HomePath/Telegram.pro" + /usr/local/Qt-5.5.1/bin/qmake "$HomePath/Telegram.pro" -r -spec linux-g++ eval "$FixScript" make echo "Telegram build complete!" diff --git a/Telegram/FixMake.sh b/Telegram/FixMake.sh index e03c47d215..a92840e7c1 100755 --- a/Telegram/FixMake.sh +++ b/Telegram/FixMake.sh @@ -11,10 +11,10 @@ Replace () { } Replace '\-llzma' '\/usr\/lib\/x86_64\-linux\-gnu\/liblzma\.a' -Replace '\-lssl' '\/usr\/lib\/x86_64\-linux\-gnu\/libssl\.a' -Replace '\-lcrypto' '\/usr\/lib\/x86_64\-linux\-gnu\/libcrypto\.a' -Replace '\-lgobject\-2\.0' '\/usr\/lib\/x86_64\-linux\-gnu\/libgobject\-2\.0\.a \/usr\/lib\/x86_64\-linux\-gnu\/libffi\.a' -Replace '\-lXi' '\/usr\/lib\/x86_64\-linux\-gnu\/libXi\.a' +#Replace '\-lssl' '\/usr\/lib\/x86_64\-linux\-gnu\/libssl\.a' +#Replace '\-lcrypto' '\/usr\/lib\/x86_64\-linux\-gnu\/libcrypto\.a' +#Replace '\-lgobject\-2\.0' '\/usr\/lib\/x86_64\-linux\-gnu\/libgobject\-2\.0\.a \/usr\/lib\/x86_64\-linux\-gnu\/libffi\.a' +Replace '\-lXi' '\/usr\/lib\/x86_64\-linux\-gnu\/libXi\.a \/usr\/lib\/x86_64\-linux\-gnu\/libXext\.a' Replace '\-lSM' '\/usr\/lib\/x86_64\-linux\-gnu\/libSM\.a' Replace '\-lICE' '\/usr\/lib\/x86_64\-linux\-gnu\/libICE\.a' Replace '\-lfontconfig' '\/usr\/lib\/x86_64\-linux\-gnu\/libfontconfig\.a \/usr\/lib\/x86_64\-linux\-gnu\/libexpat\.a' @@ -28,3 +28,4 @@ Replace '\-lswresample' '\/usr\/local\/lib\/libswresample\.a' Replace '\-lswscale' '\/usr\/local\/lib\/libswscale\.a' Replace '\-lavutil' '\/usr\/local\/lib\/libavutil\.a' Replace '\-lva' '\/usr\/local\/lib\/libva\.a' +Replace '\-lQt5Network' '\/usr\/local\/Qt-5.5.1\/lib\/libQt5Network.a \/usr\/local\/ssl\/lib\/libssl.a \/usr\/local\/ssl\/lib\/libcrypto.a' diff --git a/Telegram/SourceFiles/pspecific.h b/Telegram/SourceFiles/pspecific.h index 98c8411466..7362f15da0 100644 --- a/Telegram/SourceFiles/pspecific.h +++ b/Telegram/SourceFiles/pspecific.h @@ -43,4 +43,9 @@ namespace PlatformSpecific { ~Initializer(); }; + namespace ThirdParty { + void start(); + void finish(); + } + } diff --git a/Telegram/SourceFiles/pspecific_linux.cpp b/Telegram/SourceFiles/pspecific_linux.cpp index 6b1e982da9..3ee28e7741 100644 --- a/Telegram/SourceFiles/pspecific_linux.cpp +++ b/Telegram/SourceFiles/pspecific_linux.cpp @@ -752,9 +752,6 @@ void PsMainWindow::psUpdatedPosition() { void PsMainWindow::psCreateTrayIcon() { if (!noQtTrayIcon) { cSetSupportTray(QSystemTrayIcon::isSystemTrayAvailable()); - if (!noTryUnity) { - useUnityCount = false; - } return; } @@ -1241,16 +1238,6 @@ void psShowInFolder(const QString &name) { namespace PlatformSpecific { Initializer::Initializer() { - QString cdesktop = QString(getenv("XDG_CURRENT_DESKTOP")).toLower(); - noQtTrayIcon = (cdesktop == qstr("pantheon")) || (cdesktop == qstr("gnome")); - tryAppIndicator = (cdesktop == qstr("xfce")); - noTryUnity = (cdesktop != qstr("unity")); - - if (noQtTrayIcon) cSetSupportTray(false); - - DEBUG_LOG(("Loading libraries")); - setupGtk(); - setupUnity(); } Initializer::~Initializer() { @@ -1258,6 +1245,24 @@ namespace PlatformSpecific { _psEventFilter = 0; } + namespace ThirdParty { + void start() { + QString cdesktop = QString(getenv("XDG_CURRENT_DESKTOP")).toLower(); + noQtTrayIcon = (cdesktop == qstr("pantheon")) || (cdesktop == qstr("gnome")); + tryAppIndicator = (cdesktop == qstr("xfce")); + noTryUnity = (cdesktop != qstr("unity")); + + if (noQtTrayIcon) cSetSupportTray(false); + + DEBUG_LOG(("Loading libraries")); + setupGtk(); + setupUnity(); + } + + void finish() { + } + } + } namespace { diff --git a/Telegram/SourceFiles/pspecific_mac.cpp b/Telegram/SourceFiles/pspecific_mac.cpp index 84349d6160..9d9c66cc03 100644 --- a/Telegram/SourceFiles/pspecific_mac.cpp +++ b/Telegram/SourceFiles/pspecific_mac.cpp @@ -861,6 +861,14 @@ namespace PlatformSpecific { objc_finish(); } + namespace ThirdParty { + void start() { + } + + void finish() { + } + } + } void psNewVersion() { diff --git a/Telegram/SourceFiles/pspecific_wnd.cpp b/Telegram/SourceFiles/pspecific_wnd.cpp index 044827de67..dc8b32d603 100644 --- a/Telegram/SourceFiles/pspecific_wnd.cpp +++ b/Telegram/SourceFiles/pspecific_wnd.cpp @@ -2170,6 +2170,14 @@ namespace PlatformSpecific { } } + namespace ThirdParty { + void start() { + } + + void finish() { + } + } + } namespace { diff --git a/Telegram/SourceFiles/types.cpp b/Telegram/SourceFiles/types.cpp index 706cae9c47..ce77262ae4 100644 --- a/Telegram/SourceFiles/types.cpp +++ b/Telegram/SourceFiles/types.cpp @@ -267,6 +267,8 @@ namespace { namespace ThirdParty { void start() { + PlatformSpecific::ThirdParty::start(); + if (!RAND_status()) { // should be always inited in all modern OS char buf[16]; memcpy(buf, &_msStart, 8); @@ -303,6 +305,8 @@ namespace ThirdParty { delete[] _sslLocks; _sslLocks = 0; + + PlatformSpecific::ThirdParty::finish(); } } diff --git a/Telegram/Telegram.pro b/Telegram/Telegram.pro index 408bd81904..4ff476e8b3 100644 --- a/Telegram/Telegram.pro +++ b/Telegram/Telegram.pro @@ -288,10 +288,10 @@ CONFIG(release, debug|release) { QMAKE_CXXFLAGS_RELEASE -= -O2 QMAKE_CXXFLAGS_RELEASE += -Ofast -flto -fno-strict-aliasing -g QMAKE_LFLAGS_RELEASE -= -O1 - QMAKE_LFLAGS_RELEASE += -Ofast -flto -g + QMAKE_LFLAGS_RELEASE += -Ofast -flto -g -rdynamic } CONFIG(debug, debug|release) { - QMAKE_LFLAGS_DEBUG += -g + QMAKE_LFLAGS_DEBUG += -g -rdynamic } INCLUDEPATH += ./../../Libraries/QtStatic/qtbase/include/QtGui/5.5.1/QtGui\ @@ -319,7 +319,7 @@ INCLUDEPATH += "/usr/include/atk-1.0" INCLUDEPATH += "/usr/include/dee-1.0" INCLUDEPATH += "/usr/include/libdbusmenu-glib-0.4" -LIBS += -lcrypto -lssl -ldl -llzma -lopenal -lavformat -lavcodec -lswresample -lswscale -lavutil -lopus -lva +LIBS += -ldl -llzma -lopenal -lavformat -lavcodec -lswresample -lswscale -lavutil -lopus -lva LIBS += ./../../../Libraries/QtStatic/qtbase/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.a \ ./../../../Libraries/QtStatic/qtbase/plugins/platforminputcontexts/libibusplatforminputcontextplugin.a \ ./../../../Libraries/QtStatic/qtbase/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.a From 90d104cf6135db5e24481d1087d04bf719289178 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 21 Feb 2016 17:54:00 +0300 Subject: [PATCH 5/6] version 0.9.25 dev --- Telegram/FixMake.sh | 3 --- Telegram/FixMake32.sh | 4 +--- Telegram/SourceFiles/application.cpp | 5 ++--- Telegram/SourceFiles/config.h | 6 +++--- Telegram/Telegram.plist | 2 +- Telegram/Telegram.rc | 8 ++++---- Telegram/Telegram.xcodeproj/project.pbxproj | 12 ++++++------ Telegram/Version | 8 ++++---- 8 files changed, 21 insertions(+), 27 deletions(-) diff --git a/Telegram/FixMake.sh b/Telegram/FixMake.sh index a92840e7c1..74b2c6b036 100755 --- a/Telegram/FixMake.sh +++ b/Telegram/FixMake.sh @@ -11,9 +11,6 @@ Replace () { } Replace '\-llzma' '\/usr\/lib\/x86_64\-linux\-gnu\/liblzma\.a' -#Replace '\-lssl' '\/usr\/lib\/x86_64\-linux\-gnu\/libssl\.a' -#Replace '\-lcrypto' '\/usr\/lib\/x86_64\-linux\-gnu\/libcrypto\.a' -#Replace '\-lgobject\-2\.0' '\/usr\/lib\/x86_64\-linux\-gnu\/libgobject\-2\.0\.a \/usr\/lib\/x86_64\-linux\-gnu\/libffi\.a' Replace '\-lXi' '\/usr\/lib\/x86_64\-linux\-gnu\/libXi\.a \/usr\/lib\/x86_64\-linux\-gnu\/libXext\.a' Replace '\-lSM' '\/usr\/lib\/x86_64\-linux\-gnu\/libSM\.a' Replace '\-lICE' '\/usr\/lib\/x86_64\-linux\-gnu\/libICE\.a' diff --git a/Telegram/FixMake32.sh b/Telegram/FixMake32.sh index b3a601925c..0f17f8bc10 100755 --- a/Telegram/FixMake32.sh +++ b/Telegram/FixMake32.sh @@ -11,9 +11,6 @@ Replace () { } Replace '\-llzma' '\/usr\/lib\/i386\-linux\-gnu\/liblzma\.a' -Replace '\-lssl' '\/usr\/lib\/i386\-linux\-gnu\/libssl\.a' -Replace '\-lcrypto' '\/usr\/lib\/i386\-linux\-gnu\/libcrypto\.a' -Replace '\-lgobject\-2\.0' '\/usr\/lib\/i386\-linux\-gnu\/libgobject\-2\.0\.a \/usr\/lib\/i386\-linux\-gnu\/libffi\.a' Replace '\-lXi' '\/usr\/lib\/i386\-linux\-gnu\/libXi\.a' Replace '\-lSM' '\/usr\/lib\/i386\-linux\-gnu\/libSM\.a' Replace '\-lICE' '\/usr\/lib\/i386\-linux\-gnu\/libICE\.a' @@ -28,3 +25,4 @@ Replace '\-lswresample' '\/usr\/local\/lib\/libswresample\.a' Replace '\-lswscale' '\/usr\/local\/lib\/libswscale\.a' Replace '\-lavutil' '\/usr\/local\/lib\/libavutil\.a' Replace '\-lva' '\/usr\/local\/lib\/libva\.a' +Replace '\-lQt5Network' '\/usr\/local\/Qt-5.5.1\/lib\/libQt5Network.a \/usr\/local\/ssl\/lib\/libssl.a \/usr\/local\/ssl\/lib\/libcrypto.a' diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index b414fdb399..f507c4492a 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -1053,9 +1053,8 @@ void AppClass::checkMapVersion() { if (Local::oldMapVersion() < AppVersion) { if (Local::oldMapVersion()) { QString versionFeatures; - if ((cDevVersion() || cBetaVersion()) && Local::oldMapVersion() < 9024) { -// versionFeatures = QString::fromUtf8("\xe2\x80\x94 Voice messages waveform visualizations\n\xe2\x80\x94 Bug fixes and other minor improvements");// .replace('@', qsl("@") + QChar(0x200D)); - versionFeatures = lang(lng_new_version_minor).trimmed(); + if ((cDevVersion() || cBetaVersion()) && Local::oldMapVersion() < 9025) { + versionFeatures = QString::fromUtf8("\xe2\x80\x94 Adaptive layout for wide screens switch added to Settings\n\xe2\x80\x94 Linux version crash fix");// .replace('@', qsl("@") + QChar(0x200D)); } else if (Local::oldMapVersion() < 9024) { versionFeatures = lang(lng_new_version_text).trimmed(); } else { diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index e8981faaee..1f6fd6588e 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -20,9 +20,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once -static const int32 AppVersion = 9024; -static const wchar_t *AppVersionStr = L"0.9.24"; -static const bool DevVersion = false; +static const int32 AppVersion = 9025; +static const wchar_t *AppVersionStr = L"0.9.25"; +static const bool DevVersion = true; //#define BETA_VERSION (9019002ULL) // just comment this line to build public version static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)"; diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist index 48739e2a3e..789cf25856 100644 --- a/Telegram/Telegram.plist +++ b/Telegram/Telegram.plist @@ -11,7 +11,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9.24 + 0.9.25 CFBundleSignature ???? CFBundleURLTypes diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc index a73c381b16..04b48ea038 100644 --- a/Telegram/Telegram.rc +++ b/Telegram/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "SourceFiles\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,9,24,0 - PRODUCTVERSION 0,9,24,0 + FILEVERSION 0,9,25,0 + PRODUCTVERSION 0,9,25,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "0.9.24.0" + VALUE "FileVersion", "0.9.25.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.9.24.0" + VALUE "ProductVersion", "0.9.25.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj index 90ee768992..ba4d36601d 100644 --- a/Telegram/Telegram.xcodeproj/project.pbxproj +++ b/Telegram/Telegram.xcodeproj/project.pbxproj @@ -1720,7 +1720,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.9.24; + CURRENT_PROJECT_VERSION = 0.9.25; DEBUG_INFORMATION_FORMAT = dwarf; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; @@ -1739,7 +1739,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 0.9.24; + CURRENT_PROJECT_VERSION = 0.9.25; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_OPTIMIZATION_LEVEL = fast; GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; @@ -1768,10 +1768,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.9.24; + CURRENT_PROJECT_VERSION = 0.9.25; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 0.9; - DYLIB_CURRENT_VERSION = 0.9.24; + DYLIB_CURRENT_VERSION = 0.9.25; ENABLE_STRICT_OBJC_MSGSEND = YES; FRAMEWORK_SEARCH_PATHS = ""; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -1909,10 +1909,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.9.24; + CURRENT_PROJECT_VERSION = 0.9.25; DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 0.9; - DYLIB_CURRENT_VERSION = 0.9.24; + DYLIB_CURRENT_VERSION = 0.9.25; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; FRAMEWORK_SEARCH_PATHS = ""; diff --git a/Telegram/Version b/Telegram/Version index 5108f1ff6f..ba8449dac8 100644 --- a/Telegram/Version +++ b/Telegram/Version @@ -1,6 +1,6 @@ -AppVersion 9024 +AppVersion 9025 AppVersionStrMajor 0.9 -AppVersionStrSmall 0.9.24 -AppVersionStr 0.9.24 -DevChannel 0 +AppVersionStrSmall 0.9.25 +AppVersionStr 0.9.25 +DevChannel 1 BetaVersion 0 9019002 From 4716c258756e65eecb8cda9f2497c0b1854467eb Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 21 Feb 2016 18:41:17 +0300 Subject: [PATCH 6/6] build script for linux32 fixed, 0.9.25 dev --- Telegram/FixMake32.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/FixMake32.sh b/Telegram/FixMake32.sh index 0f17f8bc10..24d5e677f9 100755 --- a/Telegram/FixMake32.sh +++ b/Telegram/FixMake32.sh @@ -11,7 +11,7 @@ Replace () { } Replace '\-llzma' '\/usr\/lib\/i386\-linux\-gnu\/liblzma\.a' -Replace '\-lXi' '\/usr\/lib\/i386\-linux\-gnu\/libXi\.a' +Replace '\-lXi' '\/usr\/lib\/i386\-linux\-gnu\/libXi\.a \/usr\/lib\/i386\-linux\-gnu\/libXext\.a' Replace '\-lSM' '\/usr\/lib\/i386\-linux\-gnu\/libSM\.a' Replace '\-lICE' '\/usr\/lib\/i386\-linux\-gnu\/libICE\.a' Replace '\-lfontconfig' '\/usr\/lib\/i386\-linux\-gnu\/libfontconfig\.a \/usr\/lib\/i386\-linux\-gnu\/libexpat\.a'