void ConnectionBox::showAll() { _autoRadio.show(); _httpProxyRadio.show(); _tcpProxyRadio.show(); _tryIPv6.show(); int32 h = st::boxTitleHeight + st::connectionSkip + _autoRadio.height() + st::connectionSkip + _httpProxyRadio.height() + st::connectionSkip + _tcpProxyRadio.height() + st::connectionSkip + st::lineWidth + st::connectionSkip + _tryIPv6.height() + st::connectionSkip; if (_httpProxyRadio.checked() || _tcpProxyRadio.checked()) { h += 2 * st::boxPadding.top() + 2 * _hostInput.height(); _hostInput.show(); _portInput.show(); _userInput.show(); _passwordInput.show(); } else { _hostInput.hide(); _portInput.hide(); _userInput.hide(); _passwordInput.hide(); } _saveButton.show(); _cancelButton.show(); setMaxHeight(h + _saveButton.height()); resizeEvent(0); }
StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::stickersScroll), _inner(set), _close(this, st::btnStickersClose), _addStickers(this, lng_stickers_add_pack(lt_count, 0), st::btnStickersAdd), _shareStickers(this, lang(lng_stickers_share_pack), st::btnStickersAdd), _closeStickers(this, lang(lng_close), st::btnStickersAdd) { resize(st::stickersWidth, height()); setMaxHeight(st::stickersMaxHeight); connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated())); init(&_inner, 0, st::boxFont->height + st::newGroupNamePadding.top() + st::newGroupNamePadding.bottom()); connect(&_close, SIGNAL(clicked()), this, SLOT(onClose())); connect(&_addStickers, SIGNAL(clicked()), this, SLOT(onAddStickers())); connect(&_shareStickers, SIGNAL(clicked()), this, SLOT(onShareStickers())); connect(&_closeStickers, SIGNAL(clicked()), this, SLOT(onClose())); connect(&_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons())); connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll())); connect(&_inner, SIGNAL(installed(uint64)), this, SIGNAL(installed(uint64))); onStickersUpdated(); onScroll(); prepare(); }
void TerrainProceduralDialog::opened() { setMapWidth(terrain->regionsX()*terrain->regionSize()); setMapDepth(terrain->regionsZ()*terrain->regionSize()); setHeightLimit(terrain->regionsY()*terrain->regionSize()); setMaxHeight(m_heightLimit); setMinHeight(0); m_imageProvider->setImage(QImage(m_mapWidth,m_mapDepth,QImage::Format_RGB888)); QFileInfo info; m_model->clear(); for(int i=0;i<terrain->materialCount();i++) { TerrainMaterial * material=terrain->getMaterial(i); if(material!=NULL && material->enabled()) { QStandardItem * item=new QStandardItem; info.setFile(material->texture_path.c_str()); if(material->name.empty()) item->setData(info.fileName(),TextRole); else item->setData(material->name.c_str(),TextRole); item->setData(material->id(),MaterialIdRole); m_model->appendRow(item); } } setWorking(false); emit modelChanged(); }
void AddContactBox::onImportDone(const MTPcontacts_ImportedContacts &res) { if (isHidden() || !App::main()) return; const MTPDcontacts_importedContacts &d(res.c_contacts_importedContacts()); App::feedUsers(d.vusers); const QVector<MTPImportedContact> &v(d.vimported.c_vector().v); int32 uid = 0; if (!v.isEmpty()) { const MTPDimportedContact &c(v.front().c_importedContact()); if (c.vclient_id.v != _contactId) return; uid = c.vuser_id.v; if (uid && !App::userLoaded(uid)) { uid = 0; } } if (uid) { App::main()->addNewContact(uid); App::wnd()->hideLayer(); } else { _addButton.hide(); _firstInput.hide(); _lastInput.hide(); _phoneInput.hide(); _retryButton.show(); int32 theight = st::boxTitleFont->m.boundingRect(0, 0, width() - st::boxPadding.left() - st::boxPadding.right(), 1, Qt::TextWordWrap, lng_contact_not_joined(lt_name, _sentName)).height(); int32 h = st::boxPadding.top() * 2 + theight + _retryButton.height() + st::boxPadding.bottom(); setMaxHeight(h); update(); } }
//! loads a font file from xml bool ScalableFont::load(io::IXMLReader* xml) { if (!SpriteBank) { Log::error("ScalableFont::load", "SpriteBank is NULL!!"); return false; } doReadXmlFile(xml); // set bad character WrongCharacter = getAreaIDFromCharacter(L' ', NULL); setMaxHeight(); for(wchar_t c='0'; c<='9'; c++) { SFontArea a = getAreaFromCharacter(c, NULL); if(a.overhang > m_max_digit_area.overhang ) m_max_digit_area.overhang = a.overhang; if(a.underhang > m_max_digit_area.underhang) m_max_digit_area.underhang = a.underhang; if(a.width > m_max_digit_area.width ) m_max_digit_area.width = a.width; } m_max_digit_area.overhang = 0;m_max_digit_area.underhang=0; return true; }
Simple3DTracker::Simple3DTracker(TouchDetector* touch, int lookupRadius, float weightedMatchingCoefficient, int templateWidth, int templateHeight, float maxHeightInCm) : _touch(touch), _template(0), _tmp(0), _tmp2(0), _lookupRadius(lookupRadius), _weightedMatchingCoefficient(weightedMatchingCoefficient), _maxHeight(0.0f) { // coeffs if(_weightedMatchingCoefficient < 0.0f) _weightedMatchingCoefficient = 0.0f; else if(_weightedMatchingCoefficient > 1.0f) _weightedMatchingCoefficient = 1.0f; // max height setMaxHeight(maxHeightInCm); // create new template image _template = new ofxCvGrayscaleImage; _template->allocate(templateWidth, templateHeight); cvZero(_template->getCvImage()); _template->flagImageChanged(); // matching images (float & grayscale) _tmp = new ofxCvGrayscaleImage; _tmp->allocate(_cameraImage()->width - _template->width + 1, _cameraImage()->height - _template->height + 1); _tmp2 = cvCreateImage( cvSize(_cameraImage()->width - _template->width + 1, _cameraImage()->height - _template->height + 1), IPL_DEPTH_32F, 1 ); // determine the 3d plane of the interactive surface BackgroundModel* bg = _touch->backgroundModel(); ofVec3f topleft = ofVec3f( bg->topleft3DVertex().x, bg->topleft3DVertex().y, bg->topleft3DVertex().z ); ofVec3f topright = ofVec3f( bg->topright3DVertex().x, bg->topright3DVertex().y, bg->topright3DVertex().z ); ofVec3f bottomright = ofVec3f( bg->bottomright3DVertex().x, bg->bottomright3DVertex().y, bg->bottomright3DVertex().z ); ofVec3f bottomleft = ofVec3f( bg->bottomleft3DVertex().x, bg->bottomleft3DVertex().y, bg->bottomleft3DVertex().z ); _plane = _computeBest3DPlane(topleft, topright, bottomright, bottomleft); }
ConvertToSupergroupBox::ConvertToSupergroupBox(ChatData *chat) : AbstractBox(st::boxWideWidth) , _chat(chat) , _text(100) , _note(100) , _convert(this, lang(lng_profile_convert_confirm), st::defaultBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) { QStringList text; text.push_back(lang(lng_profile_convert_feature1)); text.push_back(lang(lng_profile_convert_feature2)); text.push_back(lang(lng_profile_convert_feature3)); text.push_back(lang(lng_profile_convert_feature4)); textstyleSet(&st::boxTextStyle); _text.setText(st::boxTextFont, text.join('\n'), _confirmBoxTextOptions); _note.setText(st::boxTextFont, lng_profile_convert_warning(lt_bold_start, textcmdStartSemibold(), lt_bold_end, textcmdStopSemibold()), _confirmBoxTextOptions); _textWidth = st::boxWideWidth - st::boxPadding.left() - st::boxButtonPadding.right(); _textHeight = _text.countHeight(_textWidth); setMaxHeight(st::boxTitleHeight + _textHeight + st::boxPadding.bottom() + _note.countHeight(_textWidth) + st::boxButtonPadding.top() + _convert.height() + st::boxButtonPadding.bottom()); textstyleRestore(); connect(&_convert, SIGNAL(clicked()), this, SLOT(onConvert())); connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose())); prepare(); }
void Minimap::setMap(Map *map) { // Set the title for the Minimap std::string caption; if (map) caption = map->getName(); if (caption.empty()) caption = _("Map"); minimap->setCaption(caption); // Adapt the image if (mMapImage) { mMapImage->decRef(); mMapImage = 0; } if (map) { ResourceManager *resman = ResourceManager::getInstance(); mMapImage = resman->getImage(map->getProperty("minimap")); } if (mMapImage) { const int offsetX = 2 * getPadding(); const int offsetY = getTitleBarHeight() + getPadding(); const int titleWidth = getFont()->getWidth(getCaption()) + 15; const int mapWidth = mMapImage->getWidth() < 100 ? mMapImage->getWidth() + offsetX : 100; const int mapHeight = mMapImage->getHeight() < 100 ? mMapImage->getHeight() + offsetY : 100; setMinWidth(mapWidth > titleWidth ? mapWidth : titleWidth); setMinHeight(mapHeight); mWidthProportion = (float) mMapImage->getWidth() / map->getWidth(); mHeightProportion = (float) mMapImage->getHeight() / map->getHeight(); setMaxWidth(mMapImage->getWidth() > titleWidth ? mMapImage->getWidth() + offsetX : titleWidth); setMaxHeight(mMapImage->getHeight() + offsetY); setDefaultSize(getX(), getY(), getWidth(), getHeight()); resetToDefaultSize(); if (mShow) setVisible(true); } else { if (!isSticky()) setVisible(false); } }
//! load & prepare font from ITexture bool CGUIFont::loadTexture(video::IImage* image, const io::path& name) { if (!image || !SpriteBank) return false; s32 lowerRightPositions = 0; video::IImage* tmpImage=image; bool deleteTmpImage=false; switch(image->getColorFormat()) { case video::ECF_R5G6B5: tmpImage = Driver->createImage(video::ECF_A1R5G5B5,image->getDimension()); image->copyTo(tmpImage); deleteTmpImage=true; break; case video::ECF_A1R5G5B5: case video::ECF_A8R8G8B8: break; case video::ECF_R8G8B8: tmpImage = Driver->createImage(video::ECF_A8R8G8B8,image->getDimension()); image->copyTo(tmpImage); deleteTmpImage=true; break; default: os::Printer::log("Unknown texture format provided for CGUIFont::loadTexture", ELL_ERROR); return false; } readPositions(tmpImage, lowerRightPositions); WrongCharacter = getAreaFromCharacter(L' '); // output warnings if (!lowerRightPositions || !SpriteBank->getSprites().size()) os::Printer::log("Either no upper or lower corner pixels in the font file. If this font was made using the new font tool, please load the XML file instead. If not, the font may be corrupted.", ELL_ERROR); else if (lowerRightPositions != (s32)SpriteBank->getPositions().size()) os::Printer::log("The amount of upper corner pixels and the lower corner pixels is not equal, font file may be corrupted.", ELL_ERROR); bool ret = ( !SpriteBank->getSprites().empty() && lowerRightPositions ); if ( ret ) { bool flags[3]; pushTextureCreationFlags(flags); SpriteBank->addTexture(Driver->addTexture(name, tmpImage)); popTextureCreationFlags(flags); } if (deleteTmpImage) tmpImage->drop(); image->drop(); setMaxHeight(); return ret; }
void ConfirmBox::onTextUpdated() { textstyleSet(&st::boxTextStyle); _textWidth = st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right(); _textHeight = qMin(_text.countHeight(_textWidth), 16 * int(st::boxTextStyle.lineHeight)); setMaxHeight(st::boxPadding.top() + _textHeight + st::boxPadding.bottom() + st::boxButtonPadding.top() + _confirm.height() + st::boxButtonPadding.bottom()); textstyleRestore(); setMouseTracking(_text.hasLinks()); }
void PasscodeBox::init() { setBlueTitle(true); textstyleSet(&st::usernameTextStyle); _about.setRichText(st::normalFont, lang(_cloudPwd ? lng_cloud_password_about : lng_passcode_about)); _aboutHeight = _about.countHeight(st::boxWidth - st::boxPadding.left() * 1.5); textstyleRestore(); if (_turningOff) { _oldPasscode.show(); _boxTitle = lang(_cloudPwd ? lng_cloud_password_remove : lng_passcode_remove); setMaxHeight(st::boxTitleHeight + st::passcodePadding.top() + _oldPasscode.height() + st::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0) + _aboutHeight + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom()); } else { bool has = _cloudPwd ? (!_curSalt.isEmpty()) : cHasPasscode(); if (has) { _oldPasscode.show(); _boxTitle = lang(_cloudPwd ? lng_cloud_password_change : lng_passcode_change); setMaxHeight(st::boxTitleHeight + st::passcodePadding.top() + _oldPasscode.height() + st::passcodeSkip + ((_hasRecovery && !_hintText.isEmpty()) ? st::passcodeSkip : 0) + _newPasscode.height() + st::contactSkip + _reenterPasscode.height() + st::passcodeSkip + (_cloudPwd ? _passwordHint.height() + st::contactSkip : 0) + _aboutHeight + st::passcodePadding.bottom() + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom()); } else { _oldPasscode.hide(); _boxTitle = lang(_cloudPwd ? lng_cloud_password_create : lng_passcode_create); setMaxHeight(st::boxTitleHeight + st::passcodePadding.top() + _newPasscode.height() + st::contactSkip + _reenterPasscode.height() + st::passcodeSkip + (_cloudPwd ? _passwordHint.height() + st::contactSkip : 0) + _aboutHeight + (_cloudPwd ? st::contactSkip + _recoverEmail.height() + st::passcodeSkip : st::passcodePadding.bottom()) + st::boxButtonPadding.top() + _saveButton.height() + st::boxButtonPadding.bottom()); } } connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSave())); connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose())); connect(&_oldPasscode, SIGNAL(changed()), this, SLOT(onOldChanged())); connect(&_newPasscode, SIGNAL(changed()), this, SLOT(onNewChanged())); connect(&_reenterPasscode, SIGNAL(changed()), this, SLOT(onNewChanged())); connect(&_passwordHint, SIGNAL(changed()), this, SLOT(onNewChanged())); connect(&_recoverEmail, SIGNAL(changed()), this, SLOT(onEmailChanged())); connect(&_oldPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(&_newPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(&_reenterPasscode, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(&_passwordHint, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(&_recoverEmail, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(&_recover, SIGNAL(clicked()), this, SLOT(onRecoverByEmail())); }
MibitDialog::MibitDialog( QWidget *parent, const QString &msg, const QString &file, const QPixmap &icon, AnimationType animation ) : QSvgWidget( parent ) { if (file != 0) setSVG(file); m_parent = parent; animType = animation; setMinimumHeight(100); setFixedSize(0,0); //until show we grow it setMaxHeight(maxH); //default sizes setMaxWidth(maxW); animRate = 500; //default animation speed (half second rate). shakeTimeToLive = 0; par = false; parTimes = 0; img = new QLabel(); hLayout = new QHBoxLayout(); vLayout = new QVBoxLayout(); text = new QLabel(msg); btnClose = new QPushButton("Close"); ///TODO: what about translations??? shakeTimer = new QTimer(this); shakeTimer->setInterval(20); img->setPixmap(icon); img->setMaximumHeight(54); //the icon size is hardcoded now. img->setMaximumWidth(54); img->setAlignment(Qt::AlignLeft); img->setMargin(4); btnClose->setMaximumWidth(120); setLayout(vLayout); text->setWordWrap(true); text->setAlignment(Qt::AlignJustify|Qt::AlignVCenter); text->setMargin(5); hLayout->addWidget(img,0,Qt::AlignCenter); hLayout->addWidget(text,1,Qt::AlignCenter); vLayout->addLayout(hLayout,2); vLayout->addWidget(btnClose,1,Qt::AlignCenter); timeLine = new QTimeLine(animRate, this); wTimeLine = new QTimeLine(2000, this); wTimeLine->setFrameRange(90,190); wTimeLine->setCurveShape(QTimeLine::CosineCurve); connect(timeLine, SIGNAL(frameChanged(int)), this, SLOT(animate(int))); connect(wTimeLine, SIGNAL(frameChanged(int)), this, SLOT(waveIt(int))); connect(btnClose,SIGNAL(clicked()),this, SLOT(hideDialog())); connect(timeLine,SIGNAL(finished()), this, SLOT(onAnimationFinished())); connect(shakeTimer,SIGNAL(timeout()), this, SLOT(shakeIt())); }
ofxLiteGroup::ofxLiteGroup(string name) : ofxLiteBox(name){ setSpacing(); setMaxHeight(); setHoverable(false); setDraggable(false); setSelectable(false); setTriggerable(false); setSortable(false, false); singleSelected = NULL; setSingleSelect(false); dragBox = NULL; }
void AddContactBox::initBox() { if (_peer) { if (_peer->chat) { _boxTitle = lang(lng_edit_group_title); setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 1 * _firstInput.height() + st::addContactPadding.bottom() + _addButton.height()); } else { _boxTitle = lang(_peer == App::self() ? lng_edit_self_title : lng_edit_contact_title); setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 2 * _firstInput.height() + 1 * st::addContactDelta + st::addContactPadding.bottom() + _addButton.height()); } } else { bool readyToAdd = !_phoneInput.text().isEmpty() && (!_firstInput.text().isEmpty() || !_lastInput.text().isEmpty()); _boxTitle = lang(readyToAdd ? lng_confirm_contact_data : lng_enter_contact_data); setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 3 * _firstInput.height() + 2 * st::addContactDelta + st::addContactPadding.bottom() + _addButton.height()); } _retryButton.hide(); connect(&_addButton, SIGNAL(clicked()), this, SLOT(onSend())); connect(&_retryButton, SIGNAL(clicked()), this, SLOT(onRetry())); connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose())); prepare(); }
void LocalStorageBox::updateControls() { int rowsHeight = 0; if (_imagesCount > 0 && _audiosCount > 0) { rowsHeight = 2 * (st::linkFont->height + st::localStorageBoxSkip); } else { rowsHeight = st::linkFont->height + st::localStorageBoxSkip; } _clear->setVisible(_imagesCount > 0 || _audiosCount > 0); setMaxHeight(st::boxTitleHeight + st::localStorageBoxSkip + rowsHeight + _clear->height() + st::boxButtonPadding.top() + _close->height() + st::boxButtonPadding.bottom()); _clear->moveToLeft(st::boxPadding.left(), st::boxTitleHeight + st::localStorageBoxSkip + rowsHeight); _close->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _close->height()); update(); }
Marker3DTracker::Marker3DTracker(CalibratedKinect* kinect, BackgroundModel* bgmodel, ImageLabeler* labeler, int theLookupRadius, float maxHeightInCm) : _kinect(kinect), _bgmodel(bgmodel), _labeler(labeler), _lookupRadius(theLookupRadius), _maxHeight(0.0f), _isTracking(false) { // max height!! setMaxHeight(maxHeightInCm); // determine the 3d plane of the interactive surface ofVec3f topleft = ofVec3f( bgmodel->topleft3DVertex().x, bgmodel->topleft3DVertex().y, bgmodel->topleft3DVertex().z ); ofVec3f topright = ofVec3f( bgmodel->topright3DVertex().x, bgmodel->topright3DVertex().y, bgmodel->topright3DVertex().z ); ofVec3f bottomright = ofVec3f( bgmodel->bottomright3DVertex().x, bgmodel->bottomright3DVertex().y, bgmodel->bottomright3DVertex().z ); ofVec3f bottomleft = ofVec3f( bgmodel->bottomleft3DVertex().x, bgmodel->bottomleft3DVertex().y, bgmodel->bottomleft3DVertex().z ); _plane = _computeBest3DPlane(topleft, topright, bottomright, bottomleft); }
PinMessageBox::PinMessageBox(ChannelData *channel, MsgId msgId) : AbstractBox(st::boxWidth) , _channel(channel) , _msgId(msgId) , _text(this, lang(lng_pinned_pin_sure), FlatLabel::InitType::Simple, st::boxLabel) , _notify(this, lang(lng_pinned_notify), true, st::defaultBoxCheckbox) , _pin(this, lang(lng_pinned_pin), st::defaultBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) { _text.resizeToWidth(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()); setMaxHeight(st::boxPadding.top() + _text.height() + st::boxMediumSkip + _notify.height() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _pin.height() + st::boxButtonPadding.bottom()); connect(&_pin, SIGNAL(clicked()), this, SLOT(onPin())); connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose())); }
void RedBuilding::configure() { setAxiom("{BSFER}"); //addRule('E', "FE"); // Next normal floor addRule('E', "LFE"); // Ledge, then floor //addRule('E', "R-FE"); // Setbacks setInitialDirection(Vector(0,0,1)); Random generator; setMaxHeight(generator.generateInteger(20, 30) * 2.5 * OgreCity::meter); setupTextures(); }
AboutBox::AboutBox() : AbstractBox(st::aboutWidth) , _version(this, lng_about_version(lt_version, QString::fromWCharArray(AppVersionStr) + (cDevVersion() ? " dev" : "") + (cBetaVersion() ? qsl(" beta %1").arg(cBetaVersion()) : QString())), st::aboutVersionLink) , _text1(this, lang(lng_about_text_1), st::aboutLabel, st::aboutTextStyle) , _text2(this, lang(lng_about_text_2), st::aboutLabel, st::aboutTextStyle) , _text3(this, QString(), st::aboutLabel, st::aboutTextStyle) , _done(this, lang(lng_close), st::defaultBoxButton) { _text3.setRichText(lng_about_text_3(lt_faq_open, qsl("[a href=\"%1\"]").arg(telegramFaqLink()), lt_faq_close, qsl("[/a]"))); setMaxHeight(st::boxTitleHeight + st::aboutTextTop + _text1.height() + st::aboutSkip + _text2.height() + st::aboutSkip + _text3.height() + st::boxButtonPadding.top() + _done.height() + st::boxButtonPadding.bottom()); connect(&_version, SIGNAL(clicked()), this, SLOT(onVersion())); connect(&_done, SIGNAL(clicked()), this, SLOT(onClose())); prepare(); }
MaxInviteBox::MaxInviteBox(const QString &link) : AbstractBox(st::boxWidth), _close(this, lang(lng_box_ok), st::defaultBoxButton), _text(st::boxTextFont, lng_participant_invite_sorry(lt_count, cMaxGroupCount()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()), _link(link), _linkOver(false), a_goodOpacity(0, 0), a_good(animFunc(this, &MaxInviteBox::goodAnimStep)) { setMouseTracking(true); _textWidth = st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right(); _textHeight = qMin(_text.countHeight(_textWidth), 16 * int(st::boxTextStyle.lineHeight)); setMaxHeight(st::boxPadding.top() + _textHeight + st::boxTextFont->height + st::boxTextFont->height * 2 + st::newGroupLinkPadding.bottom() + st::boxButtonPadding.top() + _close.height() + st::boxButtonPadding.bottom()); connect(&_close, SIGNAL(clicked()), this, SLOT(onClose())); prepare(); }
void AddContactBox::onRetry() { _addRequest = 0; _contactId = 0; _addButton.show(); _cancelButton.move(_cancelButton.x(), _addButton.y()); showAll(); _firstInput.setText(QString()); _firstInput.updatePlaceholder(); _lastInput.setText(QString()); _lastInput.updatePlaceholder(); _phoneInput.setText(QString()); _phoneInput.updatePlaceholder(); _phoneInput.setDisabled(false); _retryButton.hide(); _firstInput.setFocus(); setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 3 * _firstInput.height() + 2 * st::addContactDelta + st::addContactPadding.bottom() + _addButton.height()); update(); }
RichDeleteMessageBox::RichDeleteMessageBox(ChannelData *channel, UserData *from, MsgId msgId) : AbstractBox(st::boxWidth) , _channel(channel) , _from(from) , _msgId(msgId) , _text(this, lang(lng_selected_delete_sure_this), FlatLabel::InitType::Simple, st::boxLabel) , _banUser(this, lang(lng_ban_user), false, st::defaultBoxCheckbox) , _reportSpam(this, lang(lng_report_spam), false, st::defaultBoxCheckbox) , _deleteAll(this, lang(lng_delete_all_from), false, st::defaultBoxCheckbox) , _delete(this, lang(lng_box_delete), st::defaultBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) { t_assert(_channel != nullptr); _text.resizeToWidth(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()); setMaxHeight(st::boxPadding.top() + _text.height() + st::boxMediumSkip + _banUser.height() + st::boxLittleSkip + _reportSpam.height() + st::boxLittleSkip + _deleteAll.height() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _delete.height() + st::boxButtonPadding.bottom()); connect(&_delete, SIGNAL(clicked()), this, SLOT(onDelete())); connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose())); }
void ConfirmBox::init(const QString &text) { _text.setText(st::boxTextFont, text, _informative ? _confirmBoxTextOptions : _textPlainOptions); textstyleSet(&st::boxTextStyle); _textWidth = st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right(); _textHeight = qMin(_text.countHeight(_textWidth), 16 * int(st::boxTextStyle.lineHeight)); setMaxHeight(st::boxPadding.top() + _textHeight + st::boxPadding.bottom() + st::boxButtonPadding.top() + _confirm.height() + st::boxButtonPadding.bottom()); textstyleRestore(); connect(&_confirm, SIGNAL(clicked()), this, SIGNAL(confirmed())); connect(&_cancel, SIGNAL(clicked()), this, SLOT(onCancel())); if (_informative) { _cancel.hide(); connect(this, SIGNAL(confirmed()), this, SLOT(onCancel())); } setMouseTracking(_text.hasLinks()); prepare(); }
AutoDownloadBox::AutoDownloadBox() : AbstractBox(st::boxWidth) , _photoPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadPhoto() & dbiadNoPrivate), st::defaultBoxCheckbox) , _photoGroups(this, lang(lng_media_auto_groups), !(cAutoDownloadPhoto() & dbiadNoGroups), st::defaultBoxCheckbox) , _audioPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadAudio() & dbiadNoPrivate), st::defaultBoxCheckbox) , _audioGroups(this, lang(lng_media_auto_groups), !(cAutoDownloadAudio() & dbiadNoGroups), st::defaultBoxCheckbox) , _gifPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadGif() & dbiadNoPrivate), st::defaultBoxCheckbox) , _gifGroups(this, lang(lng_media_auto_groups), !(cAutoDownloadGif() & dbiadNoGroups), st::defaultBoxCheckbox) , _gifPlay(this, lang(lng_media_auto_play), cAutoPlayGif(), st::defaultBoxCheckbox) , _sectionHeight(st::boxTitleHeight + 2 * (st::defaultBoxCheckbox.height + st::setLittleSkip)) , _save(this, lang(lng_connection_save), st::defaultBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) { setMaxHeight(3 * _sectionHeight + st::setLittleSkip + _gifPlay.height() + st::setLittleSkip + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom()); connect(&_save, SIGNAL(clicked()), this, SLOT(onSave())); connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose())); prepare(); }
void DownloadPathBox::showAll() { _defaultRadio.show(); _tempRadio.show(); _dirRadio.show(); if (_dirRadio.checked()) { _dirInput.show(); } else { _dirInput.hide(); } _saveButton.show(); _cancelButton.show(); int32 h = st::old_boxTitleHeight + st::downloadSkip + _defaultRadio.height() + st::downloadSkip + _tempRadio.height() + st::downloadSkip + _dirRadio.height(); if (_dirRadio.checked()) h += st::boxPadding.top() + _dirInput.height(); h += st::downloadSkip + _saveButton.height(); setMaxHeight(h); }
void DownloadPathBox::showAll() { _default.show(); _temp.show(); _dir.show(); if (_dir.checked()) { _pathLink.show(); } else { _pathLink.hide(); } _save.show(); _cancel.show(); int32 h = st::boxTitleHeight + st::boxOptionListPadding.top() + _default.height() + st::boxOptionListPadding.top() + _temp.height() + st::boxOptionListPadding.top() + _dir.height(); if (_dir.checked()) h += st::downloadPathSkip + _pathLink.height(); h += st::boxOptionListPadding.bottom() + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom(); setMaxHeight(h); }
ShortcutWindow::ShortcutWindow(const std::string &title, ShortcutContainer *content) { setWindowName(title); // no title presented, title bar is padding so window can be moved. gcn::Window::setTitleBarHeight(gcn::Window::getPadding()); setShowTitle(false); setResizable(true); setDefaultVisible(false); setSaveVisible(true); setupWindow->registerWindowForReset(this); mItems = content; const int border = SCROLL_PADDING * 2 + getPadding() * 2; setMinWidth(mItems->getBoxWidth() + border); setMinHeight(mItems->getBoxHeight() + border); setMaxWidth(mItems->getBoxWidth() * mItems->getMaxItems() + border); setMaxHeight(mItems->getBoxHeight() * mItems->getMaxItems() + border); setDefaultSize(mItems->getBoxWidth() + border, mItems->getBoxHeight() * mItems->getMaxItems() + border, ImageRect::LOWER_RIGHT, mBoxesWidth, 0); mBoxesWidth += mItems->getBoxWidth() + border; mScrollArea = new ScrollArea(mItems); mScrollArea->setPosition(SCROLL_PADDING, SCROLL_PADDING); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mScrollArea->setOpaque(false); place(0, 0, mScrollArea, 5, 5).setPadding(0); Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); layout.setMargin(0); loadWindowState(); }
ISpinBox::ISpinBox(IWidget * parent) : IWidget (parent), m_timeLast (getElapsedTime()), m_timeRepeat (SpinBoxTimeBeforeRepeat), m_wrapping (true), m_prefix (), m_suffix (), m_line (nullptr), m_buttonUp (nullptr), m_buttonDown (nullptr) { m_line = new CLineEdit(this); T_ASSERT(m_line != nullptr); int minh = m_line->getMinHeight() / 2; int maxh = m_line->getMaxHeight(); // Boutons m_buttonUp = new CPushButton("+", this); T_ASSERT(m_buttonUp != nullptr); m_buttonUp->setX(m_line->getWidth()); m_buttonUp->setMinSize(SpinBoxButtonWidth, minh); m_buttonUp->setMaxSize(SpinBoxButtonWidth, maxh / 2); m_buttonUp->onClicked.connect(sigc::mem_fun(this, &ISpinBox::stepUp)); m_buttonDown = new CPushButton("-", this); T_ASSERT(m_buttonDown != nullptr); m_buttonDown->setPosition(m_line->getWidth() - 1, minh); m_buttonDown->setMinSize(SpinBoxButtonWidth, minh); m_buttonDown->setMaxSize(SpinBoxButtonWidth, maxh / 2); m_buttonDown->onClicked.connect(sigc::mem_fun(this, &ISpinBox::stepDown)); m_line->onTextChange.connect(sigc::mem_fun(this, &ISpinBox::updateValue)); setMaxHeight(maxh); }
void ConfirmBox::init(const QString &text) { _text.setText(st::boxFont, text, (_infoMsg ? _confirmBoxTextOptions : _textPlainOptions)); _textWidth = st::boxWidth - st::boxPadding.left() - st::boxPadding.right(); _textHeight = _text.countHeight(_textWidth); setMaxHeight(st::boxPadding.top() + _textHeight + st::boxPadding.bottom() + (_infoMsg ? _close.height() : _confirm.height())); if (_infoMsg) { _confirm.hide(); _cancel.hide(); connect(&_close, SIGNAL(clicked()), this, SLOT(onCancel())); setMouseTracking(_text.hasLinks()); } else { _close.hide(); connect(&_confirm, SIGNAL(clicked()), this, SIGNAL(confirmed())); connect(&_cancel, SIGNAL(clicked()), this, SLOT(onCancel())); } prepare(); }
ShortcutWindow::ShortcutWindow(ShortcutContainer *content): Window("", false, NULL, "graphics/gui/gui.xml", true) { // no title presented, title bar is padding so window can be moved. gcn::Window::setTitleBarHeight(gcn::Window::getPadding()); setWindowName(content->getShortcutHandler()->getPrefix()); setShowTitle(false); setResizable(true); mItems = content; const int border = SCROLL_PADDING * 2 + getPadding() * 2; setMinWidth(mItems->getBoxWidth() + border); setMinHeight(mItems->getBoxHeight() + border); setMaxWidth(mItems->getBoxWidth() * mItems->getMaxShortcuts() + border); setMaxHeight(mItems->getBoxHeight() * mItems->getMaxShortcuts() + border); setDefaultSize(mItems->getBoxWidth() + border, (mItems->getBoxHeight() * mItems->getMaxShortcuts()) + border, ImageRect::LOWER_RIGHT, -mInstances * (mItems->getBoxWidth() + 2 * getPadding()), 0); mInstances++; mScrollArea = new ScrollArea(mItems); mScrollArea->setPosition(SCROLL_PADDING, SCROLL_PADDING); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mScrollArea->setOpaque(false); place(0, 0, mScrollArea, 5, 5).setPadding(0); Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); layout.setMargin(0); loadWindowState(); }