void CTemplateWindow::onDelButton()
{
	uiComboBoxItem *pItem = m_comboList->getSelectItem();
	if ( pItem )
	{
		CObjectTemplate *p = (CObjectTemplate*) pItem->getData();

		if ( p->getRef() > 0 )
		{
			alert( L"Can not delete this template because it is used on level!", NULL);
			return;
		}

		if ( p )
		{		
			WCHAR msg[1024];
			swprintf( msg, 1024, L"Do you want to delete this template '%s'", p->getObjectTemplateName() );
			if ( question( msg, NULL) == true )
			{				
				CObjTemplateFactory::removeTemplate( p->getObjectTemplateName() );
				CObjTemplateFactory::saveAllObjectTemplate();
				reloadList();
			}
		}
	}
}
Beispiel #2
0
void IngameMenu::render(sf::RenderTarget *target)
{
	sf::Shape bg = sf::Shape::Rectangle(0, 0,
													W_WIDTH, W_HEIGHT,
													sf::Color(100,100,100,120));
	target->Draw(bg);

	sf::Shape sh = sf::Shape::Rectangle(290, 210,
													436, 310,
													sf::Color(110,90,60,150),
													1.f,
													sf::Color(30,35,60,200));
	target->Draw(sh);


	sf::String question("Que souhaitez vous ?");
	question.SetSize(14);
	question.SetColor(sf::Color(250,250,220));
	question.SetPosition(300, 220);

	target->Draw(question);
	bQuit.render(target);
	bCancel.render(target);

}
ICMainWindow::ICMainWindow(ICServer *theServer, QWidget *parent) :
    QMainWindow(parent), server(theServer), questionDialog(new ICNewQuestionDialog(this)),
    onCanvas(false)
{
    setupUi(this);

    setWindowIcon(QIcon(":/images/icimage.png"));

    //this->setAttribute(Qt::WA_TranslucentBackground, true);
    setWindowFlags(Qt::FramelessWindowHint);
    //questionDialog->setWindowOpacity(0.8);
    questionDialog->setWindowFlags(questionDialog->windowFlags() | Qt::FramelessWindowHint);

    connect(exitButton, SIGNAL(clicked()), this, SLOT(close()));
    connect(minimizeButton, SIGNAL(clicked()), this, SLOT(showMinimized()));

    connect(understandButton, SIGNAL(clicked()), this, SLOT(understand()));
    connect(questionButton, SIGNAL(clicked()), this, SLOT(question()));
    connect(stopButton, SIGNAL(clicked()), this, SLOT(stop()));

    connect(server, SIGNAL(newAnswerArrived(QString)), this, SLOT(newAnswerArrived(QString)));
    connect(server, SIGNAL(connectionClosed()), this, SLOT(connectionClosed()));

    connect(questionDialog, SIGNAL(newQuestion(int,int)), this, SLOT(newQuestionReady(int,int)));

    sidLabel->setText(server->getIdentifier());
    countLabel->setText("0/0");
}
Beispiel #4
0
void	PhotoGraphicsItem::mousePressEvent ( QGraphicsSceneMouseEvent * event )
{
    if (isEnabled() && deleteRect().contains(event->pos()))
    {
        if (scene())
        {
            if (scene()->views().count())
            {
                bool vResult = question(scene()->views().at(0)->parentWidget()
                                      , TRANSLATE("Удалить фото")
                                      , TRANSLATE("Вы действительно хотите удалить фотографию?")
                                                    );
                if (vResult)
                {
                    ((GalleryGrapicsScene*)scene())->remove(id());
                }
            }
        }

    }
    else
    {
        setActive();
    }
}
Beispiel #5
0
void MqsConfig::onRemoveEncoder()
{
	string user_defined_encoder_name;
	QList<QListWidgetItem*> selected_encoders = ui.list_encoders->selectedItems();
	user_defined_encoder_name = selected_encoders.at(0)->text().toStdString();

	if(user_defined_encoder_name.empty())
		return;

	if(QMessageBox::question(this,"Confirmation","Are you really want to delete channel?",QMessageBox::Yes,QMessageBox::No) ==	QMessageBox::No)
		return;

	QString affected_channels("");
	QSqlQuery affected_channels_result = settings->query("SELECT name FROM channel WHERE encoder='%s'", user_defined_encoder_name.c_str());
	do
	{
		QSqlRecord affected_channel = affected_channels_result.record();
		affected_channels += affected_channel.value("name").toString();
	}while(affected_channels_result.next());
	if(!affected_channels.isEmpty())
	{
		QString question("Next linked channels: " + affected_channels + " will be deleted too. Continue?");

		if(QMessageBox::question(this,"Channel dependencies found", question, QMessageBox::Yes,QMessageBox::No) ==	QMessageBox::No)
			return;
	}
	settings->query("DELETE FROM channel WHERE encoder='%s'", user_defined_encoder_name.c_str());
	settings->query("DELETE FROM encoder WHERE name = '%s'", user_defined_encoder_name.c_str());
	updateEncoders();
	updateChannels();
}
Beispiel #6
0
static int standby_resume_standby(struct node *node, unsigned me, unsigned la, bool interactive)
{
	if (!node->remote[la].has_power_status)
		return NOTAPPLICABLE;

	struct cec_msg msg = {};
	unsigned unresponsive_time = 0;

	fail_on_test(!util_interactive_ensure_power_state(node, me, la, interactive, CEC_OP_POWER_STATUS_ON));

	announce("Sending Standby message.");
	cec_msg_init(&msg, me, la);
	cec_msg_standby(&msg);
	fail_on_test(!transmit_timeout(node, &msg));
	fail_on_test(cec_msg_status_is_abort(&msg));
	fail_on_test(!poll_stable_power_status(node, me, la, CEC_OP_POWER_STATUS_STANDBY, unresponsive_time));
	fail_on_test(interactive && !question("Is the device in standby?"));
	node->remote[la].in_standby = true;

	if (unresponsive_time > 0)
		warn("The device went correctly into standby, but became unresponsive for %d s during the transition.\n",
		     unresponsive_time);

	return 0;
}
Beispiel #7
0
static int standby_resume_standby_toggle(struct node *node, unsigned me, unsigned la, bool interactive)
{
	if (!node->remote[la].in_standby)
		return NOTAPPLICABLE;

	struct cec_msg msg = {};
	unsigned unresponsive_time = 0;
	__u8 new_status;

	node->remote[la].in_standby = false;

	/* Send Standby again to test that it is not acting like a toggle */
	announce("Sending Standby message.");
	cec_msg_init(&msg, me, la);
	cec_msg_standby(&msg);
	int res = doioctl(node, CEC_TRANSMIT, &msg);
	fail_on_test(res && res != ENONET);
	fail_on_test(cec_msg_status_is_abort(&msg));
	fail_on_test(wait_changing_power_status(node, me, la, new_status, unresponsive_time));
	fail_on_test(new_status != CEC_OP_POWER_STATUS_STANDBY);
	fail_on_test(interactive && !question("Is the device still in standby?"));
	node->remote[la].in_standby = true;
	if (unresponsive_time > 0)
		warn("The device went correctly into standby, but became unresponsive for %d s during the transition.\n",
		     unresponsive_time);

	return 0;
}
Beispiel #8
0
void sfac_imprim()
{
  int ret=0;
  //GError **err;
  fis=fopen(ficcdimp,"r");
  if ( fis == NULL) { message(16); return;  }
  //printf("open %s\n",ficcdimp);
  ret = edit_fac();
  fclose (fis);	fis = NULL;
  if ( ret == -1)	{
    message (26);
    return;
  }
  //gboolean  g_spawn_command_line_async (const gchar *command_line, GError **error);
#ifdef WIN32
  //g_spawn_command_line_async("ShellExecute(0,'open','factest.pdf',0,0,1)",*err);
  ShellExecute(0,"open","factest.pdf",0,0,SW_SHOWNORMAL);
#else
  //system("start evince factest.pdf");
  system("xdg-open factest.pdf&"); // & permet de garder la main ?
  //system("gnome-open factest.pdf");
#endif

  if ( question(22) == 0)	sauvfac();
}
SettingsReader::SettingsReader()
{
    const bool first_start = globals::settings->value("first_start", true).toBool();
    if(first_start) {
        globals::settings->setValue("first_start", false);
        QMessageBox::information(NULL, "Please close LQ and then edit:", globals::settings->fileName().toAscii().data());
    }
    if(globals::settings->value("update_applied").toBool()) {
        UpdateInfoDlg u;
        u.show();
        u.exec();
        globals::settings->setValue("update_applied", false);
    }
    printf("Writing options to %s\n",
           globals::settings->fileName().toAscii().data());
    checkIntegrity(first_start);

    if(first_start) {
        const bool mobile = question("Is this a mobile?",
                                     "Are you running this on your mobile phone?");
        globals::settings->setValue("target",
                                    (mobile)?"mobile":"pc");
    }

    globals::MUSIC_ROOT = globals::settings->value("music_root").toString();
    globals::VIDEO_ROOT = globals::settings->value("video_root").toString();
    globals::MPLAYER_EXE = globals::settings->value("mplayer_name").toString();
}
Beispiel #10
0
static int standby_resume_wakeup(struct node *node, unsigned me, unsigned la, bool interactive)
{
	if (!node->remote[la].in_standby)
		return NOTAPPLICABLE;

	int ret;

	if (is_tv(la, node->remote[la].prim_type))
		ret = wakeup_tv(node, me, la);
	else
		ret = wakeup_source(node, me, la);
	if (ret)
		return ret;

	unsigned unresponsive_time = 0;

	announce("Device is woken up");
	fail_on_test(!poll_stable_power_status(node, me, la, CEC_OP_POWER_STATUS_ON, unresponsive_time));
	fail_on_test(interactive && !question("Is the device in On state?"));

	if (unresponsive_time > 0)
		warn("The device went correctly out of standby, but became unresponsive for %d s during the transition.\n",
		     unresponsive_time);

	return 0;
}
Beispiel #11
0
void BaseWindow::closeEvent(QCloseEvent *event)
{
    QMessageBox question(QMessageBox::Question, "Save Changes?", "Closing this window you may lose some of your changes to the configuration.\n\nWould you like to save before exiting?", (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel));
    int result = question.exec();

    if (result == QMessageBox::Cancel)
    {
        event->ignore();
    }
    else
    {
        if (result == QMessageBox::Yes)
        {
            QListWidgetItem *item = 0;
            item = this->ui->lstServers->currentItem();

            if (item != 0)
                this->updateServer(item); // Update any changes
            this->saveSettings(); // Save the config
            this->rebuildActions();
        }

        event->ignore();
        this->hide();
    }
}
void
ScriptEngine::sslErrorHandler( QNetworkReply* qnr, const QList<QSslError>& errlist )
{
    tDebug() << Q_FUNC_INFO;

    QByteArray digest = errlist.first().certificate().digest();
    int result = -1;

    if ( !TomahawkSettings::instance()->isSslCertKnown( digest ) )
    {
        foreach ( const QSslError& err, errlist )
            tDebug() << Q_FUNC_INFO << "SSL error:" << err;

        QMessageBox question( TomahawkUtils::tomahawkWindow() );
        question.setWindowTitle( tr( "SSL Error" ) );
        question.setText( tr( "You have asked Tomahawk to connect securely to <b>%1</b>, but we can't confirm that your connection is secure:<br><br>"
                            "<b>%2</b><br><br>"
                            "Do you want to trust this connection?" )
                            .arg( qnr->url().host() )
                            .arg( errlist.first().errorString() ) );

        question.setStandardButtons( QMessageBox::No );
        question.addButton( tr( "Trust certificate" ), QMessageBox::AcceptRole );

        result = question.exec();

        //FIXME: discuss whether we want to store rejects, too (needs settings management to remove the decision?)
        if ( result == QMessageBox::AcceptRole )
            TomahawkSettings::instance()->setSslCertTrusted( digest, result == QMessageBox::AcceptRole );
    }
void RemoteLogViewer::on_clearLogs_clicked()
{
    if ( question("删除聊天记录吗?"))
    {
        _qq->clearLogs(_uin);
        ui->textEdit->setText(QString::fromUtf8("暂无记录"));
    }
}
Beispiel #14
0
/*
********************************************************************************
*              PARSE THE DNS REPLY
*
* Description : This function parses the reply message from DNS server.
* Arguments   : dhdr - is a pointer to the header for DNS message
*               buf  - is a pointer to the reply message.
*               len  - is the size of reply message.
* Returns     : None
* Note        :
********************************************************************************
*/
uint8_t DNS::parseMSG(struct dhdr *pdhdr, uint8_t *pbuf)
{
    uint16_t tmp = 0;
    uint16_t i = 0;
    uint8_t *msg = 0;
    uint8_t *cp = 0;

    msg = pbuf;
    memset(pdhdr, 0, sizeof(pdhdr));

    pdhdr->id = ntohs(*((uint16_t *)&msg[0]));
    tmp = ntohs(*((uint16_t *)&msg[2]));
    if (tmp & 0x8000) pdhdr->qr = 1;

    pdhdr->opcode = (tmp >> 11) & 0xf;

    if (tmp & 0x0400) pdhdr->aa = 1;
    if (tmp & 0x0200) pdhdr->tc = 1;
    if (tmp & 0x0100) pdhdr->rd = 1;
    if (tmp & 0x0080) pdhdr->ra = 1;

    pdhdr->rcode = tmp & 0xf;
    pdhdr->qdcount = ntohs(*((uint16_t *)&msg[4]));
    pdhdr->ancount = ntohs(*((uint16_t *)&msg[6]));
    pdhdr->nscount = ntohs(*((uint16_t *)&msg[8]));
    pdhdr->arcount = ntohs(*((uint16_t *)&msg[10]));

    /* Now parse the variable length sections */
    cp = &msg[12];

    /* Question section */
    for (i = 0; i < pdhdr->qdcount; i++)
    {
        cp = question(msg, cp);
    }

    /* Answer section */
    for (i = 0; i < pdhdr->ancount; i++)
    {
        cp = answer(msg, cp);
    }

    /* Name server (authority) section */
    for (i = 0; i < pdhdr->nscount; i++)
    {
        ;
    }

    /* Additional section */
    for (i = 0; i < pdhdr->arcount; i++)
    {
        ;
    }

    if(pdhdr->rcode == 0) return 1;		// No error
    else return 0;
}
Beispiel #15
0
void Menu::DisplayError(const std::string & msg)
{
  play_error_sound();

  std::cerr << msg << std::endl;

  Question question(Question::WARNING);
  question.Set(msg, true, 0);
  question.Ask();
}
 void
 async_resolve (
     implementation_type &impl,
     const string & domain,
     const net::dns::type_t rrtype,
     CallbackHandler handler )
 {
   net::dns::question question(domain, rrtype);
   impl->async_resolve(question, handler);
 }
Beispiel #17
0
/* From pacman */
int yesno(const char *fmt, ...)
{
	int ret;
	va_list args;
	va_start(args, fmt);

	ret = question(1, fmt, args);
	printf("%s", color.nocolor);

	va_end(args);
	return ret;
}
Beispiel #18
0
bool
yesno(const char *fmt, ...)
{
	va_list ap;
	bool res;

	va_start(ap, fmt);
	res = question(1, fmt, ap);
	va_end(ap);

	return res;
}
Beispiel #19
0
    void Essay::fillAnswer()
    {
        EssayQuestion *qq = question();
        String answer(mEditor->document()->toPlainText().toStdString());

        if (answer == qq->filledAnswer()) {
            return;
        }

        qq->fill(answer);

        emit answerModified(qq);
    }
Beispiel #20
0
    void Essay::render(QWidget *widget)
    {
        EssayQuestion const* qq = question();
        QLayout *layout = widget->layout();
        mEditor = new qtCanvas::QTextEdit(widget);
        mEditor->setText(QString::fromStdString(qq->filledAnswer()));
        mEditor->setAcceptRichText(true);
        mEditor->setTabChangesFocus(true);
        layout->addWidget(mEditor);

        QObject::connect(mEditor, SIGNAL(editingFinished()),
                         this, SLOT(fillAnswer()));
    }
Beispiel #21
0
inline void pe_failure(const char *format, ...)
{
    va_list va;
    va_start(va, format);
    qstring question("AUTOHIDE REGISTRY\n");
    question.cat_vsprnt(format, va);
    question.append("\nDo you wish to continue?");
    if ( askyn_c(1, question.c_str()) != 1 )
    {
        loader_failure(NULL);
    }
    va_end(va);
}
Beispiel #22
0
void	sqlo::supquest(project *p, QString nameproject, int id)
{
	QSqlQuery qry;
	qry.prepare( "DELETE FROM project_" + nameproject + "_question WHERE id=?;" );
	qry.addBindValue(id);
	if( !qry.exec() )
		qDebug() << qry.lastError();
	else
	{
		qDebug() << "question delete success!";
	}
	p->listqgroup[p->listquestion[id].qgroupid].supquestion(id);
	p->listquestion[id] = question();
}
Beispiel #23
0
void UIPopupCenter::questionBinary(QWidget *pParent, const QString &strPopupPaneID,
                                   const QString &strMessage,
                                   const QString &strOkButtonText /*= QString()*/,
                                   const QString &strCancelButtonText /*= QString()*/,
                                   bool fProposeAutoConfirmation /*= false*/)
{
    question(pParent, strPopupPaneID,
             strMessage,
             AlertButton_Ok | AlertButtonOption_Default,
             AlertButton_Cancel | AlertButtonOption_Escape,
             strOkButtonText,
             strCancelButtonText,
             fProposeAutoConfirmation);
}
Beispiel #24
0
inline void project::addquestion(QString name, int group, int id, int qgroupid, QString sujet,
								 QString unit, int type, QString splitchar, int value, int ref_only,
								 bool global)
{
	if (id == -1)
	{
		id = sqlo::addquestion(this, name, group, unit, 0, sujet, qgroupid, type, ref_only, splitchar, value, global);
	}
	this->nbquestion++;
	question ret(name, group, id, qgroupid, sujet, unit, type, splitchar, value, ref_only, global);
    while ((int)this->listquestion.size() < id)
		this->listquestion.push_back(question());
	this->listquestion.push_back(ret);
}
Beispiel #25
0
// the important function
void KeyPTU::drive(void)
{
  // if the PTU isn't initialized, initialize it here... it has to be 
  // done here instead of above because it needs to be done when the 
  // robot is connected
  if (!myPTUInitRequested && !myPTU.isInitted() && myRobot->isConnected())
  {
    printf("\nWaiting for Camera to Initialize\n");
    myAbsolute = true;
    myPTUInitRequested = true;
    myPTU.init();
  }

  // if the camera hasn't initialized yet, then just return
  if (myPTUInitRequested && !myPTU.isInitted())
  {
    return;
  }

  if (myPTUInitRequested && myPTU.isInitted())
  {
    myPTUInitRequested = false;
    myPanSlew = myPTU.getPanSlew();
    myTiltSlew = myPTU.getTiltSlew();
    printf("Done.\n");
    question();
  }

  if (myExerciseTime.secSince() > 5 && myExercise)
  {
    int pan,tilt;

    if (ArMath::random()%2)
      pan = ArMath::random()%((int)myPTU.getMaxPosPan());
    else
      pan = -ArMath::random()%((int)myPTU.getMaxNegPan());

    if (ArMath::random()%2)
      tilt = ArMath::random()%((int)myPTU.getMaxPosTilt());
    else
      tilt = -ArMath::random()%((int)myPTU.getMaxNegTilt());

    myPTU.panTilt(pan, tilt);
    //printf("** %d\n", myRobot->getEstop());
    //printf("--> %x\n", myRobot->getFlags());
    myExerciseTime.setToNow();
  }

}
Beispiel #26
0
void interrogation_factory::submit_question()
{

    //  With no question options we can't have a question.
    //
    if( _cached_options.empty() || !_cached_dataset )
        return;

    //  Add the question to our interrogation.
    //
    _cached_interrogation->push_question( _cached_dataset, question( _cached_question, _cached_options ) );

    //
    _cached_options.clear();
}
Beispiel #27
0
int main ()
{
    int i;
    int sum;

    i = 0;
    sum = -58;

    while (i < 3){
        sum = sum + question(i);
        i = i + 1;
    }

    return sum;
}
Beispiel #28
0
void MainWindow::slotIndirectRequestReceived(ThunderPanel::IndirectRequestType type)
{
    if (type == ThunderPanel::RemoveTasks)
    {
        const QStringList & ids = tpanel->getSelectedTaskIDs();

        if (question ( tr("Remove selected %1 item(s)?").arg(ids.size())) )
            return;

        tcore->removeCloudTasks(ids);

    } else if (type == ThunderPanel::AddTask) {

    }
}
Beispiel #29
0
static int one_touch_play_view_on_wakeup(struct node *node, unsigned me, unsigned la, bool interactive,
					 __u8 opcode)
{
	fail_on_test(!util_interactive_ensure_power_state(node, me, la, interactive, CEC_OP_POWER_STATUS_STANDBY));

	int ret = one_touch_play_view_on(node, me, la, interactive, opcode);

	if (ret && ret != PRESUMED_OK)
		return ret;
	fail_on_test(interactive && !question("Did the TV turn on?"));

	if (interactive)
		return 0;
	else
		return PRESUMED_OK;
}
Beispiel #30
0
static vector<Level> launch_inference_threads(const vector<vector<clause_vector> > &clauses, const vector<DrtVect> &data,
		const path_memory &mem, Knowledge *k, double noise, int num_cycles, int trace, int num_level)
{
	// The question
	DrtPred question("--");
	inference_vector inference0(question, data, 1, num_level, clauses, mem, k);
	inference0.init();
	inference0.setNoise(noise);
	inference0.makeFeetStep(num_cycles, trace);
	vector<Level> tmpdata, retdata;

	tmpdata = inference0.getLastData();

	retdata.insert(retdata.end(), tmpdata.begin(), tmpdata.end());

	return retdata;
}