Exemple #1
0
void AutoLockBox::prepare() {
	setTitle(lang(lng_passcode_autolock));

	addButton(lang(lng_box_ok), [this] { closeBox(); });

	int opts[] = { 60, 300, 3600, 18000 }, cnt = sizeof(opts) / sizeof(opts[0]);
	auto y = st::boxOptionListPadding.top();
	_options.reserve(cnt);
	for (auto i = 0; i != cnt; ++i) {
		auto v = opts[i];
		_options.push_back(new Ui::Radiobutton(this, qsl("autolock"), v, (v % 3600) ? lng_passcode_autolock_minutes(lt_count, v / 60) : lng_passcode_autolock_hours(lt_count, v / 3600), (Global::AutoLock() == v), st::langsButton));
		_options.back()->move(st::boxPadding.left() + st::boxOptionListPadding.left(), y);
		y += _options.back()->heightNoMargins() + st::boxOptionListSkip;
		connect(_options.back(), SIGNAL(changed()), this, SLOT(onChange()));
	}

	setDimensions(st::langsWidth, st::boxOptionListPadding.top() + cnt * st::langsButton.height + (cnt - 1) * st::boxOptionListSkip + st::boxOptionListPadding.bottom() + st::boxPadding.bottom());
}
Exemple #2
0
AutoLockBox::AutoLockBox() :
_done(this, lang(lng_about_done), st::langsCloseButton) {

	bool haveTestLang = (cLang() == languageTest);

	int32 opts[] = { 60, 300, 3600, 18000 }, cnt = sizeof(opts) / sizeof(opts[0]);

	resizeMaxHeight(st::langsWidth, st::boxTitleHeight + st::langsPadding.top() + st::langsPadding.bottom() + cnt * (st::langPadding.top() + st::rbDefFlat.height + st::langPadding.bottom()) + _done.height());

	int32 y = st::boxTitleHeight + st::langsPadding.top();
	_options.reserve(cnt);
	for (int32 i = 0; i < cnt; ++i) {
		int32 v = opts[i];
		_options.push_back(new FlatRadiobutton(this, qsl("autolock"), v, (v % 3600) ? lng_passcode_autolock_minutes(lt_count, v / 60) : lng_passcode_autolock_hours(lt_count, v / 3600), (cAutoLock() == v), st::langButton));
		_options.back()->move(st::langsPadding.left() + st::langPadding.left(), y + st::langPadding.top());
		y += st::langPadding.top() + _options.back()->height() + st::langPadding.bottom();
		connect(_options.back(), SIGNAL(changed()), this, SLOT(onChange()));
	}

	connect(&_done, SIGNAL(clicked()), this, SLOT(onClose()));

	_done.move(0, height() - _done.height());
	prepare();
}
Exemple #3
0
AutoLockBox::AutoLockBox() :
_close(this, lang(lng_box_ok), st::defaultBoxButton) {

	bool haveTestLang = (cLang() == languageTest);

	int32 opts[] = { 60, 300, 3600, 18000 }, cnt = sizeof(opts) / sizeof(opts[0]);

	resizeMaxHeight(st::langsWidth, st::boxTitleHeight + cnt * (st::boxOptionListPadding.top() + st::langsButton.height) + st::boxOptionListPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _close.height() + st::boxButtonPadding.bottom());

	int32 y = st::boxTitleHeight + st::boxOptionListPadding.top();
	_options.reserve(cnt);
	for (int32 i = 0; i < cnt; ++i) {
		int32 v = opts[i];
		_options.push_back(new Radiobutton(this, qsl("autolock"), v, (v % 3600) ? lng_passcode_autolock_minutes(lt_count, v / 60) : lng_passcode_autolock_hours(lt_count, v / 3600), (Global::AutoLock() == v), st::langsButton));
		_options.back()->move(st::boxPadding.left() + st::boxOptionListPadding.left(), y);
		y += _options.back()->height() + st::boxOptionListPadding.top();
		connect(_options.back(), SIGNAL(changed()), this, SLOT(onChange()));
	}

	connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));

	_close.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _close.height());
	prepare();
}