void DownloadPathBox::onChange() {
	if (_dirRadio.checked()) {
		if (_path.isEmpty()) {
			_tempRadio.setChecked(true);
			onEditPath();
			if (!_path.isEmpty()) {
				_dirRadio.setChecked(true);
			}
		} else {
			_dirInput.setText(QDir::toNativeSeparators(_path));
			_dirInput.setCursorPosition(0);
		}
	}
	showAll();
	update();
}
Beispiel #2
0
void DownloadPathBox::onChange() {
	if (_dir.checked()) {
		if (_path.isEmpty() || _path == qsl("tmp")) {
			(_path.isEmpty() ? _default : _temp).setChecked(true);
			onEditPath();
			if (!_path.isEmpty() && _path != qsl("tmp")) {
				_dir.setChecked(true);
			}
		} else {
			setPathText(QDir::toNativeSeparators(_path));
		}
	} else if (_temp.checked()) {
		_path = qsl("tmp");
	} else {
		_path = QString();
	}
	showAll();
	update();
}
Beispiel #3
0
void DownloadPathBox::onChange() {
	if (_dirRadio.checked()) {
		if (_path.isEmpty() || _path == qsl("tmp")) {
			(_path.isEmpty() ? _defaultRadio : _tempRadio).setChecked(true);
			onEditPath();
			if (!_path.isEmpty() && _path != qsl("tmp")) {
				_dirRadio.setChecked(true);
			}
		} else {
			_dirInput.setText(QDir::toNativeSeparators(_path));
			_dirInput.setCursorPosition(0);
		}
	} else if (_tempRadio.checked()) {
		_path = qsl("tmp");
	} else {
		_path = QString();
	}
	showAll();
	update();
}
Beispiel #4
0
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();
}
Beispiel #5
0
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();
}