void DownloadPathBox::onEditPath() { filedialogInit(); QString path, lastPath = cDialogLastPath(); if (!cDownloadPath().isEmpty() && cDownloadPath() != qstr("tmp")) { cSetDialogLastPath(cDownloadPath().left(cDownloadPath().size() - (cDownloadPath().endsWith('/') ? 1 : 0))); } if (filedialogGetDir(path, lang(lng_download_path_choose))) { if (!path.isEmpty()) { _path = path + '/'; _pathBookmark = psDownloadPathBookmark(_path); setPathText(QDir::toNativeSeparators(_path)); } } cSetDialogLastPath(lastPath); }
void DownloadPathBox::onEditPath() { _dirInput.clearFocus(); filedialogInit(); QString path, lastPath = cDialogLastPath(); if (!cDownloadPath().isEmpty()) cSetDialogLastPath(cDownloadPath()); if (filedialogGetDir(path, lang(lng_download_path_choose))) { if (!path.isEmpty()) { _path = path + '/'; _dirInput.setText(QDir::toNativeSeparators(_path)); _dirInput.setCursorPosition(0); } } cSetDialogLastPath(lastPath); }
DownloadPathBox::DownloadPathBox() : _path(cDownloadPath()), _defaultRadio(this, qsl("dir_type"), 0, lang(lng_download_path_default_radio), _path.isEmpty()), _tempRadio(this, qsl("dir_type"), 1, lang(lng_download_path_temp_radio), _path == qsl("tmp")), _dirRadio(this, qsl("dir_type"), 2, lang(lng_download_path_dir_radio), !_path.isEmpty() && _path != qsl("tmp")), _dirInput(this, st::inpDownloadDir, QString(), (_path.isEmpty() || _path == qsl("tmp")) ? QString() : QDir::toNativeSeparators(_path)), _saveButton(this, lang(lng_connection_save), st::btnSelectDone), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel) { connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSave())); connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose())); connect(&_defaultRadio, SIGNAL(changed()), this, SLOT(onChange())); connect(&_tempRadio, SIGNAL(changed()), this, SLOT(onChange())); connect(&_dirRadio, SIGNAL(changed()), this, SLOT(onChange())); connect(&_dirInput, SIGNAL(focused()), this, SLOT(onEditPath())); _dirInput.setCursorPosition(0); prepare(); }
DownloadPathBox::DownloadPathBox() : AbstractBox() , _path(cDownloadPath()) , _pathBookmark(cDownloadPathBookmark()) , _default(this, qsl("dir_type"), 0, lang(lng_download_path_default_radio), _path.isEmpty()) , _temp(this, qsl("dir_type"), 1, lang(lng_download_path_temp_radio), _path == qsl("tmp")) , _dir(this, qsl("dir_type"), 2, lang(lng_download_path_dir_radio), !_path.isEmpty() && _path != qsl("tmp")) , _pathLink(this, QString(), st::defaultBoxLinkButton) , _save(this, lang(lng_connection_save), st::defaultBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) { connect(&_save, SIGNAL(clicked()), this, SLOT(onSave())); connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose())); connect(&_default, SIGNAL(changed()), this, SLOT(onChange())); connect(&_temp, SIGNAL(changed()), this, SLOT(onChange())); connect(&_dir, SIGNAL(changed()), this, SLOT(onChange())); connect(&_pathLink, SIGNAL(clicked()), this, SLOT(onEditPath())); if (!_path.isEmpty() && _path != qsl("tmp")) { setPathText(QDir::toNativeSeparators(_path)); } prepare(); }
DownloadPathBox::DownloadPathBox() : _hiding(false), _path(cDownloadPath()), _tempRadio(this, qsl("dir_type"), 0, lang(lng_download_path_temp_radio), _path.isEmpty()), _dirRadio(this, qsl("dir_type"), 1, lang(lng_download_path_dir_radio), !_path.isEmpty()), _dirInput(this, st::inpDownloadDir, QString(), QDir::toNativeSeparators(_path)), _saveButton(this, lang(lng_connection_save), st::btnSelectDone), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), a_opacity(0, 1) { _width = st::addContactWidth; connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSave())); connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onCancel())); connect(&_tempRadio, SIGNAL(changed()), this, SLOT(onChange())); connect(&_dirRadio, SIGNAL(changed()), this, SLOT(onChange())); connect(&_dirInput, SIGNAL(focused()), this, SLOT(onEditPath())); _dirInput.setCursorPosition(0); showAll(); _cache = grab(rect()); hideAll(); }
void SettingsInner::onDownloadPathEdited() { _downloadPathEdit.setText(cDownloadPath().isEmpty() ? lang(lng_download_path_temp) : st::linkFont->m.elidedText(QDir::toNativeSeparators(cDownloadPath()), Qt::ElideRight, st::setWidth - st::setVersionLeft - _downloadPathWidth)); showAll(); }
SettingsInner::SettingsInner(Settings *parent) : QWidget(parent), _self(App::self()), // profile _nameCache(_self ? _self->name : QString()), _phoneText(_self ? App::formatPhone(_self->phone) : QString()), _uploadPhoto(this, lang(lng_settings_upload), st::btnSetUpload), _cancelPhoto(this, lang(lng_cancel)), _nameOver(false), _photoOver(false), a_photo(0), // notifications _desktopNotify(this, lang(lng_settings_desktop_notify), cDesktopNotify()), _soundNotify(this, lang(lng_settings_sound_notify), cSoundNotify()), // general _autoUpdate(this, lang(lng_settings_auto_update), cAutoUpdate()), _checkNow(this, lang(lng_settings_check_now)), _restartNow(this, lang(lng_settings_update_now)), _workmodeTray(this, lang(lng_settings_workmode_tray), (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray)), _workmodeWindow(this, lang(lng_settings_workmode_window), (cWorkMode() == dbiwmWindowOnly || cWorkMode() == dbiwmWindowAndTray)), _autoStart(this, lang(lng_settings_auto_start), cAutoStart()), _startMinimized(this, lang(lng_settings_start_min), cStartMinimized()), _dpiAutoScale(this, lang(lng_settings_scale_auto).replace(qsl("{cur}"), scaleLabel(cScreenScale())), (cConfigScale() == dbisAuto)), _dpiSlider(this, st::dpiSlider, dbisScaleCount - 1, cEvalScale(cConfigScale()) - 1), _dpiWidth1(st::dpiFont1->m.width(scaleLabel(dbisOne))), _dpiWidth2(st::dpiFont2->m.width(scaleLabel(dbisOneAndQuarter))), _dpiWidth3(st::dpiFont3->m.width(scaleLabel(dbisOneAndHalf))), _dpiWidth4(st::dpiFont4->m.width(scaleLabel(dbisTwo))), // chat options _replaceEmojis(this, lang(lng_settings_replace_emojis), cReplaceEmojis()), _viewEmojis(this, lang(lng_settings_view_emojis)), _enterSend(this, qsl("send_key"), 0, lang(lng_settings_send_enter), !cCtrlEnter()), _ctrlEnterSend(this, qsl("send_key"), 1, lang((cPlatform() == dbipMac) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), cCtrlEnter()), _dontAskDownloadPath(this, lang(lng_download_path_dont_ask), !cAskDownloadPath()), _downloadPathWidth(st::linkFont->m.width(lang(lng_download_path_label))), _downloadPathEdit(this, cDownloadPath().isEmpty() ? lang(lng_download_path_temp) : st::linkFont->m.elidedText(QDir::toNativeSeparators(cDownloadPath()), Qt::ElideRight, st::setWidth - st::setVersionLeft - _downloadPathWidth)), _downloadPathClear(this, lang(lng_download_path_clear)), _tempDirClearingWidth(st::linkFont->m.width(lang(lng_download_path_clearing))), _tempDirClearedWidth(st::linkFont->m.width(lang(lng_download_path_cleared))), _tempDirClearFailedWidth(st::linkFont->m.width(lang(lng_download_path_clear_failed))), _catsAndDogs(this, lang(lng_settings_cats_and_dogs), cCatsAndDogs()), _scrollNotActive(this, lang(lng_settings_scroll_not_active), cScrollNotActive()), // advanced _connectionType(this, lang(lng_connection_auto)), _resetSessions(this, lang(lng_settings_reset)), _logOut(this, lang(lng_settings_logout), st::btnLogout), _resetDone(false) { if (_self) { _nameText.setText(st::setNameFont, _nameCache, _textNameOptions); PhotoData *selfPhoto = _self->photoId ? App::photo(_self->photoId) : 0; if (selfPhoto && selfPhoto->date) _photoLink = TextLinkPtr(new PhotoLink(selfPhoto)); MTP::send(MTPusers_GetFullUser(_self->inputUser), rpcDone(&SettingsInner::gotFullSelf)); connect(App::main(), SIGNAL(peerPhotoChanged(PeerData *)), this, SLOT(peerUpdated(PeerData *))); connect(App::main(), SIGNAL(peerNameChanged(PeerData *, const PeerData::Names &, const PeerData::NameFirstChars &)), this, SLOT(peerUpdated(PeerData *))); } // profile connect(&_uploadPhoto, SIGNAL(clicked()), this, SLOT(onUpdatePhoto())); connect(&_cancelPhoto, SIGNAL(clicked()), this, SLOT(onUpdatePhotoCancel())); connect(App::app(), SIGNAL(peerPhotoDone(PeerId)), this, SLOT(onPhotoUpdateDone(PeerId))); connect(App::app(), SIGNAL(peerPhotoFail(PeerId)), this, SLOT(onPhotoUpdateFail(PeerId))); // notifications connect(&_desktopNotify, SIGNAL(changed()), this, SLOT(onDesktopNotify())); connect(&_soundNotify, SIGNAL(changed()), this, SLOT(onSoundNotify())); // general connect(&_autoUpdate, SIGNAL(changed()), this, SLOT(onAutoUpdate())); connect(&_checkNow, SIGNAL(clicked()), this, SLOT(onCheckNow())); connect(&_restartNow, SIGNAL(clicked()), this, SLOT(onRestartNow())); connect(&_workmodeTray, SIGNAL(changed()), this, SLOT(onWorkmodeTray())); connect(&_workmodeWindow, SIGNAL(changed()), this, SLOT(onWorkmodeWindow())); _startMinimized.setDisabled(!_autoStart.checked()); connect(&_autoStart, SIGNAL(changed()), this, SLOT(onAutoStart())); connect(&_startMinimized, SIGNAL(changed()), this, SLOT(onStartMinimized())); connect(&_dpiAutoScale, SIGNAL(changed()), this, SLOT(onScaleAuto())); connect(&_dpiSlider, SIGNAL(changed(int32)), this, SLOT(onScaleChange())); _curVersionText = lang(lng_settings_current_version).replace(qsl("{version}"), QString::fromWCharArray(AppVersionStr)) + ' '; _curVersionWidth = st::linkFont->m.width(_curVersionText); _newVersionText = lang(lng_settings_update_ready) + ' '; _newVersionWidth = st::linkFont->m.width(_newVersionText); connect(App::app(), SIGNAL(updateChecking()), this, SLOT(onUpdateChecking())); connect(App::app(), SIGNAL(updateLatest()), this, SLOT(onUpdateLatest())); connect(App::app(), SIGNAL(updateDownloading(qint64,qint64)), this, SLOT(onUpdateDownloading(qint64,qint64))); connect(App::app(), SIGNAL(updateReady()), this, SLOT(onUpdateReady())); connect(App::app(), SIGNAL(updateFailed()), this, SLOT(onUpdateFailed())); // chat options connect(&_replaceEmojis, SIGNAL(changed()), this, SLOT(onReplaceEmojis())); connect(&_viewEmojis, SIGNAL(clicked()), this, SLOT(onViewEmojis())); connect(&_enterSend, SIGNAL(changed()), this, SLOT(onEnterSend())); connect(&_ctrlEnterSend, SIGNAL(changed()), this, SLOT(onCtrlEnterSend())); connect(&_dontAskDownloadPath, SIGNAL(changed()), this, SLOT(onDontAskDownloadPath())); connect(&_downloadPathEdit, SIGNAL(clicked()), this, SLOT(onDownloadPathEdit())); connect(&_downloadPathClear, SIGNAL(clicked()), this, SLOT(onDownloadPathClear())); switch (App::wnd()->tempDirState()) { case Window::TempDirEmpty: _tempDirClearState = TempDirEmpty; break; case Window::TempDirExists: _tempDirClearState = TempDirExists; break; case Window::TempDirRemoving: _tempDirClearState = TempDirClearing; break; } connect(App::wnd(), SIGNAL(tempDirCleared()), this, SLOT(onTempDirCleared())); connect(App::wnd(), SIGNAL(tempDirClearFailed()), this, SLOT(onTempDirClearFailed())); connect(&_catsAndDogs, SIGNAL(changed()), this, SLOT(onCatsAndDogs())); connect(&_scrollNotActive, SIGNAL(changed()), this, SLOT(onScrollNotActive())); // advanced connect(&_connectionType, SIGNAL(clicked()), this, SLOT(onConnectionType())); connect(&_resetSessions, SIGNAL(clicked()), this, SLOT(onResetSessions())); connect(&_logOut, SIGNAL(clicked()), this, SLOT(onLogout())); _connectionTypeText = lang(lng_connection_type) + ' '; _connectionTypeWidth = st::linkFont->m.width(_connectionTypeText); if (App::main()) { connect(App::main(), SIGNAL(peerUpdated(PeerData*)), this, SLOT(peerUpdated(PeerData*))); } updateOnlineDisplay(); switch (App::app()->updatingState()) { case Application::UpdatingDownload: setUpdatingState(UpdatingDownload, true); setDownloadProgress(App::app()->updatingReady(), App::app()->updatingSize()); break; case Application::UpdatingReady: setUpdatingState(UpdatingReady, true); break; default: setUpdatingState(UpdatingNone, true); break; } updateConnectionType(); setMouseTracking(true); }
void SettingsInner::showAll() { // profile if (_self) { if (App::app()->isPhotoUpdating(_self->id)) { _cancelPhoto.show(); _uploadPhoto.hide(); } else { _cancelPhoto.hide(); _uploadPhoto.show(); } } else { _uploadPhoto.hide(); _cancelPhoto.hide(); } // notifications if (_self) { _desktopNotify.show(); _soundNotify.show(); } else { _desktopNotify.hide(); _soundNotify.hide(); } // general _autoUpdate.show(); setUpdatingState(_updatingState, true); if (cPlatform() == dbipWindows) { _workmodeTray.show(); _workmodeWindow.show(); _autoStart.show(); _startMinimized.show(); } else { _workmodeTray.hide(); _workmodeWindow.hide(); _autoStart.hide(); _startMinimized.hide(); } if (cRetina()) { _dpiSlider.hide(); _dpiAutoScale.hide(); } else { _dpiSlider.show(); _dpiAutoScale.show(); } // chat options if (_self) { _replaceEmojis.show(); if (cReplaceEmojis()) { _viewEmojis.show(); } else { _viewEmojis.hide(); } _enterSend.show(); _ctrlEnterSend.show(); _catsAndDogs.show(); _scrollNotActive.show(); _dontAskDownloadPath.show(); if (cAskDownloadPath()) { _downloadPathEdit.hide(); _downloadPathClear.hide(); } else { _downloadPathEdit.show(); if (cDownloadPath().isEmpty() && _tempDirClearState == TempDirExists) { // dir exists, not clearing right now _downloadPathClear.show(); } else { _downloadPathClear.hide(); } } } else { _replaceEmojis.hide(); _viewEmojis.hide(); _enterSend.hide(); _ctrlEnterSend.hide(); _catsAndDogs.hide(); _scrollNotActive.hide(); _dontAskDownloadPath.hide(); _downloadPathEdit.hide(); _downloadPathClear.hide(); } // advanced if (_self) { if (_resetDone) { _resetSessions.hide(); } else { _resetSessions.show(); } _logOut.show(); } else { _resetSessions.hide(); _logOut.hide(); } }
void SettingsInner::resizeEvent(QResizeEvent *e) { _left = (width() - st::setWidth) / 2; int32 top = 0; if (_self) { // profile top += st::setTop; top += st::setPhotoSize; _uploadPhoto.move(_left + st::setWidth - _uploadPhoto.width(), top - _uploadPhoto.height()); _cancelPhoto.move(_left + st::setWidth - _cancelPhoto.width(), top - _uploadPhoto.height() + st::btnSetUpload.textTop + st::btnSetUpload.font->ascent - st::linkFont->ascent); // notifications top += st::setHeaderSkip; _desktopNotify.move(_left, top); top += _desktopNotify.height() + st::setLittleSkip; _soundNotify.move(_left, top); top += _soundNotify.height(); } // general top += st::setHeaderSkip; _autoUpdate.move(_left, top); _checkNow.move(_left + st::setWidth - _checkNow.width(), top + st::cbDefFlat.textTop); top += _autoUpdate.height(); _restartNow.move(_left + st::setWidth - _restartNow.width(), top + st::setVersionTop); top += st::setVersionHeight; if (cPlatform() == dbipWindows) { _workmodeTray.move(_left, top); top += _workmodeTray.height() + st::setLittleSkip; _workmodeWindow.move(_left, top); top += _workmodeWindow.height() + st::setSectionSkip; _autoStart.move(_left, top); top += _autoStart.height() + st::setLittleSkip; _startMinimized.move(_left, top); top += _startMinimized.height(); } if (!cRetina()) { top += st::setHeaderSkip; _dpiAutoScale.move(_left, top); top += _dpiAutoScale.height() + st::setLittleSkip; _dpiSlider.move(_left, top); top += _dpiSlider.height() + st::dpiFont4->height; } // chat options if (_self) { top += st::setHeaderSkip; _viewEmojis.move(_left + st::setWidth - _viewEmojis.width(), top + st::cbDefFlat.textTop); _replaceEmojis.move(_left, top); top += _replaceEmojis.height() + st::setSectionSkip; _enterSend.move(_left, top); top += _enterSend.height() + st::setLittleSkip; _ctrlEnterSend.move(_left, top); top += _ctrlEnterSend.height() + st::setSectionSkip; _dontAskDownloadPath.move(_left, top); top += _dontAskDownloadPath.height(); if (!cAskDownloadPath()) { top += st::setLittleSkip; _downloadPathEdit.move(_left + st::setVersionLeft + _downloadPathWidth, top); if (cDownloadPath().isEmpty()) { _downloadPathClear.move(_left + st::setWidth - _downloadPathClear.width(), top); } top += _downloadPathEdit.height(); } top += st::setSectionSkip; _catsAndDogs.move(_left, top); top += _catsAndDogs.height() + st::setLittleSkip; _scrollNotActive.move(_left, top); top += _scrollNotActive.height(); } // advanced top += st::setHeaderSkip; _connectionType.move(_left + st::setHeaderLeft + _connectionTypeWidth, top); top += _connectionType.height() + st::setLittleSkip; if (_self) { _resetSessions.move(_left, top); top += _resetSessions.height() + st::setSectionSkip; _logOut.move(_left, top); } }
void SettingsInner::paintEvent(QPaintEvent *e) { QPainter p(this); p.setClipRect(e->rect()); int32 top = 0; if (_self) { // profile top += st::setTop; _nameText.drawElided(p, _uploadPhoto.x() + st::setNameLeft, top + st::setNameTop, _uploadPhoto.width() - st::setNameLeft); if (!_cancelPhoto.isHidden()) { p.setFont(st::linkFont->f); p.setPen(st::black->p); p.drawText(_uploadPhoto.x() + st::setPhoneLeft, _cancelPhoto.y() + st::linkFont->ascent, lang(lng_settings_uploading_photo)); } p.setFont(st::setPhoneFont->f); p.setPen(st::setPhoneColor->p); p.drawText(_uploadPhoto.x() + st::setPhoneLeft, top + st::setPhoneTop + st::setPhoneFont->ascent, _phoneText); if (_photoLink) { p.drawPixmap(_left, top, _self->photo->pix(st::setPhotoSize)); } else { if (a_photo.current() < 1) { p.drawPixmap(QPoint(_left, top), App::sprite(), st::setPhotoImg); } if (a_photo.current() > 0) { p.setOpacity(a_photo.current()); p.drawPixmap(QPoint(_left, top), App::sprite(), st::setOverPhotoImg); p.setOpacity(1); } } top += st::setPhotoSize; if (!_errorText.isEmpty()) { p.setFont(st::setErrFont->f); p.setPen(st::setErrColor->p); p.drawText(QRect(_uploadPhoto.x(), _uploadPhoto.y() + _uploadPhoto.height() + st::setLittleSkip, _uploadPhoto.width(), st::setErrFont->height), _errorText, style::al_center); } // notifications p.setFont(st::setHeaderFont->f); p.setPen(st::setHeaderColor->p); p.drawText(_left + st::setHeaderLeft, top + st::setHeaderTop + st::setHeaderFont->ascent, lang(lng_settings_section_notify)); top += st::setHeaderSkip; top += _desktopNotify.height() + st::setLittleSkip; top += _soundNotify.height(); } // general p.setFont(st::setHeaderFont->f); p.setPen(st::setHeaderColor->p); p.drawText(_left + st::setHeaderLeft, top + st::setHeaderTop + st::setHeaderFont->ascent, lang(lng_settings_section_general)); top += st::setHeaderSkip; top += _autoUpdate.height(); QString textToDraw; if (cAutoUpdate()) { switch (_updatingState) { case UpdatingNone: textToDraw = _curVersionText; break; case UpdatingCheck: textToDraw = lang(lng_settings_update_checking); break; case UpdatingLatest: textToDraw = lang(lng_settings_latest_installed); break; case UpdatingDownload: textToDraw = _newVersionDownload; break; case UpdatingReady: textToDraw = _newVersionText; break; case UpdatingFail: textToDraw = lang(lng_settings_update_fail); break; } } else { textToDraw = _curVersionText; } p.setFont(st::linkFont->f); p.setPen(st::setVersionColor->p); p.drawText(_left + st::setVersionLeft, top + st::setVersionTop + st::linkFont->ascent, textToDraw); top += st::setVersionHeight; if (cPlatform() == dbipWindows) { top += _workmodeTray.height() + st::setLittleSkip; top += _workmodeWindow.height() + st::setSectionSkip; top += _autoStart.height() + st::setLittleSkip; top += _startMinimized.height(); } if (!cRetina()) { p.setFont(st::setHeaderFont->f); p.setPen(st::setHeaderColor->p); p.drawText(_left + st::setHeaderLeft, top + st::setHeaderTop + st::setHeaderFont->ascent, lang(lng_settings_scale_label)); top += st::setHeaderSkip; top += _dpiAutoScale.height() + st::setLittleSkip; top += _dpiSlider.height() + st::dpiFont4->height; int32 sLeft = _dpiSlider.x() + _dpiWidth1 / 2, sWidth = _dpiSlider.width(); float64 sStep = (sWidth - _dpiWidth1 / 2 - _dpiWidth4 / 2) / float64(dbisScaleCount - 2); p.setFont(st::dpiFont1->f); p.setPen((scaleIs(dbisOne) ? st::dpiActive : st::dpiInactive)->p); p.drawText(sLeft + qRound(0 * sStep) - _dpiWidth1 / 2, top - (st::dpiFont4->height - st::dpiFont1->height) / 2 - st::dpiFont1->descent, scaleLabel(dbisOne)); p.setFont(st::dpiFont2->f); p.setPen((scaleIs(dbisOneAndQuarter) ? st::dpiActive : st::dpiInactive)->p); p.drawText(sLeft + qRound(1 * sStep) - _dpiWidth2 / 2, top - (st::dpiFont4->height - st::dpiFont2->height) / 2 - st::dpiFont2->descent, scaleLabel(dbisOneAndQuarter)); p.setFont(st::dpiFont3->f); p.setPen((scaleIs(dbisOneAndHalf) ? st::dpiActive : st::dpiInactive)->p); p.drawText(sLeft + qRound(2 * sStep) - _dpiWidth3 / 2, top - (st::dpiFont4->height - st::dpiFont3->height) / 2 - st::dpiFont3->descent, scaleLabel(dbisOneAndHalf)); p.setFont(st::dpiFont4->f); p.setPen((scaleIs(dbisTwo) ? st::dpiActive : st::dpiInactive)->p); p.drawText(sLeft + qRound(3 * sStep) - _dpiWidth4 / 2, top - (st::dpiFont4->height - st::dpiFont4->height) / 2 - st::dpiFont4->descent, scaleLabel(dbisTwo)); p.setFont(st::linkFont->f); } if (_self) { // chat options p.setFont(st::setHeaderFont->f); p.setPen(st::setHeaderColor->p); p.drawText(_left + st::setHeaderLeft, top + st::setHeaderTop + st::setHeaderFont->ascent, lang(lng_settings_section_chat)); top += st::setHeaderSkip; top += _replaceEmojis.height() + st::setSectionSkip; top += _enterSend.height() + st::setLittleSkip; top += _ctrlEnterSend.height() + st::setSectionSkip; top += _dontAskDownloadPath.height(); if (!cAskDownloadPath()) { top += st::setLittleSkip; p.setFont(st::linkFont->f); p.setPen(st::black->p); p.drawText(_left + st::setVersionLeft, top + st::linkFont->ascent, lang(lng_download_path_label)); if (cDownloadPath().isEmpty()) { QString clearText; int32 clearWidth = 0; switch (_tempDirClearState) { case TempDirClearing: clearText = lang(lng_download_path_clearing); clearWidth = _tempDirClearingWidth; break; case TempDirCleared: clearText = lang(lng_download_path_cleared); clearWidth = _tempDirClearedWidth; break; case TempDirClearFailed: clearText = lang(lng_download_path_clear_failed); clearWidth = _tempDirClearFailedWidth; break; } if (clearWidth) { p.drawText(_left + st::setWidth - clearWidth, top + st::linkFont->ascent, clearText); } } top += _downloadPathEdit.height(); } top += st::setSectionSkip; top += _catsAndDogs.height() + st::setLittleSkip; top += _scrollNotActive.height(); } // advanced p.setFont(st::setHeaderFont->f); p.setPen(st::setHeaderColor->p); p.drawText(_left + st::setHeaderLeft, top + st::setHeaderTop + st::setHeaderFont->ascent, lang(lng_settings_section_advanced)); top += st::setHeaderSkip; p.setFont(st::linkFont->f); p.setPen(st::black->p); p.drawText(_left + st::setHeaderLeft, _connectionType.y() + st::linkFont->ascent, _connectionTypeText); if (_self && _resetDone) { p.drawText(_resetSessions.x(), _resetSessions.y() + st::linkFont->ascent, lang(lng_settings_reset_done)); } }