top bar search icon added

This commit is contained in:
John Preston 2016-03-17 12:23:38 +03:00
parent b9616bdf75
commit ddc802c0af
6 changed files with 38 additions and 2 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@
*.suo
*.sdf
*.opensdf
*.opendb
/Telegram/*.aps
/Win32/
ipch/

View File

@ -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;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 KiB

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 KiB

After

Width:  |  Height:  |  Size: 243 KiB

View File

@ -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)
@ -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()));
@ -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();
@ -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();
@ -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);
@ -276,6 +285,7 @@ void TopBarWidget::startAnim() {
_delete.hide();
_forward.hide();
_mediaType.hide();
_search.hide();
_animating = true;
}
@ -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();
@ -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();
}
}

View File

@ -78,6 +78,7 @@ public slots:
void onDeleteContactSure();
void onDeleteAndExit();
void onDeleteAndExitSure();
void onSearch();
signals:
@ -105,6 +106,8 @@ private:
FlatButton _edit, _leaveGroup, _addContact, _deleteContact;
FlatButton _mediaType;
IconedButton _search;
PlainShadow _sideShadow;
};