Skip to content

Commit

Permalink
version 0.5.6 with serverside messages search, win version only
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Jul 4, 2014
1 parent ce84c60 commit 29d6bf4
Show file tree
Hide file tree
Showing 35 changed files with 3,225 additions and 1,993 deletions.
2 changes: 2 additions & 0 deletions Telegram/Resources/lang.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ lng_signup_firstname: "First Name";
lng_signup_lastname: "Last Name";

lng_dlg_filter: "Search";
lng_dlg_conversations: "Conversations";
lng_dlg_messages: "Messages";
lng_dlg_new_group_name: "Group name";
lng_dlg_create_group: "Create";

Expand Down
54 changes: 47 additions & 7 deletions Telegram/Resources/style.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ btnDefBig: flatButton(btnDefFlat) {
overFont: font(23px);
height: 56px;
}
btnNextBG: #2fa9e2;
btnDefNext: flatButton(btnDefFlat) {
color: white;
overColor: white;
downColor: white;
bgColor: #2fa9e2;
bgColor: btnNextBG;
overBgColor: #279ad0;
downBgColor: #279ad0;
}
Expand Down Expand Up @@ -593,6 +594,23 @@ dlgPaddingVer: 8px;
dlgHeight: 62px;
dlgPhotoPadding: 12px;

dlgState: switcher {
border: 2px;
borderColor: btnNextBG;

bgColor: #fff;
bgHovered: btnWhiteHover;
bgActive: btnNextBG;

height: 34px;

font: font(fsize);
textColor: btnYesColor;
activeColor: #fff;

duration: 200;
}

dlgSep: 8px;

dlgShadowColor: rgba(0, 0, 0, 24);//#ebebeb
Expand Down Expand Up @@ -709,6 +727,24 @@ topBarActionSkip: 13px;
topBarSelectedPos: point(18px, 18px);

historyBG: #dfe4e8;

historyToEnd: iconedButton(btnDefIconed) {
bgColor: transparent;
overBgColor: transparent;

icon: sprite(252px, 41px, 44px, 44px);
iconPos: point(0px, 0px);
downIcon: sprite(252px, 41px, 44px, 44px);
downIconPos: point(0px, 0px);

width: 44px;
height: 44px;
}
historyToEndSkip: 10px;

activeFadeInDuration: 500;
activeFadeOutDuration: 3000;

msgMaxWidth: 550px;
msgFont: font(fsize);
msgNameFont: font(fsize semibold);
Expand Down Expand Up @@ -765,9 +801,9 @@ msgDateSpace: 19px;
msgDateCheckSpace: 4px;
msgDateDelta: point(2px, 5px);

