Exemplo n.º 1
0
void ConfirmBox::keyPressEvent(QKeyEvent *e) {
	if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
		emit confirmed();
	} else {
		AbstractBox::keyPressEvent(e);
	}
}
Exemplo n.º 2
0
void Window::onLogout() {
	if (isHidden()) showFromTray();

	ConfirmBox *box = new ConfirmBox(lang(lng_sure_logout));
	connect(box, SIGNAL(confirmed()), this, SLOT(onLogoutSure()));
	App::wnd()->showLayer(box);
}
	void FilletCommand::doPrepare()
	{
		MainWindow* win = CADApplication::getMainWindow();

		if (model.getShapes().size() == 0)
			throw Common::Exception(QObject::tr("Отсутствуют объекты"));

		operationWidget = new FilletOperationWidget(model.getShapes(), win);
		pickWidget = new PickShapeWidget(view, win);
		pickWidget->setCentralWidget(operationWidget);
		win->setCommandWidget(pickWidget, MainWindow::CommandMod);
		QObject::connect(pickWidget, SIGNAL(shapeSelected(const ViewerShape&, const TopoDS_Shape&)),
			operationWidget, SLOT(shapeSelected(const ViewerShape&, const TopoDS_Shape&)));

		QObject::connect(pickWidget, SIGNAL(canceled()), this, SLOT(cancel()));
		QObject::connect(pickWidget, SIGNAL(confirmed()), this, SLOT(confirmed()));
	}
