예제 #1
0
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
파일: guest.c 프로젝트: Monorail/Schoolwork
int main(){

    int numGuests, maxGuests,numPoss=0,highPri=0;//numPoss is the number of possible families able to go. highPri is the highest priority family able to go.
    int i,j = 0;

    FILE *fp;
    fp = fopen("allguests.txt","r");

    fscanf(fp,"%d %d",&numGuests,&maxGuests);

    int numPeople[numGuests];
    char first[numGuests][19], last[numGuests][19];
    int priority[numGuests];

    readInfo(fp,first,last,numPeople, priority,numGuests);
    //for (i = 0;i<10;i++)printf("%s, %s, %d, %d\n",last[i],first[i],numPeople[i],priority[i],numGuests);
    //printf("\n\n");
    seleSort(first, last, numPeople, priority, numGuests);
    //printf("capCheck = %d\n",capCheck(numPeople, priority,numGuests, maxGuests));
    highPri = capCheck(numPeople, priority,numGuests, maxGuests);

    for(i = 0;i < 10;i++){
        if (highPri>=priority[i])numPoss++;//determine number of families able to attend
    }
    //change array for surviving families
    maxGuests = 0;
    for (i = 0;i<numPoss;i++)maxGuests+=numPeople[i];//recalculates maxGuests to be the max number of guests on the final list
    alphaSort(first, last, numPeople, priority, numPoss);
    fileOut(first,last,numPeople,numPoss, maxGuests);
    return 0;
}
예제 #3
0
파일: structs8.c 프로젝트: jaime5x5/CSCD240
int main(){

	int x;
	student *array;
	array = (student *)calloc(2, sizeof(student));

	array[0].add = (address *)calloc(1, sizeof(address));
	array[0] = readInfo();

	printf("\nStudent 0:\n");
	printStudent(array[0]);

	// for x = 0; x < 1; x++)
	// {
	// 	if(array[x].name != NULL){
	// 		// free(stu1.name);
	// 		// stu1.name = (char *)NULL;
	// 		memset(array[x].name, 0, sizeof(array[x].name);
	// 	}

	// 	if(array[x].add.street != NULL){
	// 		memset(array[x].add.street, 0, sizeof(array[x].add.street));
	// 	}
	// }

	// if(array != NULL){
	// 	memset(array, 0, sizeof(array);
	// }

	return 0;
}
예제 #4
0
파일: Ini.cpp 프로젝트: 867344633/QService
void CIniFile::setFile(const char *pszFile)
{
    assert(NULL != pszFile);

    m_strFile = pszFile;
    readInfo();
}
예제 #5
0
파일: player.cpp 프로젝트: sisu/taisto
void Player::update(Server& s)
{
	while(socket->bytesAvailable()) {
		QDataStream is(socket);
		if (packetSize<0) {
			if (socket->bytesAvailable()<4) break;
			is>>packetSize;
		}
		if (socket->bytesAvailable()<packetSize) break;
		packetSize=-1;
		quint8 type;
		is>>type;
		switch(type) {
			case MSG_STATE:
				readState(is);
				break;
			case MSG_SHOOT:
				readShoot(is, s);
				break;
			case MSG_INFO:
				readInfo(is);
				break;
		    case MSG_CHAT:
		        readChat(is);
		        break;
			default:
				qDebug()<<type;
				abort();
		}
	}

	updatePhysics(s);
}
예제 #6
0
//------------------------------------------------------------------------------
MetaInfo BibleQuoteModule::readInfo(const QString &fileName)
{
    QFile file(fileName);
    if(!file.open(QIODevice::ReadOnly))
        return MetaInfo();
    return readInfo(file);
    return MetaInfo();
}
예제 #7
0
/** Update a data String */
void DataString::internalUpdate() {
  if (_dp->dataSource()) {
    _dp->dataSource()->writeLock();
    ReadInfo readInfo(&_value);
    _dp->dataSource()->string().read(_dp->_field, readInfo);
    _dp->dataSource()->unlock();
  }
}
예제 #8
0
// Loads the old save by constructing a new save containing the old save's data
bool SaveConverter_v4::load() {
	clear();

	uint32 varSize = SaveHandler::getVarSize(_vm);
	if (varSize == 0)
		return false;

	Common::InSaveFile *save;

	// Test if it's an old savd
	if (!isOldSave(&save) || !save)
		return false;

	displayWarning();

	SaveWriter writer(3, 0);

	SavePartInfo *info = readInfo(*save, kSlotNameLength, false);
	if (!info)
		return loadFail(0, 0, 0, save);

	SavePartVars *vars = readVars(*save, varSize, true);
	if (!vars)
		return loadFail(info, 0, 0, save);

	SavePartMem *props = readMem(*save, 256000, true);
	if (!props)
		return loadFail(info, vars, 0, save);

	// We don't need the save anymore
	delete save;

	// Write all parts
	if (!writer.writePart(0, info))
		return loadFail(info, vars, props, 0);
	if (!writer.writePart(1, vars))
		return loadFail(info, vars, props, 0);
	if (!writer.writePart(2, props))
		return loadFail(info, vars, props, 0);

	// We don't need those anymore
	delete info;
	delete vars;
	delete props;

	// Create the final read stream
	if (!createStream(writer))
		return loadFail(0, 0, 0, 0);

	return true;
}
void loadMap(char *fileName, struct clonePos **retList, struct hash **retHash)
/* Figure out file type and load it. */
{
char file[128], ext[64];
splitPath(fileName, NULL, file, ext);
if (startsWith("info", file))
    return readInfo(fileName, retList, retHash);
else if (startsWith("mmBarge", file))
    return readMmBarge(fileName, retList, retHash);
else if (startsWith("gold", file) || sameString(".agp", ext))
    return readGold(fileName, retList, retHash);
else if (sameString(".gl", ext) || sameString("gl", file))
    return readGl(fileName, retList, retHash);
else
    errAbort("Unrecognized file type %s%s", file, ext);
}
예제 #10
0
파일: mediainfo.cpp 프로젝트: jeyboy/palyo2
MediaInfo::MediaInfo(QString filepath, bool onlyTags) {
    readed = false;
    fileName = filepath.toStdWString();
    TagLib::FileRef f(fileName.c_str(), !onlyTags, onlyTags ? TagLib::AudioProperties::Fast : TagLib::AudioProperties::Accurate);

    if (!f.isNull()) {
        size = f.file() -> length();
        readed = true;
        artist = QString::fromStdWString(f.tag() -> artist().toWString());
        title = QString::fromStdWString(f.tag() -> title().toWString());
        album = QString::fromStdWString(f.tag() -> album().toWString());
        genre = QString::fromStdWString(f.tag() -> genre().toWString());
        year = f.tag() -> year();
        track = f.tag() -> track();

        if (!onlyTags)
            readInfo(f);
    }
}
예제 #11
0
//------------------------------------------------------------------------------
void BibleQuoteModule::parseModule(QString pathToModule)
{
    //    myDebug() << "Parse module: " << pathToModule;
    MetaInfo parseInfo = readInfo(pathToModule);
    loadBibleData(1, pathToModule);
    //    myDebug() << readInfo(pathToModule).name() << readInfo(pathToModule).shortName();

    QDir d;
    d = QDir(QString(Config::configuration()->getDataPath() + GL_MODULE_PATH +  "%1/" + parseInfo.shortName()).arg(m_typeModule.toLower()));

    if (!d.exists())
    {
        //        emit SIGNAL_CreateFolderForModule(parseInfo.shortName());
        QDir dir;
        dir.mkpath(QString(Config::configuration()->getDataPath() + GL_MODULE_PATH + "%1/" + parseInfo.shortName()).arg(m_typeModule.toLower()));

        if (createIniFile(parseInfo))
        {
            createBookFiles(pathToModule);

            if (!m_bibleType)
            {
                addToListBookModule(parseInfo.shortName());
            }
            else
            {
                addToListBibleModule(parseInfo.shortName());
            }
        }
        else
        {
            myWarning() << "this module is created";
        }
    }
    else
    {
        //        myDebug() << "This module is exist";
    }

}
예제 #12
0
파일: mark.c 프로젝트: pyrovski/Adagio
int writetrace(unsigned long pc, const char* call)
{
  double opr, oprT;   
    static unsigned long long opsT, refsT;
  unsigned long long ops, refs, tlb_miss, branch_miss;
  double tm;
  char buff[80];
    int i;
  if(TRACE_OPM && (RANK==NODE0 || RANK==NODE2))
    {
        //if(strlen(call) >= 4 && strncmp(call, "MARK", 4) == 0)
        ops = refs = tlb_miss = branch_miss = 0;
        if(strncmp(call, "MARK", 4) == 0 || call[strlen(call)-1] == '1')
        for(i=0;i<num_trace_points;i++)
        {
            if(tracepoint[i] == pc)
            {
                readInfo(2, info);
                ops  = info->counters[0];
                refs = info->counters[1];
                break;
            }
        }
      tm=timer();    
      opsT += ops;
      refsT += refs;

      opr = refs==0 ? 1000 : ((double)ops)/refs;
      oprT = refsT==0 ? 1000 : ((double)opsT)/refsT;
      sprintf(buff, "%lu %s %0.6f %d %llu %llu\n", pc, call, tm, current_gear, ops, refs);

      //printf("%d: opr %5g (%5g) cyc %llu gear %d\n", marker, opr,oprT,info->cycles, whatGear());
      //sprintf(buff,"%lu %s %0.6f %d %d %d\n", *pc, call, *tm, *gear, *uops, *misses);
      if(TRACE_OPM)
	      write_to_file(buff,strlen(buff));
    }
}
예제 #13
0
void DataString::reset() {
  ReadInfo readInfo(&_value);
  _dp->dataSource()->string().read(_dp->_field, readInfo);
}
예제 #14
0
void myOpenDialog::on_version_activated(int index)
{
    readInfo(myNets, ui->name->itemText(ui->name->currentIndex()), ui->version->itemText(index));
    ui->version->setCurrentIndex(index);
}
예제 #15
0
int main()
{
	const int max = 250;
	Class mike[max];
	char c;
	int n;
	int id;
	int cred;
	int mid;
	int high;
	int i = 0;
	int j = 0;
	int low = 0;
	int small = 0;
	Class tmp;
	readInfo(mike, n);
	cout << "\nsorted student data\n\nid courses credit\n\n";
	// sort section
	for(i=0; i < n-1; i++){
			small = i;
		for(j=i+1; j < n; j++)
			if(mike[j] < mike[small])
				small = j;
				tmp = mike[i];
				mike[i] = mike[small];
				mike[small] = tmp;
	}
	for(i=0; i < n; i++)
		cout << mike[i] << '\n';
	cout << "\nenter commands, exit with x\n?> ";
	cin >> c;
	// command section
	while (c != 'x'){
	// help section
		if(c == 'h'){
			cout << "\nthis program responds to the";
			cout << " following "; 
			cout << "commmands\n\na id credits -- adds course of";
			cout << " given credits for students\nd id credits ";
			cout << "-- drops course of given credits for "; 
			cout << "students\n";
			cout << "h -- prints this help message\n";
			cout << "x -- causes program to terminate\n\n";
			}
	// add and drop section
		if(c == 'a' || c == 'd'){
			cin >> id >> cred;
			low = 0;
			high = n - 1;
			mid = (low + high)/2;
			while(low <= high && mike[mid] != id){ 
			    if(mike[mid] < id)
				low = mid + 1;
			    else
				high = mid - 1;
		        	mid = (low + high)/2;
			}
			if(low <= high){
		  		if(c == 'a')
					mike[mid].add(cred);
				else
					mike[mid].drop(cred);
			}
			else{	
				cout << "  *** no student with";
				cout << " id [" << id << "]\n";
		}}
		if(c != 'h' && c != 'a' && c != 'd'){
			cout << "  *** bad command [" << c; 
			cout << "] - ignored\n";
			cin >> cred >> id;	
		}
예제 #16
0
// Loads the old save by constructing a new save containing the old save's data
bool SaveConverter_v3::load() {
	clear();

	uint32 varSize = SaveHandler::getVarSize(_vm);
	if (varSize == 0)
		return false;

	Common::InSaveFile *save;

	int type = isOldSave(&save);

	// Test if it's an old savd
	if ((type == 0) || !save)
		return false;

	displayWarning();

	bool screenShot;
	uint32 screenShotWidth;
	uint32 screenShotHeight;

	getScreenShotProps(type, screenShot, screenShotWidth, screenShotHeight);

	SaveWriter writer(screenShot ? 3 : 2, 0);

	SavePartInfo *info = readInfo(*save, kSlotNameLength, false);
	if (!info)
		return loadFail(0, 0, 0, save);

	SavePartVars *vars = readVars(*save, varSize, true);
	if (!vars)
		return loadFail(info, 0, 0, save);

	if (screenShot) {
		SavePartSprite *sprite = readSprite(*save, screenShotWidth, screenShotHeight, true);

		if (!sprite)
			return loadFail(info, vars, 0, save);

		if (!writer.writePart(2, sprite))
			return loadFail(info, vars, sprite, save);

		delete sprite;
	}

	// We don't need the save anymore
	delete save;

	// Write all parts
	if (!writer.writePart(0, info))
		return loadFail(info, vars, 0, 0);
	if (!writer.writePart(1, vars))
		return loadFail(info, vars, 0, 0);

	// We don't need those anymore
	delete info;
	delete vars;

	// Create the final read stream
	if (!createStream(writer))
		return loadFail(0, 0, 0, 0);

	return true;
}
void
TestCaseSandboxResultDecoderImpl::
handleInfo()
{
    addCaseInfo(readInfo());
}
예제 #18
0
int main (int argc, char **argv)
{
	struct LinkList ll; 
	struct SetCliques scl;
	struct LinProg lp; 
	struct Problem prob; 
	int effort; 

	if (argc < 8 || argc > 13) {
		printf ("Usage: %s <link file> <effort> <output format> <output filename> <random seed> <obj type> <lambda> (<clique input file> <lossFile> <epsilon> <routeFile> <flow LB file>)\n", argv[0]);
		exit(-1);
	}

	// read in problem: i.e. single/multipath and list of sources and destinations
	readInfo(argv[1], &ll, &prob); 
	
	// how much effort; 
	effort = atoi(argv[2]); 

	// what output format
	lp.opform = atoi(argv[3]);

        // Lili added: by default, no constant variables 
        lp.const_var = 0;

        // Lili added: by default, no variable lower bounds
        lp.var_LBs = 0;
        
	//Modeified by Yi Li to be consistent with lowerbound
	//if ((prob.multipath == 0) && (lp.opform != OPFORM_LPSOLVE)) {
	if ((prob.multipath == 0) && ((lp.opform == OPFORM_MATLAB_SPARSE)||(lp.opform == OPFORM_MATLAB))) {
		printf ("matlab can not solve single path problem\n");
		exit(-1); 
	}

	if (ll.ifmodel != IFMODEL_PROTO) {
		printf ("upper bound for physical model not implemented yet\n");
		exit(1);
	}

	srand(atoi(argv[5]));

        if (strcmp(argv[8], "NULL") == 0) {
          // find cliques, making a certain number of attempts
          findCliques (ll, &scl, effort);
          prob.clique_const_type = CLIQUE_OPT_SCHEDULE;
        }
        else {
          // read cliques from input file argv[7]
          readCliques(argv[8], ll, &scl);
          prob.clique_const_type = CLIQUE_802_11;
        }
        
	//printCliques (scl);
	
	// open the files needed for output
	OpenFiles (&(lp.fp), lp.opform, argv[4]); 

                        
	// generate the linear program
        prob.obj_type = atoi(argv[6]);
        prob.lambda = atof(argv[7]);
        
        if (argc >= 10)
          readLoss(argv[9], &ll);

        if (argc >= 11)
          prob.epsilon = atof(argv[10]);

        if (argc >= 12)
          readRoute(argv[11], prob, ll, &lp);

        if (argc == 13)
          readFlowLowerBound(argv[12], prob, ll, &lp);
        
	genUpperBoundLinProg (ll, scl, prob, &lp);

	// close output files 
	CloseFiles (&(lp.fp), lp.opform); 
	return 0;
}
예제 #19
0
파일: mediainfo.cpp 프로젝트: jeyboy/palyo2
void MediaInfo::initInfo() {
    TagLib::FileRef f(fileName.c_str(), true, TagLib::AudioProperties::Accurate);
    readInfo(f);
}
예제 #20
0
InteHomeFurn::InteHomeFurn(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::InteHomeFurn)
{
    ui->setupUi(this);
    this->setWindowFlags(Qt::FramelessWindowHint);

    QPixmap pixmap;
    pixmap.load(":/images/intehomefurn/1.png");
    QPalette p(palette());
    p.setBrush(QPalette::Window,QBrush(pixmap));
    setPalette(p);

    pixmap1.load(":/images/inteagri/30.png");
    pixmap2.load(":/images/inteagri/31.png");

    pixmap.load(":/images/intehomefurn/01.png");
    ui->toolButton->setIcon(pixmap);
    ui->toolButton->setIconSize(pixmap.size());
    ui->toolButton->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/02.png");
    ui->toolButton_2->setIcon(pixmap);
    ui->toolButton_2->setIconSize(pixmap.size());
    ui->toolButton_2->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/03.png");
    ui->toolButton_3->setIcon(pixmap);
    ui->toolButton_3->setIconSize(pixmap.size());
    ui->toolButton_3->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/04.png");
    ui->toolButton_4->setIcon(pixmap);
    ui->toolButton_4->setIconSize(pixmap.size());
    ui->toolButton_4->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/05.png");
    ui->toolButton_5->setIcon(pixmap);
    ui->toolButton_5->setIconSize(pixmap.size());
    ui->toolButton_5->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/06.png");
    ui->toolButton_6->setIcon(pixmap);
    ui->toolButton_6->setIconSize(pixmap.size());
    ui->toolButton_6->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/07.png");
    ui->toolButton_7->setIcon(pixmap);
    ui->toolButton_7->setIconSize(pixmap.size());
    ui->toolButton_7->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/08.png");
    ui->toolButton_9->setIcon(pixmap);
    ui->toolButton_9->setIconSize(pixmap.size());
    ui->toolButton_9->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/0010.png");
    ui->toolButton_8->setIcon(pixmap);
    ui->toolButton_8->setIconSize(pixmap.size());
    ui->toolButton_8->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/011.png");
    ui->P1_openTB->setIcon(pixmap);
    ui->P1_openTB->setIconSize(pixmap.size());
    ui->P1_openTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/012.png");
    ui->P1_closeTB->setIcon(pixmap);
    ui->P1_closeTB->setIconSize(pixmap.size());
    ui->P1_closeTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/021.png");
    ui->P2_openTB->setIcon(pixmap);
    ui->P2_openTB->setIconSize(pixmap.size());
    ui->P2_openTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/022.png");
    ui->P2_closeTB->setIcon(pixmap);
    ui->P2_closeTB->setIconSize(pixmap.size());
    ui->P2_closeTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/023.png");
    ui->P2_addsoundTB->setIcon(pixmap);
    ui->P2_addsoundTB->setIconSize(pixmap.size());
    ui->P2_addsoundTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/024.png");
    ui->P2_redusoundTB->setIcon(pixmap);
    ui->P2_redusoundTB->setIconSize(pixmap.size());
    ui->P2_redusoundTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/025.png");
    ui->P2_AVtypeTB->setIcon(pixmap);
    ui->P2_AVtypeTB->setIconSize(pixmap.size());
    ui->P2_AVtypeTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/026.png");
    ui->P2_addchannelTB->setIcon(pixmap);
    ui->P2_addchannelTB->setIconSize(pixmap.size());
    ui->P2_addchannelTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/027.png");
    ui->P2_reduchannelTB->setIcon(pixmap);
    ui->P2_reduchannelTB->setIconSize(pixmap.size());
    ui->P2_reduchannelTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/031.png");
    ui->P3_openTB->setIcon(pixmap);
    ui->P3_openTB->setIconSize(pixmap.size());
    ui->P3_openTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/032.png");
    ui->P3_closeTB->setIcon(pixmap);
    ui->P3_closeTB->setIconSize(pixmap.size());
    ui->P3_closeTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/033.png");
    ui->P3_windspeedTB->setIcon(pixmap);
    ui->P3_windspeedTB->setIconSize(pixmap.size());
    ui->P3_windspeedTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/034.png");
    ui->P3_winddireTB->setIcon(pixmap);
    ui->P3_winddireTB->setIconSize(pixmap.size());
    ui->P3_winddireTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/041.png");
    ui->P4_openTB->setIcon(pixmap);
    ui->P4_openTB->setIconSize(pixmap.size());
    ui->P4_openTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/042.png");
    ui->P4_closeTB->setIcon(pixmap);
    ui->P4_closeTB->setIconSize(pixmap.size());
    ui->P4_closeTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/043.png");
    ui->P4_presetTB->setIcon(pixmap);
    ui->P4_presetTB->setIconSize(pixmap.size());
    ui->P4_presetTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/044.png");
    ui->P4_windspeedTB->setIcon(pixmap);
    ui->P4_windspeedTB->setIconSize(pixmap.size());
    ui->P4_windspeedTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/045.png");
    ui->P4_winddireTB->setIcon(pixmap);
    ui->P4_winddireTB->setIconSize(pixmap.size());
    ui->P4_winddireTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/051.png");
    ui->P5_openTB->setIcon(pixmap);
    ui->P5_openTB->setIconSize(pixmap.size());
    ui->P5_openTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/052.png");
    ui->P5_closeTB->setIcon(pixmap);
    ui->P5_closeTB->setIconSize(pixmap.size());
    ui->P5_closeTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/053.png");
    ui->P5_addsoundTB->setIcon(pixmap);
    ui->P5_addsoundTB->setIconSize(pixmap.size());
    ui->P5_addsoundTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/054.png");
    ui->P5_redusoundTB->setIcon(pixmap);
    ui->P5_redusoundTB->setIconSize(pixmap.size());
    ui->P5_redusoundTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/061.png");
    ui->P6_oporclTB->setIcon(pixmap);
    ui->P6_oporclTB->setIconSize(pixmap.size());
    ui->P6_oporclTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/062.png");
    ui->P6_addsoundTB->setIcon(pixmap);
    ui->P6_addsoundTB->setIconSize(pixmap.size());
    ui->P6_addsoundTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/063.png");
    ui->P6_redusoundTB->setIcon(pixmap);
    ui->P6_redusoundTB->setIconSize(pixmap.size());
    ui->P6_redusoundTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/064.png");
    ui->P6_intooroutTB->setIcon(pixmap);
    ui->P6_intooroutTB->setIconSize(pixmap.size());
    ui->P6_intooroutTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/065.png");
    ui->P6_playorpauseTB->setIcon(pixmap);
    ui->P6_playorpauseTB->setIconSize(pixmap.size());
    ui->P6_playorpauseTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/066.png");
    ui->P6_fastforwardTB->setIcon(pixmap);
    ui->P6_fastforwardTB->setIconSize(pixmap.size());
    ui->P6_fastforwardTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/067.png");
    ui->P6_rewindTB->setIcon(pixmap);
    ui->P6_rewindTB->setIconSize(pixmap.size());
    ui->P6_rewindTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/0004.png");
    ui->equipopenTB->setIcon(pixmap);
    ui->equipopenTB->setIconSize(pixmap.size());
    ui->equipopenTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/0005.png");
    ui->equipcloseTB->setIcon(pixmap);
    ui->equipcloseTB->setIconSize(pixmap.size());
    ui->equipcloseTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/0006.png");
    ui->equipstopTB->setIcon(pixmap);
    ui->equipstopTB->setIconSize(pixmap.size());
    ui->equipstopTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/007.png");
    ui->addlightTB->setIcon(pixmap);
    ui->addlightTB->setIconSize(pixmap.size());
    ui->addlightTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/008.png");
    ui->redulightTB->setIcon(pixmap);
    ui->redulightTB->setIconSize(pixmap.size());
    ui->redulightTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/1001.png");
    ui->powerOpenTB1->setIcon(pixmap);
    ui->powerOpenTB1->setIconSize(pixmap.size());
    ui->powerOpenTB1->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    ui->powerOpenTB2->setIcon(pixmap);
    ui->powerOpenTB2->setIconSize(pixmap.size());
    ui->powerOpenTB2->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/1002.png");
    ui->powerCloseTB1->setIcon(pixmap);
    ui->powerCloseTB1->setIconSize(pixmap.size());
    ui->powerCloseTB1->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    ui->powerCloseTB2->setIcon(pixmap);
    ui->powerCloseTB2->setIconSize(pixmap.size());
    ui->powerCloseTB2->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/2.png");
    ui->label_7->setPixmap(pixmap);
    pixmap.load(":/images/intehomefurn/3.png");
    ui->label_8->setPixmap(pixmap);
    pixmap.load(":/images/intehomefurn/4.png");
    ui->label_9->setPixmap(pixmap);
    pixmap.load(":/images/intehomefurn/5.png");
    ui->label_10->setPixmap(pixmap);
    pixmap.load(":/images/intehomefurn/6.png");
    ui->label_11->setPixmap(pixmap);
    pixmap.load(":/images/intehomefurn/7.png");
    ui->label_12->setPixmap(pixmap);

    fengshanStatus=false;
    yuyinStatus=false;

    ui->label->setVisible(false);
    ui->label_2->setVisible(false);
    ui->label_3->setVisible(false);
    ui->label_4->setVisible(false);
    ui->label_5->setVisible(false);
    ui->label_6->setVisible(false);

    pixmap.load(":/images/inteagri/30.png");
    ui->pix1Label->setScaledContents(true);
    ui->pix1Label->setPixmap(pixmap);
    ui->pix2Label->setScaledContents(true);
    ui->pix2Label->setPixmap(pixmap);
    ui->pix3Label->setScaledContents(true);
    ui->pix3Label->setPixmap(pixmap);
    ui->pix4Label->setScaledContents(true);
    ui->pix4Label->setPixmap(pixmap);
    ui->pix5Label->setScaledContents(true);
    ui->pix5Label->setPixmap(pixmap);
    ui->pix6Label->setScaledContents(true);
    ui->pix6Label->setPixmap(pixmap);
    ui->pix7Label->setScaledContents(true);
    ui->pix7Label->setPixmap(pixmap);
    ui->pix8Label->setScaledContents(true);
    ui->pix8Label->setPixmap(pixmap);
    ui->pix9Label->setScaledContents(true);
    ui->pix9Label->setPixmap(pixmap);
    ui->pix10Label->setScaledContents(true);
    ui->pix10Label->setPixmap(pixmap);
    ui->pix11Label->setScaledContents(true);
    ui->pix11Label->setPixmap(pixmap);
    ui->pix12Label->setScaledContents(true);
    ui->pix12Label->setPixmap(pixmap);
    ui->pix13Label->setScaledContents(true);
    ui->pix13Label->setPixmap(pixmap);
    ui->pix14Label->setScaledContents(true);
    ui->pix14Label->setPixmap(pixmap);
    ui->pix15Label->setScaledContents(true);
    ui->pix15Label->setPixmap(pixmap);
    ui->pix16Label->setScaledContents(true);
    ui->pix16Label->setPixmap(pixmap);
    ui->pix17Label->setScaledContents(true);
    ui->pix17Label->setPixmap(pixmap);
    ui->pix18Label->setScaledContents(true);
    ui->pix18Label->setPixmap(pixmap);

    pixmap.load(":/images/intehomefurn/off.png");
    ui->fengshanLabel->setScaledContents(true);
    ui->fengshanLabel->setPixmap(pixmap);

    ui->yuyinLabel->setScaledContents(true);
    ui->yuyinLabel->setPixmap(pixmap);

    ui->sunLineEdit->setReadOnly(true);
    ui->sunLineEdit->setAlignment(Qt::AlignRight);
    ui->sunLineEdit->setMaxLength(15);

    ui->tempLineEdit->setReadOnly(true);
    ui->tempLineEdit->setAlignment(Qt::AlignRight);
    ui->tempLineEdit->setMaxLength(15);

    ui->humLineEdit->setReadOnly(true);
    ui->humLineEdit->setAlignment(Qt::AlignRight);
    ui->humLineEdit->setMaxLength(15);

    ui->sunLineEdit->setText("0");
    ui->tempLineEdit->setText("0");
    ui->humLineEdit->setText("0");

    for(int i=0;i<3;i++)
        changeNum[i]=false;

    for(int i=0;i<4;i++)
        countNum[i]=0;

    initval=0x40;
    countSMG=0;

    FsunPreVal=20;
    FtempPreVal=20;
    FhumPreVal=20;

    LEDStatus=false;
    SMGStatus=false;
    power1Status=false;
    power2Status=false;

    ui->pagelabel1->setVisible(false);
    ui->pagelabel2->setVisible(false);
    ui->pagelabel3->setVisible(false);
    ui->pagelabel4->setVisible(false);
    ui->pagelabel5->setVisible(false);
    ui->pagelabel6->setVisible(false);

    ui->sunValLabel1->setText(QString::number(FsunPreVal));
    ui->tempValLabel1->setText(QString::number(FtempPreVal));
    ui->humValLabel1->setText(QString::number(FhumPreVal));
    ui->sunValLabel6->setText(QString::number(FsunPreVal));
    ui->tempValLabel6->setText(QString::number(FtempPreVal));
    ui->humValLabel6->setText(QString::number(FhumPreVal));

    connect(ui->sunLineEdit,SIGNAL(selectionChanged()),this,SLOT(lineClick1()));
    connect(ui->tempLineEdit,SIGNAL(selectionChanged()),this,SLOT(lineClick2()));
    connect(ui->humLineEdit,SIGNAL(selectionChanged()),this,SLOT(lineClick3()));

    m_timer=new QTimer(this);
    connect(m_timer,SIGNAL(timeout()),this,SLOT(readInfo()));
//    m_timer->start(2000);
    
    vKey=new VKey(this);
    ui->stackedWidget->setCurrentIndex(0);

    fan_pix[0].load(":/images/fan/f1.png");
    fan_pix[1].load(":/images/fan/f2.png");
    fan_pix[2].load(":/images/fan/f3.png");
    fan_pix[3].load(":/images/fan/f4.png");
    fan_pix[4].load(":/images/fan/f5.png");
    fan_pix[5].load(":/images/fan/f6.png");
    fan_pix[6].load(":/images/fan/f7.png");
    fan_pix[7].load(":/images/fan/f8.png");
    ui->fengshanLabel->setPixmap(fan_pix[0]);
    fan_timer =  new QTimer(this);
    connect(fan_timer,SIGNAL(timeout()),this,SLOT(runFan()));
//    fan_timer->start(250);
    fan_count=-1;
}
예제 #21
0
bool Server::init(cgicc::Cgicc cgicc) {
    std::cout << "Access-Control-Allow-Origin: \"*\"\r\n";

    serverReceiveImageTime = timestamp_usec();

    //gets the fields of the request
    cgicc::form_iterator fiImage = cgicc.getElement("image");
    cgicc::form_iterator fiScreenWidthPixel = cgicc.getElement("screenWidthPixel");
    cgicc::form_iterator fiScreenHeightPixel = cgicc.getElement("screenHeightPixel");
    cgicc::form_iterator fiNumSnapshot = cgicc.getElement("numSnapshot");
    cgicc::form_iterator fiSnapshotType = cgicc.getElement("snapshotType");
    cgicc::form_iterator fiIsBoundingBox = cgicc.getElement("isBoundingBox");
    //    cgicc::form_iterator fiSeed = cgicc.getElement("seed");
    //    cgicc::form_iterator fiToken = cgicc.getElement("token");
    //    cgicc::form_iterator fiSessionName = cgicc.getElement("sessionName");
    cgicc::form_iterator fiOldIp = cgicc.getElement("ip");
    if (((fiImage != (*cgicc).end()) && (!fiImage->isEmpty()))
            && ((fiScreenWidthPixel != (*cgicc).end()) && (!fiScreenWidthPixel->isEmpty()))
            && ((fiScreenHeightPixel != (*cgicc).end()) && (!fiScreenHeightPixel->isEmpty()))
            && ((fiNumSnapshot != (*cgicc).end()) && (!fiNumSnapshot->isEmpty()))
            && ((fiSnapshotType != (*cgicc).end()) && (!fiSnapshotType->isEmpty()))
            && ((fiIsBoundingBox != (*cgicc).end()) && (!fiIsBoundingBox->isEmpty()))
            //            && ((fiSeed != (*cgicc).end()) && (!fiSeed->isEmpty()))
            //            && ((fiToken != (*cgicc).end()) && (!fiToken->isEmpty()))
            //            && ((fiSessionName != (*cgicc).end()))
            && ((fiOldIp != (*cgicc).end()))
            ) {

        //TODO: if the diff flag is true, use the difference construction of the image
        //      using the rules in the .js file

        std::string stringUrlImage = (**fiImage);
        const char * urlImage = stringUrlImage.c_str();

        if (strlen(urlImage) > 4) {
            char * imageDecoded;

            //if the url has not the "data:" in the firsts characters, probably is because isn't decoded
            if (urlImage[4] != ':') {
                imageDecoded = CGI_decode_url(urlImage);
            }
            else {
                imageDecoded = new char[stringUrlImage.size() + 1];
                copy(stringUrlImage.begin(), stringUrlImage.end(), imageDecoded);
                imageDecoded[stringUrlImage.size()] = '\0';
            }

            //find the comma that splits the header of the url image, to the data of the image
            int iPreviousComma = -1;
            int strlenImageDecoded = strlen(imageDecoded);
            for (int i = 0; i < strlenImageDecoded; i++) {
                if (imageDecoded[i] == ',') {
                    iPreviousComma = i + 1;
                    break;
                }
            }

            if (iPreviousComma > -1) {
                //takes the data of the image
                char imageDecodeWithoutContent[strlenImageDecoded - iPreviousComma];
                for (int i = iPreviousComma, j = 0; i < strlenImageDecoded; i++, j++) {
                    imageDecodeWithoutContent[j] = imageDecoded[i];
                }

                //convert the url image in a byte array
                std::vector<BYTE> imageByteArray = base64_decode(imageDecodeWithoutContent);

                //convert the byte array in a Mat
                cv::Mat image = cv::imdecode(imageByteArray, CV_LOAD_IMAGE_COLOR);


                /*SAVE THE IMAGE*/
                long long now = timestamp_usec();
                std::stringstream fileName;
                fileName << "stream/" << now << ".jpeg";
                int i = 0;
                while (fileExists(fileName.str().c_str())) {
                    fileName << "stream/" << now << i << ".jpeg";
                    i++;
                }
                cv::imwrite(fileName.str(), image);

                numSnapshot = atoi((**fiNumSnapshot).c_str());
                snapshotType = (**fiSnapshotType).c_str();
                screenWidthPixel = atoi((**fiScreenWidthPixel).c_str());
                screenHeightPixel = atoi((**fiScreenHeightPixel).c_str());
                isBoundingBox = atoi((**fiIsBoundingBox).c_str());
                //                seed = atoi((**fiSeed).c_str());
                //                token = atoi((**fiSeed).c_str());
                //                sessionName = (**fiSessionName).c_str();
                std::string oldIp = (**fiOldIp).c_str();

                ip = cgicc.getEnvironment().getRemoteAddr();


                //activate those lines to see the print of the code and see the debug in the webservice mode
                //                                saveCookies();
                std::cout << "Content-type:text/html\r\n\r\n";

                createSessionName();

                if (oldIp.compare("") != 0) {
                    if (ip.compare(oldIp) != 0) {
                        if (copyInfo(oldIp, ip) == -1) {
                            //error on copy
                            eraseSessionInfo();
                        }
                        std::stringstream filePath;
                        filePath << "session/" << oldIp << "/";
                        removeDirectoryElements(filePath.str().c_str(), "");
                    }
                }

                readInfo();

                setPreviousFrame(getPersistentImage("frame"));
                setFrame(image);
                setPersistentImage("frame", image);
                setPersistentImage("previousFrame", previousFrame);

                /*GET COOKIES*/

                // get environment variables
                //initCookies(cgicc.getEnvironment().getCookieList());
                //                const cgicc::CgiEnvironment& env = cgicc.getEnvironment();
                //                cgicc::const_cookie_iterator cci;
                //                for(cci = env.getCookieList().begin(); cci != env.getCookieList().end(); cci++) {
                //                    Server::getServer()->setCookie(cci->getName(), cci->getValue());
                //                    //std::cout << "<tr><td>" << cci->getName() << "</td><td>";
                //                    //std::cout << cci->getValue();
                //                    //std::cout << "</td></tr>\n";
                //                }
                //std::cout << "</table><\n";

                //std::cout << "<br/>\n";
                //std::cout << "</body>\n";
                //std::cout << "</html>\n";

                return true;
            }
        }
    }

    return false;
}
예제 #22
0
void GuitarPro5::read(QFile* fp)
      {
      f = fp;
      readInfo();
      readLyrics();
      readPageSetup();

      previousDynamic = -1;
      previousTempo = -1;
      //previousDynamic = new int [staves * VOICES];
      // initialise the dynamics to 0
      //for (int i = 0; i < staves * VOICES; i++)
      //      previousDynamic[i] = 0;

      tempo = readInt();
      if (version > 500)
            skip(1);

      key    = readInt();
      /* int octave =*/ readChar();    // octave

      readChannels();
      skip(42);

      measures = readInt();
      staves  = readInt();

      slurs = new Slur*[staves];
      for (int i = 0; i < staves; ++i)
            slurs[i] = 0;

      int tnumerator   = 4;
      int tdenominator = 4;
      for (int i = 0; i < measures; ++i) {
            if (i > 0)
                  skip(1);
            GpBar bar;
            uchar barBits = readUChar();
            if (barBits & SCORE_TIMESIG_NUMERATOR)
                  tnumerator = readUChar();
            if (barBits & SCORE_TIMESIG_DENOMINATOR)
                  tdenominator = readUChar();
            if (barBits & SCORE_REPEAT_START)
                  bar.repeatFlags = bar.repeatFlags | Repeat::START;
            if (barBits & SCORE_REPEAT_END) {                // number of repeats
                  bar.repeatFlags = bar.repeatFlags |Repeat::END;
                  bar.repeats = readUChar();
                  }
            if (barBits & SCORE_MARKER) {
                  bar.marker = readDelphiString();     // new section?
                  /*int color =*/ readInt();    // color?
                  }
            if (barBits & SCORE_VOLTA) {                      // a volta
                  uchar voltaNumber = readUChar();
                  while (voltaNumber > 0) {
                        // voltas are represented as flags
                        bar.volta.voltaType = GP_VOLTA_FLAGS;
                        bar.volta.voltaInfo.append(voltaNumber & 1);
                        voltaNumber >>= 1;
                        }
                  }
            if (barBits & SCORE_KEYSIG) {
                  int currentKey = readUChar();
                  /* key signatures are specified as
                   * 1# = 1, 2# = 2, ..., 7# = 7
                   * 1b = 255, 2b = 254, ... 7b = 249 */
                  bar.keysig = currentKey <= 7 ? currentKey : -256+currentKey;
                  readUChar();        // specified major/minor mode
                  }
            if (barBits & SCORE_DOUBLE_BAR)
                  bar.barLine = BarLineType::DOUBLE;
            if (barBits & 0x3)
                  skip(4);
            if ((barBits & 0x10) == 0)
                  skip(1);

            readChar();             // triple feel  (none, 8, 16)
            bar.timesig = Fraction(tnumerator, tdenominator);
            bars.append(bar);
            }
예제 #23
0
void myOpenDialog::on_name_activated(int index)
{
    readInfo(myNets, ui->name->itemText(index), QString("-1"));
    ui->name->setCurrentIndex(index);
}