Skip to content

Commit

Permalink
top bar search icon added
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Mar 17, 2016
1 parent b9616bd commit ddc802c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*.suo
*.sdf
*.opensdf
*.opendb
/Telegram/*.aps
/Win32/
ipch/
Expand Down
15 changes: 15 additions & 0 deletions Telegram/Resources/style.txt
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,21 @@ topBarBackAlpha: 0.8;
topBarBackImg: sprite(65px, 112px, 9px, 16px);
topBarBackColor: #005faf;
topBarBackFont: font(16px);
topBarSearch: iconedButton(btnDefIconed) {
bgColor: transparent;
overBgColor: transparent;

icon: sprite(84px, 374px, 18px, 18px);
iconPos: point(13px, 18px);
downIcon: sprite(84px, 374px, 18px, 18px);
downIconPos: point(13px, 18px);

opacity: 0.22;
overOpacity: 0.36;

width: 44px;
height: topBarHeight;
}
topBarMinPadding: 5px;
topBarButton: flatButton(btnDefFlat) {
color: btnYesColor;
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.
21 changes: 19 additions & 2 deletions Telegram/SourceFiles/mainwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org

#include "localstorage.h"

#include "shortcuts.h"

#include "audio.h"

TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w)
Expand All @@ -56,6 +58,7 @@ TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w)
, _addContact(this, lang(lng_profile_add_contact), st::topBarButton)
, _deleteContact(this, lang(lng_profile_delete_contact), st::topBarButton)
, _mediaType(this, lang(lng_media_type), st::topBarButton)
, _search(this, st::topBarSearch)
, _sideShadow(this, st::shadowColor) {

connect(&_forward, SIGNAL(clicked()), this, SLOT(onForwardSelection()));
Expand All @@ -66,6 +69,7 @@ TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w)
connect(&_deleteContact, SIGNAL(clicked()), this, SLOT(onDeleteContact()));
connect(&_edit, SIGNAL(clicked()), this, SLOT(onEdit()));
connect(&_leaveGroup, SIGNAL(clicked()), this, SLOT(onDeleteAndExit()));
connect(&_search, SIGNAL(clicked()), this, SLOT(onSearch()));

setCursor(style::cur_pointer);
showAll();
Expand Down Expand Up @@ -147,6 +151,10 @@ void TopBarWidget::onDeleteAndExitSure() {
}
}

void TopBarWidget::onSearch() {
Shortcuts::launch(qsl("search"));
}

void TopBarWidget::enterEvent(QEvent *e) {
a_over.start(1);
_a_appearance.start();
Expand Down Expand Up @@ -261,6 +269,7 @@ void TopBarWidget::resizeEvent(QResizeEvent *e) {
if (!_edit.isHidden()) _edit.move(r -= _edit.width(), 0);
if (!_addContact.isHidden()) _addContact.move(r -= _addContact.width(), 0);
if (!_mediaType.isHidden()) _mediaType.move(r -= _mediaType.width(), 0);
_search.move(width() - (_info.isHidden() ? st::topBarForwardPadding.right() : _info.width()) - _search.width(), 0);

_sideShadow.resize(st::lineWidth, height());
_sideShadow.moveToLeft(0, 0);
Expand All @@ -276,6 +285,7 @@ void TopBarWidget::startAnim() {
_delete.hide();
_forward.hide();
_mediaType.hide();
_search.hide();

_animating = true;
}
Expand Down Expand Up @@ -318,6 +328,7 @@ void TopBarWidget::showAll() {
_delete.hide();
_forward.hide();
_mediaType.hide();
_search.hide();
} else {
if (p && p->isChannel() && (p->asChannel()->amCreator() || (p->isMegagroup() && p->asChannel()->amEditor()))) {
_edit.show();
Expand Down Expand Up @@ -346,9 +357,15 @@ void TopBarWidget::showAll() {
_mediaType.hide();
}
}
if (App::main() && App::main()->historyPeer() && !o && !p && _clearSelection.isHidden() && Adaptive::OneColumn()) {
_info.show();
if (h && !o && !p && _clearSelection.isHidden()) {
if (Adaptive::OneColumn()) {
_info.show();
} else {
_info.hide();
}
_search.show();
} else {
_search.hide();
_info.hide();
}
}
Expand Down
3 changes: 3 additions & 0 deletions Telegram/SourceFiles/mainwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public slots:
void onDeleteContactSure();
void onDeleteAndExit();
void onDeleteAndExitSure();
void onSearch();

signals:

Expand Down Expand Up @@ -105,6 +106,8 @@ public slots:
FlatButton _edit, _leaveGroup, _addContact, _deleteContact;
FlatButton _mediaType;

IconedButton _search;

PlainShadow _sideShadow;

};
Expand Down

0 comments on commit ddc802c

Please sign in to comment.