msgImgSendingRect: sprite(280px, 40px, 20px, 20px);
msgImgSendingRect: sprite(320px, 65px, 20px, 20px);
msgImgCheckRect: sprite(280px, 20px, 20px, 20px);
msgImgDblCheckRect: sprite(260px, 40px, 20px, 20px);
msgImgDblCheckRect: sprite(300px, 65px, 20px, 20px);
msgDateImgDelta: 4px;
msgDateImgColor: #fff;
msgDateImgBg: #00000054;
Expand Down Expand Up @@ -877,8 +913,8 @@ btnAttachDocument: iconedButton(btnDefIconed) {
height: 46px;
}
btnAttachPhoto: iconedButton(btnAttachDocument) {
icon: sprite(278px, 68px, 24px, 24px);
downIcon: sprite(278px, 68px, 24px, 24px);
icon: sprite(113px, 0px, 24px, 24px);
downIcon: sprite(113px, 0px, 24px, 24px);
}
btnAttachEmoji: iconedButton(btnAttachDocument) {
overBgColor: white;
Expand Down Expand Up @@ -957,6 +993,10 @@ btnAddContact: iconedButton(btnNewGroup) {
icon: sprite(188px, 93px, 18px, 18px);
downIcon: sprite(188px, 93px, 18px, 18px);
}
btnCancelSearch: iconedButton(btnNewGroup) {
icon: sprite(188px, 43px, 18px, 18px);
downIcon: sprite(188px, 43px, 18px, 18px);
}

notifyBG: white;
notifyBorder: #f1f1f1;
Expand Down Expand Up @@ -1245,8 +1285,8 @@ dropdownAttachDocument: iconedButton(btnAttachDocument) {
downTextPos: point(50px, 14px);
}
dropdownAttachPhoto: iconedButton(dropdownAttachDocument) {
icon: sprite(278px, 68px, 24px, 24px);
downIcon: sprite(278px, 68px, 24px, 24px);
icon: sprite(113px, 0px, 24px, 24px);
downIcon: sprite(113px, 0px, 24px, 24px);
}

dragFont: font(28px semibold);
Expand Down
17 changes: 17 additions & 0 deletions Telegram/Resources/style_classes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,20 @@ flatLabel {
width: number;
align: align;
}

switcher {
border: number;
borderColor: color;

bgColor: color;
bgHovered: color;
bgActive: color;

height: number;

font: font;
textColor: color;
activeColor: color;

duration: number;
}
6 changes: 3 additions & 3 deletions Telegram/Setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#define MyAppShortName "Telegram"
#define MyAppName "Telegram Win (Unofficial)"
#define MyAppVersion "0.5.4"
#define MyAppVersionZero "0.5.4"
#define MyAppFullVersion "0.5.4.0"
#define MyAppVersion "0.5.6"
#define MyAppVersionZero "0.5.6"
#define MyAppFullVersion "0.5.6.0"
#define MyAppPublisher "Telegram (Unofficial)"
#define MyAppURL "https://tdesktop.com"
#define MyAppExeName "Telegram.exe"
Expand Down
59 changes: 39 additions & 20 deletions Telegram/SourceFiles/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ namespace App {
}
}
for (QMap<int32, int32>::const_iterator i = msgsIds.cbegin(), e = msgsIds.cend(); i != e; ++i) {
histories().addToBack(v[*i], newMsgs);
histories().addToBack(v[*i], newMsgs ? 1 : 0);
}
}

Expand Down Expand Up @@ -557,9 +557,6 @@ namespace App {
if (j != msgsData.cend()) {
History *h = (*j)->history();
(*j)->destroy();
if (h->isEmpty()) {
if (App::main()) App::main()->checkPeerHistory(h->peer);
}
}
}
}
Expand Down Expand Up @@ -1100,23 +1097,26 @@ namespace App {
return 0;
}