Exemplo n.º 4
0
//--------------------------------------------------------------------------------------------------------------------------------
//!
//! \brief ColorChooseWindow::setConnections
//!
void ColorChooseWindow::setConnections(){
    connect(confirmButton,SIGNAL(clicked()), this, SLOT(confirmed()));
    connect(cancelButton,SIGNAL(clicked()), this, SLOT(cancelled()));

    connect(redSlider, SIGNAL(valueChanged(int)), this, SLOT(setRedValue(int)));
    connect(greenSlider, SIGNAL(valueChanged(int)), this, SLOT(setGreenValue(int)));
    connect(blueSlider, SIGNAL(valueChanged(int)), this, SLOT(setBlueValue(int)));
}
Exemplo n.º 5
0
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();
}
Exemplo n.º 6
0
void ProfileInner::mouseReleaseEvent(QMouseEvent *e) {
	if (_kickDown && _kickDown == _kickOver) {
		_kickConfirm = _kickOver;
		ConfirmBox *box = new ConfirmBox(lang(lng_profile_sure_kick).replace(qsl("{user}"), _kickOver->firstName));
		connect(box, SIGNAL(confirmed()), this, SLOT(onKickConfirm()));
		App::wnd()->showLayer(box);
	}
	_kickDown = 0;
	setCursor(_kickOver ? style::cur_pointer : style::cur_default);
	update();
}
Exemplo n.º 7
0
void ColorItemEditor::mousePressEvent( QMouseEvent* e )
{
  QColor selectedColor = QColorDialog::getColor( this->m_color );
  if ( selectedColor.isValid( ) )
  {
    // std::cout << selectedColor.name( ).toStdString( ) << std::endl;
    this->setColor( selectedColor );
  }

  emit confirmed( );
}
Exemplo n.º 8
0
static int
dosubcon(bool f, line *a)
{

	if (execute(f, a) == 0)
		return (0);
	if (confirmed(a)) {
		dosub();
		scount++;
	}
	return (1);
}
Exemplo n.º 9
0
void SessionsInner::onTerminate() {
	for (TerminateButtons::iterator i = _terminateButtons.begin(), e = _terminateButtons.end(); i != e; ++i) {
		if (i.value()->getState() & Button::StateOver) {
			_terminating = i.key();

			if (_terminateBox) _terminateBox->deleteLater();
			_terminateBox = new ConfirmBox(lang(lng_settings_reset_one_sure), lang(lng_settings_reset_button));
			connect(_terminateBox, SIGNAL(confirmed()), this, SLOT(onTerminateSure()));
			connect(_terminateBox, SIGNAL(destroyed(QObject*)), this, SLOT(onNoTerminateBox(QObject*)));
			App::wnd()->replaceLayer(_terminateBox);
		}
	}
Exemplo n.º 10
0
void RunBar::_initConnections()
{
    connect(this, SIGNAL(textEdited(QString)), this, SLOT(_typed(QString)));
    connect(this, SIGNAL(returnPressed()), this, SLOT(confirmed()));
    connect(_hinter, SIGNAL(changed()), this, SLOT(_hinterChanged()));
    connect(_settings, SIGNAL(changed()), this, SLOT(_settingsChanged()));
    connect(_toggleAction, SIGNAL(triggered()), this, SLOT(toggle()));
    connect(_editHistoryAction, SIGNAL(triggered()), this, SLOT(editHistory()));
    connect(_reloadAction, SIGNAL(triggered()), this, SLOT(reload()));
    connect(_showSettingsAction, SIGNAL(triggered()), _settings, SLOT(show()));
    connect(_tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(_toggleForTray(QSystemTrayIcon::ActivationReason)));
    connect(&_autoRefresh, SIGNAL(timeout()), _hinter, SLOT(reloadIfNeeded()));
}
Exemplo n.º 11
0
void ConfirmBox::init(const QString &text) {
    _text.setText(st::boxTextFont, text, _informative ? _confirmBoxTextOptions : _textPlainOptions);

    connect(&_confirm, SIGNAL(clicked()), this, SLOT(onConfirmPressed()));
    connect(&_cancel, SIGNAL(clicked()), this, SLOT(onCancel()));
    if (_informative) {
        _cancel.hide();
        connect(this, SIGNAL(confirmed()), this, SLOT(onCancel()));
    }
    onTextUpdated();

    prepare();
}
Exemplo n.º 12
0
void SettingsWidget::onInviteLink() {
	auto getInviteLink = [this]() {
		if (auto chat = peer()->asChat()) {
			return chat->inviteLink();
		} else if (auto channel = peer()->asChannel()) {
			return channel->inviteLink();
		}
		return QString();
	};
	auto link = getInviteLink();

	ConfirmBox *box = new ConfirmBox(lang(link.isEmpty() ? lng_group_invite_about : lng_group_invite_about_new));
	connect(box, SIGNAL(confirmed()), this, SLOT(onInviteLinkSure()));
	Ui::showLayer(box);
}
Exemplo n.º 13
0
void SubmitDialog::on_confirmSubmitButton_clicked()
{
    if(ui->loginEdit->text() == "" || ui->passEdit->text() == "")
    {
        showErrorDialog("You need to fill login and password data");
        return;
    }
    QString mes = "Information about your hardware and";
    mes += "\nbenchmark results will be uploaded to server.";
    mes += "\n\nContinue to send?";
    QMessageBox::StandardButton reply;
    reply = QMessageBox::question(this, "Confirm submit", mes,
                                        QMessageBox::Yes | QMessageBox::No);
    if (reply == QMessageBox::Yes)
    {
        emit confirmed();
        this->close();
    }
}
Exemplo n.º 14
0
void PhotoSendBox::onSend(bool ctrlShiftEnter) {
	if (!_img) {
		if (App::main()) App::main()->confirmShareContact(ctrlShiftEnter, _phone, _fname, _lname, _replyTo);
	} else {
		if (!_compressed.isHidden()) {
			if (_compressed.checked() != cCompressPastedImage()) {
				cSetCompressPastedImage(_compressed.checked());
				Local::writeUserSettings();
			}
		}
		if (_compressed.isHidden() || _compressed.checked()) {
			_img->ctrlShiftEnter = ctrlShiftEnter;
			if (App::main()) App::main()->confirmSendImage(*_img);
		} else {
			if (App::main()) App::main()->confirmSendImageUncompressed(ctrlShiftEnter, _replyTo);
		}
	}
	emit confirmed();
	emit closed();
}
Exemplo n.º 15
0
void SettingsInner::setScale(DBIScale newScale) {
	if (cConfigScale() == newScale) return;

	cSetConfigScale(newScale);
	App::writeConfig();
	App::wnd()->getTitle()->showUpdateBtn();
	if (newScale == dbisAuto && !_dpiAutoScale.checked()) {
		_dpiAutoScale.setChecked(true);
	} else if (newScale != dbisAuto && _dpiAutoScale.checked()) {
		_dpiAutoScale.setChecked(false);
	}
	if (newScale == dbisAuto) newScale = cScreenScale();
	if (_dpiSlider.selected() != newScale - 1) {
		_dpiSlider.setSelected(newScale - 1);
	}
	if (cEvalScale(cConfigScale()) != cEvalScale(cRealScale())) {
		ConfirmBox *box = new ConfirmBox(lang(lng_settings_need_restart), lang(lng_settings_restart_now), lang(lng_settings_restart_later));
		connect(box, SIGNAL(confirmed()), this, SLOT(onRestartNow()));
		App::wnd()->showLayer(box);
	}
}
Exemplo n.º 16
0
NewRestDialog::NewRestDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::NewRestDialog)
{
    ui->setupUi(this);

    // connect signals & slots
    connect(ui->btnAdd, SIGNAL(clicked()), SLOT(confirmed()));
    connect(ui->radioInterval, SIGNAL(clicked()), SLOT(typeChanged()));
    connect(ui->radioSingleShot, SIGNAL(clicked()), SLOT(typeChanged()));

    // get current time with 0 msec
    QDateTime now = QDateTime::currentDateTime();
    QTime nowT = now.time();
    now.setTime(QTime(nowT.hour(), nowT.minute(), nowT.second(), 0));

    // set default values
    ui->editStart->setDateTime(now);
    ui->editEnd->setDateTime(now.addSecs(3600));
    ui->editInterval->setTime(QTime(0, 1, 0));
    ui->editDuration->setTime(QTime(0, 1, 0));
    ui->radioSingleShot->click();
}
Exemplo n.º 17
0
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();
}
Exemplo n.º 18
0
void Welcome::on_checkIn_clicked()
{
    number = ui->lineIn->text();
    ui->lineIn->clear();
    qDebug() << "get the number:\t" << number;
    if(check.isExist(number)){
        close();
        qDebug() << "Welcome closed.";
        emit confirmed(1, number);
        qDebug() << "Confirmed signal sent.(welcome)";
    }
    else{
        QMessageBox::information(this,
                                 "提示",
                                 "该编号不存在!",
                                 "返回");
//        emit refused(1, number);
//        qDebug() << "Refused signal sent.";
//        close();
//        qDebug() << "Welcome closed.";

    }
}
Exemplo n.º 19
0
void LanguageBox::onChange() {
	if (isHidden()) return;

	for (int32 i = 0, l = _langs.size(); i < l; ++i) {
		int32 langId = _langs[i]->val();
		if (_langs[i]->checked() && langId != cLang()) {
			LangLoaderResult result;
			if (langId > 0) {
				LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[langId] + qsl(".strings"), LangLoaderRequest(lng_sure_save_language, lng_cancel, lng_box_ok));
				result = loader.found();
			} else if (langId == languageTest) {
				LangLoaderPlain loader(cLangFile(), LangLoaderRequest(lng_sure_save_language, lng_cancel, lng_box_ok));
				result = loader.found();
			}
			QString text = result.value(lng_sure_save_language, langOriginal(lng_sure_save_language)),
			        save = result.value(lng_box_ok, langOriginal(lng_box_ok)),
					cancel = result.value(lng_cancel, langOriginal(lng_cancel));
			ConfirmBox *box = new ConfirmBox(text, save, st::defaultBoxButton, cancel);
			connect(box, SIGNAL(confirmed()), this, SLOT(onSave()));
			connect(box, SIGNAL(closed()), this, SLOT(onRestore()));
			App::wnd()->replaceLayer(box);
		}
	}
}
Exemplo n.º 20
0
void ConfirmBox::onConfirmPressed() {
    if (_confirmedCallback) {
        _confirmedCallback();
    }
    emit confirmed();
}
Exemplo n.º 21
0
void ProfileInner::onClearHistory() {
	ConfirmBox *box = new ConfirmBox(lang(lng_sure_delete_history).replace(qsl("{contact}"), _peer->name));
	connect(box, SIGNAL(confirmed()), this, SLOT(onClearHistorySure()));
	App::wnd()->showLayer(box);
}
Exemplo n.º 22
0
KickMemberBox::KickMemberBox(PeerData *chat, UserData *member)
    : ConfirmBox(lng_profile_sure_kick(lt_user, member->firstName), lang(lng_box_remove))
    , _chat(chat)
    , _member(member) {
    connect(this, SIGNAL(confirmed()), this, SLOT(onConfirm()));
}
Exemplo n.º 23
0
void PasscodeBox::onSave(bool force) {
	if (_setRequest) return;

	QString old = _oldPasscode.text(), pwd = _newPasscode.text(), conf = _reenterPasscode.text();
	bool has = _cloudPwd ? (!_curSalt.isEmpty()) : cHasPasscode();
	if (!_cloudPwd && (_turningOff || has)) {
		if (!passcodeCanTry()) {
			_oldError = lang(lng_flood_error);
			_oldPasscode.setFocus();
			_oldPasscode.showError();
			update();
			return;
		}

		if (Local::checkPasscode(old.toUtf8())) {
			cSetPasscodeBadTries(0);
			if (_turningOff) pwd = conf = QString();
		} else {
			cSetPasscodeBadTries(cPasscodeBadTries() + 1);
			cSetPasscodeLastTry(getms(true));
			onBadOldPasscode();
			return;
		}
	}
	if (!_turningOff && pwd.isEmpty()) {
		_newPasscode.setFocus();
		_newPasscode.showError();
		if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
		return;
	}
	if (pwd != conf) {
		_reenterPasscode.selectAll();
		_reenterPasscode.setFocus();
		_reenterPasscode.showError();
		if (!conf.isEmpty()) {
			_newError = lang(_cloudPwd ? lng_cloud_password_differ : lng_passcode_differ);
			update();
		}
		if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
	} else if (!_turningOff && has && old == pwd) {
		_newPasscode.setFocus();
		_newPasscode.showError();
		_newError = lang(_cloudPwd ? lng_cloud_password_is_same : lng_passcode_is_same);
		update();
		if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
	} else if (_cloudPwd) {
		QString hint = _passwordHint.getLastText(), email = _recoverEmail.getLastText().trimmed();
		if (_cloudPwd && pwd == hint && !_passwordHint.isHidden() && !_newPasscode.isHidden()) {
			_newPasscode.setFocus();
			_newPasscode.showError();
			_newError = lang(lng_cloud_password_bad);
			update();
			if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
			return;
		}
		if (!_recoverEmail.isHidden() && email.isEmpty() && !force) {
			_skipEmailWarning = true;
			_replacedBy = new ConfirmBox(lang(lng_cloud_password_about_recover), lang(lng_cloud_password_skip_email), st::attentionBoxButton);
			connect(_replacedBy, SIGNAL(confirmed()), this, SLOT(onForceNoMail()));
			connect(_replacedBy, SIGNAL(destroyed(QObject*)), this, SLOT(onBoxDestroyed(QObject*)));
			Ui::showLayer(_replacedBy, KeepOtherLayers);
		} else {
Exemplo n.º 24
0
ConfirmLinkBox::ConfirmLinkBox(const QString &url) : ConfirmBox(lang(lng_open_this_link) + qsl("\n\n") + url, lang(lng_open_link))
    , _url(url) {
    connect(this, SIGNAL(confirmed()), this, SLOT(onOpenLink()));
}
Exemplo n.º 25
0
ConfirmBotGameBox::ConfirmBotGameBox(UserData *bot, const QString &url) : ConfirmBox(lng_allow_bot_pass(lt_bot_name, bot->name), lang(lng_allow_bot))
    , _bot(bot)
    , _url(url) {
    connect(this, SIGNAL(confirmed()), this, SLOT(onOpenLink()));
}
Exemplo n.º 26
0
void SharePhoneConfirmBox::onConfirm() {
    emit confirmed(_recipient);
}
Exemplo n.º 27
0
SharePhoneConfirmBox::SharePhoneConfirmBox(PeerData *recipient)
    : ConfirmBox(lang(lng_bot_share_phone), lang(lng_bot_share_phone_confirm))
    , _recipient(recipient) {
    connect(this, SIGNAL(confirmed()), this, SLOT(onConfirm()));
}
Exemplo n.º 28
0
void IntroPwdCheck::onReset() {
	if (sentRequest) return;
	ConfirmBox *box = new ConfirmBox(lang(lng_signin_sure_reset), lang(lng_signin_reset), st::attentionBoxButton);
	connect(box, SIGNAL(confirmed()), this, SLOT(onResetSure()));
	App::wnd()->showLayer(box);
}
Exemplo n.º 29
0
void AddPoint::closeOk() {
    emit confirmed(true, xCoordinate->text().toInt(), yCoordinate->text().toInt());
    this->close();
}
Exemplo n.º 30
0
void SettingsInner::onDownloadPathClear() {
	ConfirmBox *box = new ConfirmBox(lang(lng_sure_clear_downloads));
	connect(box, SIGNAL(confirmed()), this, SLOT(onDownloadPathClearSure()));
	App::wnd()->showLayer(box);
}