コード例 #1
0
ファイル: 3.c プロジェクト: wetosc/Travail-de-cours-SDA
void menu3()
{
    system("cls");
    printf("\n Choisisez le nombre de fichier a aficher:\n");
    printf("\n  1. "FILE1);
    printf("\n  2. "FILE2);
    printf("\n  3. "FILE3);
    printf("\n  4. "FILE_);
    printf("\n\n ");
    int choice;
    scanf("%d",&choice);
    printf("\n");
    switch(choice)
    {
    case 1:
        displayInfo(readInfo(FILE1));
        break;
    case 2:
        displayInfo(readInfo(FILE2));
        break;
    case 3:
        displayInfo(readInfo(FILE3));
        break;
    case 4:
        displayInfo(readInfo(FILE_));
        break;
    default:
        printf("Erreur. Revenez au menu principal.");
    }
    printf("\n\n");
    printf("\n  Tastez <Enter> pour revenir au menu principal.");
    getch();
    menu();
}
コード例 #2
0
void ServerWidget::startServer()
{
    if(socketServer->isListening())
        return;
    if(ui->portEdit->text().isEmpty())
        return;
    bool ok;
    int port = ui->portEdit->text().toInt(&ok);
    if(!ok)
        return;

    QString ip = ui->ipEdit->text();
    QHostAddress add;
    if(ip.isEmpty())
        ok = socketServer->listen(QHostAddress::Any, port);
    else if(!add.setAddress(ip))
    {
        displayInfo("Invalid IP Address!");
        return;
    }
    else
        ok = socketServer->listen(add, port);

    if(!ok)
        displayInfo(socketServer->errorString());
    else
    {
        displayInfo("Listening on "+socketServer->serverAddress().toString()+":"+QString::number(socketServer->serverPort()));
        ui->connectButton->setEnabled(false);
        ui->closeButton->setEnabled(true);
        ui->ipEdit->setEnabled(false);
        ui->portEdit->setEnabled(false);
    }
}
コード例 #3
0
ファイル: saucer.c プロジェクト: jsurya/saucer
void *animateSaucer(void *arg) {
	struct propset *info = arg;		/* point to info block	*/
	int	len = strlen(info->str)+2;	/* +2 for padding	*/
	int	col = 0;

	while(col+len < COLS && info->live == true) {
		usleep(info->delay*TUNIT);
		pthread_mutex_lock(&ufo_mx);
		moveHorizontal(info, col);
		info->col = col;
		pthread_mutex_unlock(&ufo_mx);
		col++;

	}
	pthread_mutex_lock(&esc_mx);
	if(info->live == true && !strcmp(info->str, "<--->")) {
		escaped++;
		displayInfo();
	}
	pthread_mutex_unlock(&esc_mx);
	info->live = false;
	strcpy(info->str, "     ");
	moveHorizontal(info, col);
	if (escaped >= 3) {
		displayInfo();
		endwin();
		exit(0);
	}
}
コード例 #4
0
void GameMainWindow::newGame()
{
  gameController = new GameController();
  startDialog = new StartDialog(this);

  this->setupConnections();

  if(startDialog->exec() == QDialog::Accepted)
    {
      gameBoard = new GameBoard(this);
        connect(gameController, SIGNAL(triggerPlanetLocate(Planet*, int, int)), gameBoard, SLOT(onAddPlanet(Planet*, int, int)));
	connect(gameBoard, SIGNAL(changeTurn()), gameController, SLOT(onChangeTurn()));
	connect(gameController, SIGNAL(displayControl(QString)), gameBoard, SLOT(onDisplayControl(QString)));
	connect(gameController, SIGNAL(displayInfo(QString)), gameBoard, SLOT(onDisplayInfo(QString)));
	connect(gameController, SIGNAL(displayShipNumber()), gameBoard, SLOT(onDisplayShipNumber()));
	connect(gameBoard, SIGNAL(setFleetShipNumber(int)), gameController, SLOT(onSetFleetShipNumber(int)));
	gameController->onStartGame();

	fleetAction->setEnabled(true);
	this->setCentralWidget(gameBoard);

      
    }
  else
    {
      delete gameController;
    }
}
コード例 #5
0
ファイル: mainwindow.cpp プロジェクト: allenh1/KedighCash
void MainWindow::findCash()
{
    QString searchInput;
    bool broke = false;
    searchInput = ui->serialInput->text();

    /** Now we bring up the second window
      to see where exactly the serial is found.
    **/

    for (int i = 0; i < kids.size(); i++)
    {
        KedighKid current = kids.at(i);
        for (int x = 0; x < current.cashOwned().size(); x++)
        {
            KedighCash toCheck = current.cashOwned().at(x);
            if (QString::compare(toCheck.getSerial(),  searchInput, Qt::CaseInsensitive) == 0)
            {
                //found the student!
                ui->studentSelect->setCurrentIndex(i);

                displayInfo();
                countCash();
                broke = true;
                break;
            }//end if

            if (broke)
                break;
        }//end for x.

        if (broke)
            break;
    }//end for i.
}//ya.
コード例 #6
0
ファイル: unerf.cpp プロジェクト: idkwim/xoreos-tools
int main(int argc, char **argv) {
    try {
        std::vector<Common::UString> args;
        Common::Platform::getParameters(argc, argv, args);

        Aurora::GameID game = Aurora::kGameIDUnknown;

        int returnValue = 1;
        Command command = kCommandNone;
        Common::UString archive;
        std::set<Common::UString> files;
        std::vector<byte> password;

        if (!parseCommandLine(args, returnValue, command, archive, files, game, password))
            return returnValue;

        Aurora::ERFFile erf(new Common::ReadFile(archive), password);

        if      (command == kCommandInfo)
            displayInfo(erf);
        else if (command == kCommandList)
            listFiles(erf, game);
        else if (command == kCommandListVerbose)
            listVerboseFiles(erf, game);
        else if (command == kCommandExtract)
            extractFiles(erf, game, files, kExtractModeStrip);
        else if (command == kCommandExtractSub)
            extractFiles(erf, game, files, kExtractModeSubstitute);

    } catch (...) {
        Common::exceptionDispatcherError();
    }

    return 0;
}
コード例 #7
0
ファイル: osgearth.cpp プロジェクト: Indianberries/LibrePilot
void OsgEarth::initialize()
{
    // TOOO not thread safe...
    if (initialized) {
        return;
    }
    initialized = true;

    qDebug() << "OsgEarth::initialize - initializing osgearth...";

    // increase cache (default is 300);
    // setenv("OSG_MAX_PAGEDLOD", "500", 0);

    // setenv("OSG_ASSIGN_PBO_TO_IMAGES", "on", 0);

    // Number of threads in the DatbasePager set up, inclusive of the number of http dedicated threads.
    osg::DisplaySettings::instance()->setNumOfDatabaseThreadsHint(6);
    osg::DisplaySettings::instance()->setNumOfHttpDatabaseThreadsHint(3);

    initializePathes();

    initWindowingSystem();

    initializeCache();

    // force early initialization of osgEarth capabilities
    // Doing this too early (before main window is displayed) causes rendering glitches (black holes)
    // Not sure why... See OSGViewport for when it is called (late...)
    osgEarth::Registry::capabilities();

    displayInfo();
}
コード例 #8
0
ファイル: unnds.cpp プロジェクト: Terentyev/xoreos-tools
int main(int argc, char **argv) {
	std::vector<Common::UString> args;
	Common::Platform::getParameters(argc, argv, args);

	int returnValue = 1;
	Command command = kCommandNone;
	Common::UString file;

	try {
		if (!parseCommandLine(args, returnValue, command, file))
			return returnValue;

		Aurora::NDSFile nds(new Common::ReadFile(file));

		if      (command == kCommandInfo)
			displayInfo(nds);
		else if (command == kCommandList)
			listFiles(nds);
		else if (command == kCommandExtract)
			extractFiles(nds);

	} catch (...) {
		Common::exceptionDispatcherError();
	}

	return 0;
}
コード例 #9
0
ファイル: RobotAgent.cpp プロジェクト: ci-group/monee
void RobotAgent::stepBehavior(Uint8* __keyboardStates) {
	_iterations++;

	// compute commands
	behaviorUpdate_remoteController(__keyboardStates);

	displayInfo();
}
コード例 #10
0
ファイル: verticeslist.cpp プロジェクト: Jigarsenjallia/Aztec
void VerticesList::sendInfo(QListWidgetItem* i) {
	Vertex* v = ((VertexItem*)i)->vertex;
	emit displayInfo(v);
	int x = (int)(v->x * 20.0f);
	int y = (int)(v->y * 20.0f);
	int z = (int)(v->z * 20.0f);
	emit setX(x);
	emit setY(y);
	emit setZ(z);
}
コード例 #11
0
ファイル: FileData.cpp プロジェクト: AGGA-IRIT/Radium-Engine
/// LOAD
void FileData::loadFile( const bool FORCE_RELOAD ) {
    if( isProcessed() && FORCE_RELOAD ) {
        std::string filename = getFileName();
        reset();
        setFileName( filename );
    }

    if( !isInitialized() ) {
        return;
    }

    // File extension check
    // - If we decide to deal with user-defined file, here we should check if we are dealing with one of them or not

    Assimp::Importer importer;
    const aiScene* scene = importer.ReadFile( getFileName(),
                                              aiProcess_Triangulate           | // This could/should be taken away if we want to deal with mesh types other than trimehses
                                              aiProcess_JoinIdenticalVertices |
                                              aiProcess_GenSmoothNormals      |
                                              aiProcess_SortByPType           |
                                              aiProcess_FixInfacingNormals    |
                                              aiProcess_CalcTangentSpace      |
                                              aiProcess_GenUVCoords );

    // File was not loaded
    if( scene == nullptr ) {
        LOG( logERROR ) << "Error while loading file \"" << getFileName() << "\" : " << importer.GetErrorString() << ".";
        return;
    }

    if( m_verbose ) {
        LOG(logINFO) << "File Loading begin...";
    }

    std::clock_t startTime;
    startTime = std::clock();

    AssimpGeometryDataLoader geometryLoader( Core::StringUtils::getDirName( getFileName() ), m_verbose );
    geometryLoader.loadData( scene, m_geometryData );

    AssimpHandleDataLoader handleLoader( m_verbose );
    handleLoader.loadData( scene, m_handleData );

    AssimpAnimationDataLoader animationLoader( m_verbose );
    animationLoader.loadData( scene, m_animationData );

    m_loadingTime = ( std::clock() - startTime ) / Scalar( CLOCKS_PER_SEC );

    if( m_verbose ) {
        LOG(logINFO) << "File Loading end.";
        displayInfo();
    }

    m_processed = true;
}
コード例 #12
0
void ServerWidget::closeServer()
{
    socketServer->close();
    while(socketServer->isListening())
        ;
    displayInfo("Socket Server Closed!");
    ui->connectButton->setEnabled(true);
    ui->closeButton->setEnabled(false);
    ui->ipEdit->setEnabled(true);
    ui->portEdit->setEnabled(true);
}
int main(void)
{
	unsigned int i;
	int sum = 0;
	int current = 0;
	int hgt_percent = 0;
	int degrees = 0;

	STATE = IDLE;


	initClock();
	initADC();
	initYaw();
	initMotorPin();
	initDisplay();
	intButton();
	initConsole();
	initPWMchan();
	initCircBuf (&g_inBuffer, BUF_SIZE);


	// Enable interrupts to the processor.
	IntMasterEnable();

	while (1)
	{
		//double dt = SysCtlClockGet() / SYSTICK_RATE_HZ;
		degrees = yawToDeg();


		// Background task: calculate the (approximate) mean of the values in the
		// circular buffer and display it.
		sum = 0;
		for (i = 0; i < BUF_SIZE; i++) {
			current = readCircBuf (&g_inBuffer);
			sum = sum + current;

		}
		int newHght = ADC_TO_MILLIS(sum/BUF_SIZE);
		if(initialRead != 0)
		{
			hgt_percent = calcHeight(initialRead, newHght);

		}
		if (STATE == FLYING || STATE == LANDING){
			PIDControl(hgt_percent, SysCtlClockGet() / SYSTICK_RATE_HZ);
			PWMPulseWidthSet (PWM_BASE, PWM_OUT_1, period * main_duty / 100);
			PWMPulseWidthSet (PWM_BASE, PWM_OUT_4, period * tail_duty / 100);
		}

		displayInfo((int)initialRead, hgt_percent, degrees);
	}
}
コード例 #14
0
/*
 * animates the saucer until it is shot or leaves the scream
 */