bool historyRegItem(HistoryItem *item) {
HistoryItem *historyRegItem(HistoryItem *item) {
MsgsData::const_iterator i = msgsData.constFind(item->id);
if (i == msgsData.cend()) {
msgsData.insert(item->id, item);
if (item->id > ::maxMsgId) ::maxMsgId = item->id;
return true;
return 0;
}
return (i.value() == item);
}

void historyUnregItem(HistoryItem *item) {
MsgsData::iterator i = msgsData.find(item->id);
if (i != msgsData.cend()) {
if (i.value() == item) {
msgsData.erase(i);
if (i.value() != item && !i.value()->block() && item->block()) { // replace search item
item->history()->itemReplaced(i.value(), item);
if (App::main()) {
emit App::main()->historyItemReplaced(i.value(), item);
}
delete i.value();
msgsData.insert(item->id, item);
return 0;
}
return (i.value() == item) ? 0 : i.value();
}

void historyItemDetached(HistoryItem *item) {
if (::hoveredItem == item) {
hoveredItem(0);
}
Expand All @@ -1135,13 +1135,32 @@ namespace App {
if (::mousedItem == item) {
mousedItem(0);
}
}

void historyUnregItem(HistoryItem *item) {
MsgsData::iterator i = msgsData.find(item->id);
if (i != msgsData.cend()) {
if (i.value() == item) {
msgsData.erase(i);
}
}
historyItemDetached(item);
if (App::main()) {
emit App::main()->historyItemDeleted(item);
}
}

void historyClearMsgs() {
QVector<HistoryItem*> toDelete;
for (MsgsData::const_iterator i = msgsData.cbegin(), e = msgsData.cend(); i != e; ++i) {
if ((*i)->detached()) {
toDelete.push_back(*i);
}
}
msgsData.clear();
for (int i = 0, l = toDelete.size(); i < l; ++i) {
delete toDelete[i];
}
::maxMsgId = 0;
::hoveredItem = ::pressedItem = ::hoveredLinkItem = ::pressedLinkItem = ::contextItem = 0;
}
Expand Down Expand Up @@ -1224,6 +1243,12 @@ namespace App {
textlnkOver(TextLinkPtr());
textlnkDown(TextLinkPtr());

if (completely && App::main()) {
App::main()->disconnect(SIGNAL(historyItemDeleted(HistoryItem *)));
}

histories().clear();

if (completely) {
LOG(("Deleting sound.."));
delete newMsgSound;
Expand All @@ -1242,12 +1267,6 @@ namespace App {
clearStorageImages();
}

if (App::main()) {
App::main()->disconnect(SIGNAL(historyItemDeleted(HistoryItem*)));
}

histories().clear();

serviceImageCacheSize = imageCacheSize();
}

Expand Down
3 changes: 2 additions & 1 deletion Telegram/SourceFiles/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ namespace App {
History *history(const PeerId &peer, int32 unreadCnt = 0);
History *historyLoaded(const PeerId &peer);
HistoryItem *histItemById(MsgId itemId);
bool historyRegItem(HistoryItem *item);
HistoryItem *historyRegItem(HistoryItem *item);
void historyItemDetached(HistoryItem *item);
void historyUnregItem(HistoryItem *item);
void historyClearMsgs();
void historyClearItems();
Expand Down
Binary file modified Telegram/SourceFiles/art/sprite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Telegram/SourceFiles/art/sprite_200x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/boxes/contactsbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void ContactsInner::chooseParticipant() {
}
if (r) {
App::wnd()->hideSettings(true);
App::main()->showPeer(r->history->peer->id, false, true);
App::main()->showPeer(r->history->peer->id, 0, false, true);
App::wnd()->hideLayer();
}

Expand Down
19 changes: 15 additions & 4 deletions Telegram/SourceFiles/boxes/newgroupbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,15 @@ QVector<MTPInputUser> NewGroupInner::selectedInputs() {
return result;
}

PeerData *NewGroupInner::selectedUser() {
for (ContactsData::const_iterator i = _contactsData.cbegin(), e = _contactsData.cend(); i != e; ++i) {
if (i.value()->check) {
return i.key();
}
}
return 0;
}

NewGroupBox::NewGroupBox() : _scroll(this, st::newGroupScroll), _inner(),
_filter(this, st::contactsFilter, lang(lng_participant_filter)),
_next(this, lang(lng_create_group_next), st::btnSelectDone),
Expand Down Expand Up @@ -579,13 +588,15 @@ void NewGroupBox::onClose() {

void NewGroupBox::onNext() {
MTPVector<MTPInputUser> users(MTP_vector<MTPInputUser>(_inner.selectedInputs()));
if (users.c_vector().v.isEmpty()) {
const QVector<MTPInputUser> &v(users.c_vector().v);
if (v.isEmpty()) {
_filter.setFocus();
_filter.notaBene();
return;
} else if (v.size() == 1) {
App::main()->showPeer(_inner.selectedUser()->id);
} else {
App::wnd()->replaceLayer(new CreateGroupBox(users));
}

App::wnd()->replaceLayer(new CreateGroupBox(users));
}

void NewGroupBox::onScroll() {
Expand Down
1 change: 1 addition & 0 deletions Telegram/SourceFiles/boxes/newgroupbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class NewGroupInner : public QWidget {
void selectSkipPage(int32 h, int32 dir);

QVector<MTPInputUser> selectedInputs();
PeerData *selectedUser();

void loadProfilePhotos(int32 yFrom);

Expand Down
9 changes: 7 additions & 2 deletions Telegram/SourceFiles/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
*/
#pragma once

static const int32 AppVersion = 5005;
static const wchar_t *AppVersionStr = L"0.5.5";
static const int32 AppVersion = 5006;
static const wchar_t *AppVersionStr = L"0.5.6";
#ifdef Q_OS_WIN
static const wchar_t *AppName = L"Telegram Win (Unofficial)";
#else
Expand Down Expand Up @@ -56,7 +56,12 @@ enum {
LocalEncryptSaltSize = 32, // 256 bit
LocalEncryptKeySize = 256, // 2048 bit

AnimationTimerDelta = 7,

SaveRecentEmojisTimeout = 3000, // 3 secs

AutoSearchTimeout = 1500, // 1.5 secs
SearchPerPage = 50,
};

#ifdef Q_OS_WIN
Expand Down
Loading

0 comments on commit 29d6bf4

Please sign in to comment.