CountrySelect::CountrySelect() : QWidget(App::wnd()), _result("none"), _filter(this, st::inpCountry, lang(lng_country_ph)), _scroll(this, st::scrollCountries), _list(&_scroll), _doneButton(this, lang(lng_country_done), st::btnSelectDone), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), _innerLeft(0), _innerTop(0), _innerWidth(0), _innerHeight(0), a_alpha(0), a_bgAlpha(0), a_coord(st::countriesSlideShift), _shadow(st::boxShadow) { setGeometry(App::wnd()->rect()); App::wnd()->topWidget(this); connect(App::wnd(), SIGNAL(resized(const QSize &)), this, SLOT(onParentResize(const QSize &))); connect(&_doneButton, SIGNAL(clicked()), this, SLOT(onCountryChoose())); connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onCountryCancel())); connect(&_scroll, SIGNAL(scrollFinished()), this, SLOT(onScrollFinished())); connect(&_scroll, SIGNAL(geometryChanged()), &_list, SLOT(onParentGeometryChanged())); connect(&_scroll, SIGNAL(scrolled()), &_list, SLOT(onUpdateSelected())); connect(&_list, SIGNAL(countrySelected()), this, SLOT(onCountryChoose())); connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate())); connect(&_list, SIGNAL(mustScrollTo(int, int)), &_scroll, SLOT(scrollToY(int, int))); show(); setFocus(); _scroll.setWidget(&_list); _scroll.setFocusPolicy(Qt::NoFocus); prepareAnimation(0); }
ContactsBox::ContactsBox() : _scroll(this, st::newGroupScroll), _inner(), _addContact(this, lang(lng_add_contact_button), st::contactsAdd), _filter(this, st::contactsFilter, lang(lng_participant_filter)), _close(this, lang(lng_contacts_done), st::contactsClose), _hiding(false), a_opacity(0, 1) { _width = st::participantWidth; _height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom(); if (_height > st::participantMaxHeight) _height = st::participantMaxHeight; resize(_width, _height); _scroll.setWidget(&_inner); _scroll.setFocusPolicy(Qt::NoFocus); connect(&_addContact, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact())); connect(&_close, SIGNAL(clicked()), this, SLOT(onClose())); connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel())); connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll())); connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate())); connect(&_filter, SIGNAL(cancelled()), this, SLOT(onClose())); connect(&_inner, SIGNAL(mustScrollTo(int,int)), &_scroll, SLOT(scrollToY(int,int))); showAll(); _cache = myGrab(this, rect()); hideAll(); }
AddParticipantBox::AddParticipantBox(ChatData *chat) : _scroll(this, st::newGroupScroll), _inner(chat), _filter(this, st::contactsFilter, lang(lng_participant_filter)), _invite(this, lang(lng_participant_invite), st::btnSelectDone), _cancel(this, lang(lng_cancel), st::btnSelectCancel), _hiding(false), a_opacity(0, 1), af_opacity(anim::linear) { _width = st::participantWidth; _height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom(); if (_height > st::participantMaxHeight) _height = st::participantMaxHeight; resize(_width, _height); _scroll.setWidget(&_inner); _scroll.setFocusPolicy(Qt::NoFocus); connect(&_invite, SIGNAL(clicked()), this, SLOT(onInvite())); connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(closed())); connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel())); connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll())); connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate())); connect(&_filter, SIGNAL(cancelled()), this, SIGNAL(onClose())); connect(&_inner, SIGNAL(mustScrollTo(int,int)), &_scroll, SLOT(scrollToY(int,int))); connect(&_inner, SIGNAL(selectAllQuery()), &_filter, SLOT(selectAll())); showAll(); _cache = myGrab(this, rect()); hideAll(); }
CountrySelectBox::CountrySelectBox() : ItemListBox(st::countriesScroll, st::boxWidth) , _inner() , _filter(this, st::boxSearchField, lang(lng_country_ph)) , _filterCancel(this, st::boxSearchCancel) , _topShadow(this) { ItemListBox::init(&_inner, st::boxScrollSkip, st::boxTitleHeight + _filter.height()); connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate())); connect(&_filter, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(&_filterCancel, SIGNAL(clicked()), this, SLOT(onFilterCancel())); connect(&_inner, SIGNAL(mustScrollTo(int, int)), &_scroll, SLOT(scrollToY(int, int))); connect(&_inner, SIGNAL(countryChosen(const QString&)), this, SIGNAL(countryChosen(const QString&))); _filterCancel.setAttribute(Qt::WA_OpaquePaintEvent); prepare(); }