void *animateSaucer(void *arg) {
	struct saucer *ship = arg;
	int len = ship->length+2;
	//int col = 0;	/* might need to review this */

	while (1) {
		usleep(ship->delay*TUNIT);
	
		pthread_mutex_lock(&mx);	
		move(ship->row, ship->col);
		addch(' ');
		addstr(ship->message);
		addch(' ');
		move(LINES-1, COLS-1);
		refresh();	
		pthread_mutex_unlock(&mx);

		ship->col += 1;

		/*
		 * CODE REFERENCED FROM JAMES HODGSON
		 */
		if (ship->col + len >= COLS) {
			ship->message[len-1] = '\0';
			len = len-1;
		}

		if (ship->hit) {
			pthread_mutex_lock(&mx);
			move(ship->row, ship->col-1);
			addch(' ');
			addch(' ');
			addch(' ');
			addch(' ');
			addch(' ');
			addch(' ');
			move(LINES-1, COLS-1);
			refresh();
			pthread_mutex_unlock(&mx);
			break;
		}
		if (ship->col >= COLS) {
			pthread_mutex_lock(&escaped);
			noEscaped++;	
			pthread_mutex_unlock(&escaped);
			displayInfo();
			break;
		}
	}
	
	ship->isAlive = 0;
	pthread_exit(NULL);
}
コード例 #15
0
ファイル: dialog.cpp プロジェクト: code-cg/cgru
void Dialog::connectionEstablished()
{
    if( m_offlinescreen )
    {
        delete m_offlinescreen;
        m_offlinescreen = NULL;
    }
    displayInfo("Connection established.");
    m_connected = true;
    setDefaultWindowTitle();
//    m_qThreadSend.send( new af::Msg( af::Msg::TUserIdRequest, &m_mcuserhost, true));
}
コード例 #16
0
ファイル: RobotAgent.cpp プロジェクト: ci-group/monee
void RobotAgent::stepBehavior() {
	// update status
	_iterations++;

	if (_wm->_isAlive) // note: reviving a robot is performed in stepGenetics()
	{
		// compute commands
		_behavior->step();
	}

	displayInfo();
}
コード例 #17
0
int main (int argc, char **argv) {
    if (argc >= 3) {
        CodeData* Result = acEncodeFile (argv [1], argv [2]);

        if (Result != NULL)
            displayInfo (Result);
    } else {
        printf ("Invalid arguments.\n");
    }

    return 0;
}
コード例 #18
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: senderStringWrote((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
        case 1: receiverStringWrote((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
        case 2: on_receiverRegexpReplaceRemove_clicked(); break;
        case 3: on_receiverRegexpReplaceAdd_clicked(); break;
        case 4: on_senderRegexpReplaceRemove_clicked(); break;
        case 5: on_senderRegexpReplaceAdd_clicked(); break;
        case 6: on_receiverRegexpBlockRemove_clicked(); break;
        case 7: on_receiverRegexpBlockAdd_clicked(); break;
        case 8: on_senderRegexpBlockRemove_clicked(); break;
        case 9: on_senderRegexpBlockAdd_clicked(); break;
        case 10: on_connectButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 11: on_receiverDeleteItemButton_clicked(); break;
        case 12: on_forwardOnlyButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 13: on_receiverFollowButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 14: on_senderFollowButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 15: on_receiverPassAllButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 16: on_senderPassAllButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 17: on_senderDeleteItemButton_clicked(); break;
        case 18: on_receiverPassResponseButton_clicked(); break;
        case 19: on_receiverMessageList_itemSelectionChanged(); break;
        case 20: on_senderPassRequestButton_clicked(); break;
        case 21: on_receiverSyntaxHighlightCombo_currentIndexChanged((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 22: on_senderSyntaxHighlightCombo_currentIndexChanged((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 23: on_receiverConnectionOptionGroup_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 24: on_senderConnectionOptionGroup_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 25: on_senderMessageList_itemSelectionChanged(); break;
        case 26: displayInfo(); break;
        case 27: displayHelp(); break;
        case 28: saveSession(); break;
        case 29: loadSession(); break;
        case 30: displayErrorMessage((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 31: senderStringRead((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
        case 32: receiverStringRead((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
        case 33: senderStringWrite((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
        case 34: receiverStringWrite((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
        case 35: senderConnectionReady(); break;
        case 36: receiverConnectionReady(); break;
        case 37: senderConnectionNotReady(); break;
        case 38: receiverConnectionNotReady(); break;
        default: ;
        }
        _id -= 39;
    }
    return _id;
}
コード例 #19
0
ファイル: Box.cpp プロジェクト: TheNinthFox/foxbox
void Box::displayAdditionals(sf::RenderWindow& window)
{
    displayMarker(window);
    displayInfo(window);

    if(!hitNumberTimer.timeReached())
    {
        float posX = body->GetPosition().x * SCALE -10;
        float posY = body->GetPosition().y * SCALE - BOX_SIZE/2 -15;
        text_damageTaken.setPosition(posX, posY);
        window.draw(text_damageTaken);
    }
}
コード例 #20
0
ファイル: main.cpp プロジェクト: unloquer/GPS_ESP
void loop()
{
  // This sketch displays information every time a new sentence is correctly encoded.
  while (ss.available() > 0)
    if (gps.encode(ss.read()))
      displayInfo();

  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected: check wiring."));
    while(true);
  }
}
コード例 #21
0
ファイル: listitems.cpp プロジェクト: CGRU/cgru
void ListItems::operation( const std::string & i_operation)
{
	std::ostringstream str;
	std::vector<int> ids = getSelectedIds();
	if( ids.size() == 0 )
	{
		displayWarning("No items selected.");
		return;
	}
	af::jsonActionOperation( str, m_type, i_operation, "", ids);
	Watch::sendMsg( af::jsonMsg( str));

	displayInfo(QString("Operation: \"%1\".").arg( afqt::stoq( i_operation)));
}
コード例 #22
0
int main(int argc, char *argv[]) {
	system("clear");
	char buffer[MAXRCVLEN + 1];
	int len, mysocket;
	struct sockaddr_in dest; 
	mysocket = socket(AF_INET, SOCK_STREAM, 0);
	if(argv[1] == NULL) {
		printf("Enter Correct IP:");
		return;
	}
	memset(&dest, 0, sizeof(dest));                
	dest.sin_family = AF_INET;
	dest.sin_addr.s_addr = inet_addr(argv[1]);
	dest.sin_port = htons(PORTNUM);                 
	connect(mysocket, (struct sockaddr *)&dest, sizeof(struct sockaddr));
	char msg[3];
	printf("\t\t\t--------Welcome to LightBill Pay App-------\t\t");
	printf("\n\n\n");
	printf("\t\t\tEnter ID:");	
	scanf("%s", msg);
	allinfo a;
	system("clear");
	send(mysocket, msg, strlen(msg), 0); 
	len = recv(mysocket, &a, sizeof(a), 0);
	char y = displayInfo(a);
	if(y == 'y'){
		char atmno[16];
		send(mysocket, "hehe", 4, 0);
		printf("\n"); 
		printf("\t\t\tEnter your 14 no ATM:");
		scanf("%s", atmno);
		if(strlen(atmno) != 14) {
			printf("Enter Correct ATM no");
			return;
		}
		printf("\n");
		printf("\t\t\tEnter pin        :");
		char *c = getpass("");
		if(strlen(c) < 3) {
			printf("Enter Correct PIN no");
			return;
		}
		printf("\n\n");
		printf("\t\t\tPaid successfulyy");
	}
	printf("\n");
	close(mysocket);
	return EXIT_SUCCESS;
}
コード例 #23
0
//*********************************************************
bool wiznet::init()
{
	//set default server and port for debugging/testing
	IPAddress defaultServer(10,3,192,78);
	//IPAddress defaultServer(54,165,174,126); 
	server=defaultServer;
	port=8080;
	//initialise using manual settings 
	Serial.println("Initialising Ethernet...");
	Ethernet.begin(mac,ip,dnsip,gateway,subnet);
	//display relevant information : serial
	
	displayInfo();

}
コード例 #24
0
ファイル: GuiGame.cpp プロジェクト: RobinPetit/WizardPoker
void GuiGame::displayGame()
{
	// don't forget to lock the screen!
	std::lock_guard<std::mutex> _lock{_accessScreen};
	assert(std::this_thread::get_id() == _ownerId);

	displayHandCards();
	displaySelfBoard();
	displayOpponentBoard();
	displayInfo();

	updateGuiCardValues();

	refreshScreen();
}
コード例 #25
0
void FineControlGUI::display() {
	glClear(GL_COLOR_BUFFER_BIT);
	
	/*for(std::vector<Button*>::iterator i = buttons.begin();i != buttons.end();++i) {
		(*i)->draw();
	}*/

        //Draw Video Feeds to Screen
        for(std::vector<Video_Feed_Frame*>::iterator feed = videoScreens.begin(); feed != videoScreens.end(); ++feed)
		(*feed)->draw();
	
	drawFeedStatus();
	displayInfo();
	glutSwapBuffers();
}
コード例 #26
0
ファイル: dialog.cpp プロジェクト: code-cg/cgru
void Dialog::idReceived( int i_id, int i_uid)
{
	if( MonitorHost::id() > 0 )
	{
		if( i_id != MonitorHost::id())
		{
			connectionLost();
		}
	}
	else
	{
		if( i_id == 0)
		{
			connectionLost();
		}
		else
		{
			AFINFA("Dialog::idReceived: ID=%d UID=%d\n", i_id, i_uid)

			MonitorHost::connectionEstablished( i_id, i_uid);
			connectionEstablished();
			Watch::connectionEstablished();

			if( i_uid == -1 )
			{
				if( m_monitorType == Watch::WJobs )
				{
					ButtonMonitor::unset();
					closeList();
				}
				displayWarning("You are not exist.");
			}
			else
			{
				displayInfo("You have registered.");
				if( m_monitorType == Watch::WNONE )
				{
					ButtonMonitor::pushButton( Watch::WJobs);
				}
			}

			af::Msg * msg = new af::Msg( af::Msg::TMonitorUpdateId, i_id);
			m_qThreadClientUpdate.setUpMsg( msg);
		}
	}
}
コード例 #27
0
ファイル: main.c プロジェクト: VelocityLight/Posix-Thread-UI
/*
 * starts a rocket thread, and decrements the rockets left

 */
void shootRocket(int player) {
	int 	i;
	int 	col = getCannonCol(player);
		
	if (rocketsLeft > 0) {	
		rocketsLeft -= 1;
		displayInfo();
		for (i = 0; i < MAX_ROCKETS; i++) {
			if (rockets[i].isAlive == 0) {
				rockets[i].col = col;
				pthread_create(&rocketThreads[i], 
				    NULL, setupRocket, &rockets[i]);	
				break;
			}
		}
	}
			
}
コード例 #28
0
ファイル: listjobs.cpp プロジェクト: code-cg/cgru
void ListJobs::moveJobs( const std::string & i_operation)
{
	std::ostringstream str;
	std::vector<int> uids;
	uids.push_back( MonitorHost::getUid());
	af::jsonActionOperationStart( str, "users", i_operation, "", uids);
	std::vector<int> jids = getSelectedIds();
	str << ",\n\"jids\":[";
	for( int i = 0; i < jids.size(); i++)
	{
		if( i ) str << ',';
		str << jids[i];
	}
	str << "]";
	af::jsonActionOperationFinish( str);
	Watch::sendMsg( af::jsonMsg( str));
	displayInfo( afqt::stoq( i_operation));
}
コード例 #29
0
ファイル: mainwindow.cpp プロジェクト: allenh1/KedighCash
void MainWindow::removeCash()
{
    if (!m_loggedIn)
        return;

    int index = 0;
    int cash_index;
    cash_index = ui->cashListView->currentIndex().row();
    index = (int) ui->studentSelect->currentIndex();

    KedighKid current = kids.at(index);

    current.removeMoney(cash_index);
    kids.removeAt(index);
    kids.insert(index, current);
    displayInfo();
    countCash();
    checkForDoubles();
}
コード例 #30
0
ファイル: AuthWidget.C プロジェクト: bend/wt
void AuthWidget::processEnvironment()
{
  const WEnvironment& env = WApplication::instance()->environment();

  if (registrationEnabled_)
    if (handleRegistrationPath(env.internalPath()))
      return;

  std::string emailToken
    = model_->baseAuth()->parseEmailToken(env.internalPath());

  if (!emailToken.empty()) {
    EmailTokenResult result = model_->processEmailToken(emailToken);
    switch (result.result()) {
    case EmailTokenResult::Invalid:
      displayError(tr("Wt.Auth.error-invalid-token"));
      break;
    case EmailTokenResult::Expired:
      displayError(tr("Wt.Auth.error-token-expired"));
      break;
    case EmailTokenResult::UpdatePassword:
      letUpdatePassword(result.user(), false);
      break;
    case EmailTokenResult::EmailConfirmed:
      displayInfo(tr("Wt.Auth.info-email-confirmed"));
      User user = result.user();
      model_->loginUser(login_, user);
    }

    /*
     * In progressive bootstrap mode, this would cause a redirect w/o
     * session ID, losing the dialog.
     */
    if (WApplication::instance()->environment().ajax())
      WApplication::instance()->setInternalPath("/");

    return;
  }

  User user = model_->processAuthToken();
  model_->loginUser(login_, user, WeakLogin);
}