/**************************************************************************** Function RunGridlinq Parameters ES_Event : the event to process Returns ES_Event, ES_NO_EVENT if no error ES_ERROR otherwise Description State machine for the Spectre, moves between unpaired and paired. Handles the analysis of the incoming data as described by the 218 comm protocol ****************************************************************************/ ES_Event RunGridlinq ( ES_Event CurrentEvent ) { ES_Event ReturnEvent = {ES_NO_EVENT}; GridlinqState NextState = CurrentState; // GridLinq state machine switch(CurrentState) { case Detached : //if we've lost the IR signal or whatever detects the cable if(CurrentEvent.EventType == CableTrigger) { //Prepare to enter the running state NextState = Running; ES_Event StartData = {Awaken, 0}; ES_PostList00(StartData); } break; case Running : //do the running shit. Whatever that may be. if(CurrentEvent.EventType == Disengage) { NextState = Detached; } if(CurrentEvent.EventType == WindReceived) { importData(Wind); printWindData(); } else if(CurrentEvent.EventType == GPSReceived) { importData(GPS); printGPSData(); } //once complete, set up hibernate if(CurrentEvent.EventType == GoToSleep) { NextState = Sleep; ES_Event StopData = {GoToSleep, 0}; ES_PostList00(StopData); } break; case Sleep : // do the necessary sleeping shit. //NextState = Running; if(CurrentEvent.EventType == CableTrigger) { //Prepare to enter the running state NextState = Running; ES_Event StartData = {Awaken, 0}; ES_PostList00(StartData); } break; } CurrentState = NextState; return ReturnEvent; }
/** * Runs the import process based on the input file * or directory given in the constructor **/ void medAbstractDatabaseImporter::internalRun ( void ) { if(!d->file.isEmpty()) importFile(); else if ( d->data ) importData(); }
/** * Runs the import process based on the input file * or directory given in the constructor **/ void medAbstractDatabaseImporter::internalRun ( void ) { if(!QDir(medStorage::dataLocation()).exists()) { emit showError ( tr ( "Your database path does not exist" ), 5000 ); emit failure(this); return; } if(!d->file.isEmpty()) importFile(); else if ( d->data ) importData(); }
void DataImporterThread::run() { try{ stmt = sourceDb->createStatement(); importData(); emitCompletedSignal(); }catch(OciException ex){ if(stmt->hasLockOnConnection()){ stmt->unlockConnection(); } rollback(); emit compareError("import_data", ex); } }
EMessageBoxReturn Dialog::DoModal() { importData(); PreModal(); EMessageBoxReturn ret = modal_dialog_show(m_window, m_modal); ASSERT_NOTNULL(m_window); if(ret == eIDOK) { exportData(); } gtk_widget_hide(GTK_WIDGET(m_window)); PostModal(m_modal.ret); return m_modal.ret; }
int WidgetInputSelection::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: modified(); break; case 1: importData(); break; default: ; } _id -= 2; } return _id; }
int main(int argc, char *argv[]){ /* Itteration Variables */ int i = 1; int gen = 0; double bestSSE = DBL_MAX; /* Creating performance variables */ double genDiv = 0; double genSSE[3] = {0,0,0}; /* worst, avg, best */ double sseError[MAXPOP]; double val[NUMPOINTS][2]; /* Genetic Paramenters */ int populationSize = 500; /* Population size (constant) */ int treeDepth = 15; /* Maximum Tree Depth */ int maxGenerations = 50; /* Maximum Number of generations */ double sseGoal = 0.5; /* SSE error goal (for spartan) */ double pruneFactor = 0.0; /* Probability that a branch will be prunned */ double constProb = 0.60; /* Probability that a leaf will be a randomly choose (0,1) constant */ double mutationRate = 0.20; /* Mutation Rate (probability that a node will be mutated */ double swapRate = 0.7; /* Probability that crossover will occur */ double tournamentFraction = 0.40; /* fraction of individuals selected by tournament */ double rankFraction = 0.50; /* fraction of individual selected by rank */ double spartanFraction = 0.1; /* fraction of individuals selected by rank, copied as is */ struct geneticParam genParam; /* compat representation of generation */ node *forest[MAXPOP]; /* Forest of trees */ node *bestTree; /* Output Variables */ int train = 1; int performance = 1; double evalPoint = 0; FILE *out = stdout; char bestTreeName[128]; char response[128] = "Y"; strcpy(bestTreeName,"bestTree"); /* Processing Command Line Inputs */ for (i = 1; i < argc; i++){ if (strcmp(argv[i],"--maxDepth")==0){ sscanf(argv[++i],"%d",&treeDepth); } else if (strcmp(argv[i],"--test")==0){ test(); return EXIT_SUCCESS; } else if (strcmp(argv[i],"--popSize")==0){ populationSize = atoi(argv[++i]); } else if (strcmp(argv[i],"--pruneFactor")==0){ pruneFactor = (double)atof(argv[++i]); } else if (strcmp(argv[i],"--constProb")==0){ constProb = (double)atof(argv[++i]); } else if (strcmp(argv[i],"--sseGoal")==0){ sseGoal = (double)atof(argv[++i]); } else if (strcmp(argv[i],"--mutationRate")==0){ mutationRate = (double)atof(argv[++i]); } else if (strcmp(argv[i],"--swapRate")==0){ swapRate = (double)atof(argv[++i]); } else if (strcmp(argv[i],"--tournamentFraction")==0){ tournamentFraction = (double) atof(argv[++i]); rankFraction = 1.0 - tournamentFraction; } else if (strcmp(argv[i],"--rankFraction")==0){ rankFraction = (double) atof(argv[++i]); } else if (strcmp(argv[i],"--spartanFraction")==0){ spartanFraction = (double) atof(argv[++i]); } else if (strcmp(argv[i],"--maxGen")==0){ maxGenerations = atoi(argv[++i]); } else if(strcmp(argv[i],"--bestTreeName")==0){ strcpy(bestTreeName,argv[++i]); } else if (strcmp(argv[i],"--help")==0){ usage(stdout,argv[0]); exit(EXIT_SUCCESS); } else{ fprintf(stderr,"Argument %s is not reconized\n",argv[i]); usage(stderr,argv[0]); exit(EXIT_FAILURE); } } /* Checking Input Arguments */ if (populationSize > MAXPOP){ fprintf(stderr,"population size is set to the max at %d. Change define for larger population\n",MAXPOP); populationSize = MAXPOP; } if (mutationRate > 1) mutationRate = 0.1; if (swapRate > 1) swapRate = 0.1; if (tournamentFraction + rankFraction > 1.0){ fprintf(stderr,"Tournament Fraction %5.3f and rank fraction %5.3f are greater than 1.0\n", tournamentFraction,rankFraction); fprintf(stderr,"Both are set to default values\n"); tournamentFraction = 0.9; rankFraction = 1.0 - tournamentFraction; } genParam.mutationRate = mutationRate; genParam.swapRate = swapRate; genParam.touramentFraction = tournamentFraction; genParam.rankFraction = rankFraction; genParam.spartanFraction = spartanFraction; genParam.constProb = constProb; genParam.maxDepth = treeDepth; genParam.pruneFraction = pruneFactor; splash(out); /* Train or Run? */ if (argc <= 1){ fprintf(stdout,"Preform symbolic regression with genetic programming [y/n]:\n"); fscanf(stdin,"%s",response); if (strcmp(response,"y")==0 || strcmp(response,"Y")==0) train = 1; else train = 0; fprintf(stdout,"Do you want to print the performance of the best tree [y/n]: \n"); fscanf(stdin,"%s",response); if (strcmp(response,"y")==0 || strcmp(response,"Y")==0) performance = 1; else performance = 0; } /* Run Information */ fprintf(out,"Parameters:\n"); fprintf(out,"\tPopulation Size: %d\n\tMax Tree Depth: %d\n",populationSize,treeDepth); fprintf(out,"\tPrune factor: %3.2f\n\tConstant Probability: %3.2f\n",pruneFactor,constProb); fprintf(out,"\tSSE Goal: %3.2f\n\tMax Generations: %d\n",sseGoal,maxGenerations); fprintf(out,"\tSpartan Fraction: %3.2f\n",spartanFraction); fprintf(out,"\tTournament Fraction: %3.2f\n\tRank Fraction: %5.2f\n",tournamentFraction,rankFraction); fprintf(out,"\tMutation Rate: %3.2f\n\tSwap Rate: %3.2f\n",mutationRate,swapRate); printSet(); /* Reading in the data file */ importData("proj2-data.dat",val); /* Creating the intitial population */ if (train){ srand( time(NULL)); fprintf(stdout,"Creating Intial Population\n"); rampedHalfHalf(forest,populationSize,&genParam); /* Running Generations */ fprintf(out,"Generation\tDiversity\tMean SSE\tBest SSE\n"); while(gen < maxGenerations && bestSSE > sseGoal){ /* Diversity and SSE */ genDiv = diversity(forest,populationSize); bestSSE = SSE(forest,populationSize,val,genSSE,sseError,bestTreeName); fprintf(out,"\t%d\t%3.2f\t\t%3.2e\t%3.2e\n",gen,genDiv,genSSE[1],genSSE[2]); /* Genetic Operations */ breedGeneration(forest,populationSize,sseError,&genParam); gen++; } /* Diversity and SSE */ genDiv = diversity(forest,populationSize); bestSSE = SSE(forest,populationSize,val,genSSE,sseError,bestTreeName); fprintf(out,"\t%d\t%3.2f\t\t%3.2e\t%3.2e\n",gen,genDiv,genSSE[1],genSSE[2]); /* Clean up, clean up, everybody do your share */ deleteForest(forest,populationSize); } /* Looking at the performance of the best tree */ if (performance){ sprintf(response,"%s.postfix",bestTreeName); bestTree = bestTreeSummary(out,response,val); if (argc <= 1){ fprintf(stdout,"Enter value on which to test the tree [n to escape]: \n"); while(fscanf(stdin,"%lf",&evalPoint)==1){ fprintf(stdout,"Tree(%5.3f) = %5.3f\n",evalPoint,evalTree(bestTree,evalPoint)); } deleteTree(bestTree); } } return EXIT_SUCCESS; }
void PropPageTextStyles::LoadTheme(const string& path) { SimpleXML xml; try { xml.fromXML(File(path, File::READ, File::OPEN, false).read()); } catch(...) { return; } xml.resetCurrentChild(); xml.stepIn(); if(xml.findChild(("Settings"))) { xml.stepIn(); importData("Font", TEXT_FONT); importData("BackgroundColor", BACKGROUND_COLOR); importData("TextColor", TEXT_COLOR); importData("DownloadBarColor", DOWNLOAD_BAR_COLOR); importData("UploadBarColor", UPLOAD_BAR_COLOR); importData("TextGeneralBackColor", TEXT_GENERAL_BACK_COLOR); importData("TextGeneralForeColor", TEXT_GENERAL_FORE_COLOR); importData("TextGeneralBold", TEXT_GENERAL_BOLD); importData("TextGeneralItalic", TEXT_GENERAL_ITALIC); importData("TextMyOwnBackColor", TEXT_MYOWN_BACK_COLOR); importData("TextMyOwnForeColor", TEXT_MYOWN_FORE_COLOR); importData("TextMyOwnBold", TEXT_MYOWN_BOLD); importData("TextMyOwnItalic", TEXT_MYOWN_ITALIC); importData("TextPrivateBackColor", TEXT_PRIVATE_BACK_COLOR); importData("TextPrivateForeColor", TEXT_PRIVATE_FORE_COLOR); importData("TextPrivateBold", TEXT_PRIVATE_BOLD); importData("TextPrivateItalic", TEXT_PRIVATE_ITALIC); importData("TextSystemBackColor", TEXT_SYSTEM_BACK_COLOR); importData("TextSystemForeColor", TEXT_SYSTEM_FORE_COLOR); importData("TextSystemBold", TEXT_SYSTEM_BOLD); importData("TextSystemItalic", TEXT_SYSTEM_ITALIC); importData("TextServerBackColor", TEXT_SERVER_BACK_COLOR); importData("TextServerForeColor", TEXT_SERVER_FORE_COLOR); importData("TextServerBold", TEXT_SERVER_BOLD); importData("TextServerItalic", TEXT_SERVER_ITALIC); importData("TextTimestampBackColor", TEXT_TIMESTAMP_BACK_COLOR); importData("TextTimestampForeColor", TEXT_TIMESTAMP_FORE_COLOR); importData("TextTimestampBold", TEXT_TIMESTAMP_BOLD); importData("TextTimestampItalic", TEXT_TIMESTAMP_ITALIC); importData("TextMyNickBackColor", TEXT_MYNICK_BACK_COLOR); importData("TextMyNickForeColor", TEXT_MYNICK_FORE_COLOR); importData("TextMyNickBold", TEXT_MYNICK_BOLD); importData("TextMyNickItalic", TEXT_MYNICK_ITALIC); importData("TextFavBackColor", TEXT_FAV_BACK_COLOR); importData("TextFavForeColor", TEXT_FAV_FORE_COLOR); importData("TextFavBold", TEXT_FAV_BOLD); importData("TextFavItalic", TEXT_FAV_ITALIC); importData("TextURLBackColor", TEXT_URL_BACK_COLOR); importData("TextURLForeColor", TEXT_URL_FORE_COLOR); importData("TextURLBold", TEXT_URL_BOLD); importData("TextURLItalic", TEXT_URL_ITALIC); importData("TextDupeBackColor", TEXT_DUPE_BACK_COLOR); importData("TextDupeColor", DUPE_COLOR); importData("TextDupeBold", TEXT_DUPE_BOLD); importData("TextDupeItalic", TEXT_DUPE_ITALIC); importData("ProgressTextDown", PROGRESS_TEXT_COLOR_DOWN); importData("ProgressTextUp", PROGRESS_TEXT_COLOR_UP); importData("ErrorColor", ERROR_COLOR); importData("ProgressOverrideColors", PROGRESS_OVERRIDE_COLORS); importData("MenubarTwoColors", MENUBAR_TWO_COLORS); importData("MenubarLeftColor", MENUBAR_LEFT_COLOR); importData("MenubarRightColor", MENUBAR_RIGHT_COLOR); importData("MenubarBumped", MENUBAR_BUMPED); importData("Progress3DDepth", PROGRESS_3DDEPTH); importData("ProgressOverrideColors2", PROGRESS_OVERRIDE_COLORS2); importData("TextOPBackColor", TEXT_OP_BACK_COLOR); importData("TextOPForeColor", TEXT_OP_FORE_COLOR); importData("TextOPBold", TEXT_OP_BOLD); importData("TextOPItalic", TEXT_OP_ITALIC); importData("TextNormBackColor", TEXT_NORM_BACK_COLOR); importData("TextNormForeColor", TEXT_NORM_FORE_COLOR); importData("TextNormBold", TEXT_NORM_BOLD); importData("TextNormItalic", TEXT_NORM_ITALIC); importData("SearchAlternateColour", SEARCH_ALTERNATE_COLOUR); importData("ProgressBackColor", PROGRESS_BACK_COLOR); importData("ProgressCompressColor", PROGRESS_COMPRESS_COLOR); importData("ProgressSegmentColor", PROGRESS_SEGMENT_COLOR); importData("ColorDone", COLOR_DONE); importData("ColorDownloaded", COLOR_DOWNLOADED); importData("ColorRunning", COLOR_RUNNING); importData("ReservedSlotColor", RESERVED_SLOT_COLOR); importData("IgnoredColor", IGNORED_COLOR); importData("FavoriteColor", FAVORITE_COLOR); importData("NormalColour", NORMAL_COLOUR); importData("PasiveColor", PASIVE_COLOR); importData("OpColor", OP_COLOR); importData("ProgressbaroDCStyle", PROGRESSBAR_ODC_STYLE); importData("UnderlineLinks", UNDERLINE_LINKS); importData("UnderlineDupes", UNDERLINE_DUPES); importData("TextQueueBackColor", TEXT_QUEUE_BACK_COLOR); importData("QueueColor", QUEUE_COLOR); importData("TextQueueBold", TEXT_QUEUE_BOLD); importData("TextQueueItalic", TEXT_QUEUE_ITALIC); importData("UnderlineQueue", UNDERLINE_QUEUE); //tabs importData("tabactivebg", TAB_ACTIVE_BG); importData("TabActiveText", TAB_ACTIVE_TEXT); importData("TabActiveBorder", TAB_ACTIVE_BORDER); importData("TabInactiveBg", TAB_INACTIVE_BG); importData("TabInactiveBgDisconnected", TAB_INACTIVE_BG_DISCONNECTED); importData("TabInactiveText", TAB_INACTIVE_TEXT); importData("TabInactiveBorder", TAB_INACTIVE_BORDER); importData("TabInactiveBgNotify", TAB_INACTIVE_BG_NOTIFY); importData("TabDirtyBlend", TAB_DIRTY_BLEND); importData("BlendTabs", BLEND_TABS); importData("TabSize", TAB_SIZE); } xml.stepOut(); if(xml.findChild("Icons")) { if(MessageBox(CTSTRING(ICONS_IN_THEME), _T("AirDC++") _T(" ") _T(VERSIONSTRING), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES) { xml.stepIn(); importData("IconPath", ICON_PATH); //toolbars not exported to avoid absolute local paths in toolbar settings. importData("ToolbarImage", TOOLBARIMAGE); importData("ToolbarHot", TOOLBARHOTIMAGE); xml.resetCurrentChild(); xml.stepOut(); } } xml.resetCurrentChild(); if(xml.findChild("Highlights")) { if(MessageBox(CTSTRING(HIGHLIGHTS_IN_THEME), _T("AirDC++") _T(" ") _T(VERSIONSTRING), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES) { HighlightManager::getInstance()->clearList(); HighlightManager::getInstance()->load(xml); } } xml.resetCurrentChild(); //SendMessage(WM_DESTROY,0,0); //SettingsManager::getInstance()->save(); //SendMessage(WM_INITDIALOG,0,0); SettingsManager::getInstance()->reloadPages(); fontdirty = true; }
TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent, const char *name) : QDialog(parent,name,true) { QString sql; QDate current_date=QDate::currentDate(); test_svc=svc; test_src=src; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); switch(test_src) { case RDSvc::Traffic: setCaption(tr("Test Traffic Import")); break; case RDSvc::Music: setCaption(tr("Test Music Import")); break; case RDSvc::NoSource: break; } // // Create Fonts // QFont font=QFont("Helvetica",12,QFont::Bold); font.setPixelSize(12); QFont section_font=QFont("Helvetica",14,QFont::Bold); section_font.setPixelSize(14); // // Date Selector // test_date_edit=new QDateEdit(this,"test_date_edit"); test_date_label=new QLabel(test_date_edit,tr("Test Date:"),this); test_date_label->setFont(font); test_date_label->setAlignment(AlignVCenter|AlignRight); test_date_edit->setDate(current_date); connect(test_date_edit,SIGNAL(valueChanged(const QDate &)), this,SLOT(dateChangedData(const QDate &))); // // Select Date Button // test_select_button=new QPushButton(this); test_select_button->setFont(font); test_select_button->setText(tr("&Select")); connect(test_select_button,SIGNAL(clicked()),this,SLOT(selectData())); // // Import Button // test_import_button=new QPushButton(this); test_import_button->setFont(font); test_import_button->setText(tr("&Import")); connect(test_import_button,SIGNAL(clicked()),this,SLOT(importData())); // // Import Filename // test_filename_edit=new QLineEdit(this); test_filename_edit->setReadOnly(true); test_filename_label= new QLabel(test_filename_edit,tr("Using source file:"),this); test_filename_label->setFont(font); // // Events List // test_events_list=new RDListView(this); test_events_list->setItemMargin(2); test_events_list->addColumn(tr("Start Time")); test_events_list->setColumnAlignment(0,AlignCenter); test_events_list->addColumn(tr("Cart")); test_events_list->setColumnAlignment(1,AlignCenter); test_events_list->addColumn(tr("Len")); test_events_list->setColumnAlignment(2,AlignRight); test_events_list->addColumn(tr("Title")); test_events_list->setColumnAlignment(3,AlignLeft); test_events_list->addColumn(tr("Trans")); test_events_list->setColumnAlignment(4,AlignCenter); test_events_list->addColumn(tr("Time Type")); test_events_list->setColumnAlignment(5,AlignCenter); test_events_list->addColumn(tr("Wait Time")); test_events_list->setColumnAlignment(6,AlignCenter); test_events_list->addColumn(tr("Contract #")); test_events_list->setColumnAlignment(7,AlignCenter); test_events_list->addColumn(tr("Event ID")); test_events_list->setColumnAlignment(8,AlignCenter); test_events_list->addColumn(tr("Announcement Type")); test_events_list->setColumnAlignment(9,AlignCenter); test_events_list->setColumnSortType(0,RDListView::LineSort); test_events_label=new QLabel(test_events_list,tr("Imported Events"),this); test_events_label->setFont(font); // // Close Button // test_close_button=new QPushButton(this); test_close_button->setFont(font); test_close_button->setText(tr("&Close")); connect(test_close_button,SIGNAL(clicked()),this,SLOT(closeData())); dateChangedData(current_date); }
void Dialog::ShowDlg() { ASSERT_MESSAGE(m_window != 0, "dialog was not constructed"); importData(); gtk_widget_show(GTK_WIDGET(m_window)); }
ImportTrack::ImportTrack(QString *filter,QString *group,QWidget *parent) : QDialog(parent,"",true,Qt::WStyle_Customize|Qt::WStyle_DialogBorder) { setCaption(""); // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Generate Fonts // QFont button_font=QFont("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); QFont label_font=QFont("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); QFont day_font=QFont("Helvetica",12,QFont::Normal); day_font.setPixelSize(12); add_filter=filter; add_group=group; // // Title Label // QLabel *label=new QLabel(tr("Insert audio from a:"),this); label->setGeometry(0,0,sizeHint().width(),30); label->setFont(label_font); label->setAlignment(Qt::AlignCenter); // // Cart Button // QPushButton *button=new QPushButton(this); button->setGeometry(10,30,sizeHint().width()-20,50); button->setFont(button_font); button->setText(tr("&Cart")); button->setDisabled(true); QString sql=QString("select CHANNEL from DECKS where ")+ "(CARD_NUMBER>=0)&&"+ "(CHANNEL>0)&&"+ "(CHANNEL<=9)"; RDSqlQuery *q=new RDSqlQuery(sql); if(q->first()) { button->setEnabled(true); } delete q; connect(button,SIGNAL(clicked()),this,SLOT(cartData())); // // Import Button // button=new QPushButton(this); button->setGeometry(10,80,sizeHint().width()-20,50); button->setFont(button_font); button->setText(tr("&File")); button->setDisabled(true); sql=QString("select CHANNEL from DECKS where ")+ "(CARD_NUMBER>=0)&&"+ "(CHANNEL>128)&&"+ "(CHANNEL<=137)"; q=new RDSqlQuery(sql); if(q->first()) { button->setEnabled(true); } delete q; connect(button,SIGNAL(clicked()),this,SLOT(importData())); // // Cancel Button // button=new QPushButton(this); button->setGeometry(10,140,sizeHint().width()-20,50); button->setFont(button_font); button->setText(tr("&Cancel")); button->setDefault(true); connect(button,SIGNAL(clicked()),this,SLOT(cancelData())); }
EditSchedRules::EditSchedRules(QString clock,unsigned *artistsep,SchedRulesList *schedruleslist,bool *rules_modified,QWidget *parent) : QDialog(parent,"",true) { edit_artistsep=artistsep; edit_rules_modified=rules_modified; sched_rules_list = schedruleslist; clockname = clock; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); setCaption(tr("Scheduler Rules")); // // Create Fonts // QFont font=QFont("Helvetica",12,QFont::Bold); font.setPixelSize(12); artistSepLabel = new QLabel( this, "artistSepLabel" ); artistSepLabel->setGeometry( QRect( 10, 10, 130, 20 ) ); artistSepLabel->setFont(font); artistSepLabel->setText(tr("Artist Separation:")); artistSepSpinBox = new QSpinBox( this, "artistSepSpinBox" ); artistSepSpinBox->setGeometry( QRect( 160, 10, 70, 20 ) ); artistSepSpinBox->setMaxValue( 10000 ); artistSepSpinBox->setValue( *edit_artistsep ); // // Edit Button // QPushButton *list_edit_button=new QPushButton(this,"list_edit_button"); list_edit_button->setGeometry(10,sizeHint().height()-60,80,50); list_edit_button->setFont(font); list_edit_button->setText(tr("&Edit")); connect(list_edit_button,SIGNAL(clicked()),this,SLOT(editData())); // // Import Button // QPushButton *list_import_button=new QPushButton(this,"list_import_button"); list_import_button->setGeometry(100,sizeHint().height()-60,80,50); list_import_button->setFont(font); list_import_button->setText(tr("&Import")); connect(list_import_button,SIGNAL(clicked()),this,SLOT(importData())); // Ok Button // QPushButton *ok_button=new QPushButton(this,"ok_button"); ok_button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); ok_button->setDefault(true); ok_button->setFont(font); ok_button->setText(tr("&OK")); connect(ok_button,SIGNAL(clicked()),this,SLOT(okData())); // // Cancel Button // QPushButton *cancel_button=new QPushButton(this,"cancel_button"); cancel_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60, 80,50); cancel_button->setFont(font); cancel_button->setText(tr("&Cancel")); connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); // List list_schedCodes_view=new RDListView(this,"list_schedCodes_view"); list_schedCodes_view->setGeometry(10,60,size().width()-20,size().height()-140); list_schedCodes_view->setAllColumnsShowFocus(true); list_schedCodes_view->addColumn(tr("CODE")); list_schedCodes_view->addColumn(tr("MAX. IN A ROW")); list_schedCodes_view->addColumn(tr("MIN. WAIT")); list_schedCodes_view->addColumn(tr("DO NOT SCHEDULE AFTER")); list_schedCodes_view->addColumn(tr("OR AFTER")); list_schedCodes_view->addColumn(tr("OR AFTER")); list_schedCodes_view->addColumn(tr("DESCRIPTION")); QLabel *list_box_label=new QLabel(list_schedCodes_view,tr("Scheduler Codes:"),this,"list_box_label"); list_box_label->setFont(font); list_box_label->setGeometry(10,40,200,20); connect(list_schedCodes_view, SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)), this, SLOT(doubleClickedData(QListViewItem *,const QPoint &,int))); edit_modified=false; Load(); }
int main(void){ LCDInit(CLK, DIN, DC, CE,RST, contrast); LCDclear(); LCDshowLogo(); struct sGENERAL person; delay_ms(1000); system("clear"); printf("Deseja Sobrescrever os Dados ? S/N\n"); unsigned int choose; do{choose = (int)getchar();}while(choose != 115 && choose != 83 && choose != 110 && choose != 78); getchar(); if(choose == 115 || choose == 83){ LCDDrawBitmap(profile); if(healthProfile(&person) == false){ printf("Falha ao realizar o Cadastro!\n"); return -1; } }else{ system("clear"); LCDDrawBitmap(profile); if(importData(&person)==false){ printf("Falha ao importar dados!\n"); return -1; } } LCDDrawBitmap(sensors); int raspDuino = serialOpen(SERIAL_PORT[1],BAUDS[1]); if(raspDuino == -1){ printf("Houve um erro ao Abrir a porta Serial!\n"); return -1; } serialFlush(raspDuino); GPIOExport(changeDisplay); GPIODirection(changeDisplay,INPUT); GPIOExport(backLight); GPIODirection(backLight,INPUT); GPIOExport(BL); GPIODirection(BL,OUTPUT); GPIOWrite(BL,HIGH); uint8_t change_Layer = 0; while(1){ if(GPIORead(changeDisplay) == HIGH){ while(GPIORead(changeDisplay) == HIGH){} change_Layer++; if(change_Layer > 2) change_Layer = 0; } if(GPIORead(backLight) == HIGH){ while(GPIORead(backLight) == HIGH){} GPIOWrite(BL,!GPIORead(BL)); } switch(change_Layer){ case 0: lcdDisplayMain(raspDuino); break; case 1: lcdDisplayProfile(person); break; case 2: lcdDisplaySensors(raspDuino,person); break; } /*if(serialDataAvail(raspDuino)!=-1){ // Usar Threads Sensors.BPM = (unsigned int)serialGetchar(raspDuino); Sensors.Temp = ((float)serialGetchar(raspDuino)*5/(1023))/0.01; Sensors.BPMState = healthState(person,Sensors.BPM); Sensors.TempState = isNormal(Sensors.Temp); }*/ } }
RDImportAudio::RDImportAudio(QString cutname,QString *path, RDSettings *settings,bool *import_metadata, RDWaveData *wavedata,RDCut *clipboard, RDStation *station,RDUser *user, bool *running,RDConfig *config, QWidget *parent) : QDialog(parent) { import_config=config; import_default_settings=settings; import_path=path; import_settings=settings; import_cutname=cutname; import_import_metadata=import_metadata; import_wavedata=wavedata; import_clipboard=clipboard; import_running=running; import_station=station; import_user=user; import_file_filter=RD_AUDIO_FILE_FILTER; import_import_conv=NULL; import_export_conv=NULL; setCaption(tr("Import/Export Audio File")); // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Generate Fonts // QFont button_font=QFont("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); QFont label_font=QFont("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); QFont mode_font=QFont("Helvetica",14,QFont::Bold); mode_font.setPixelSize(14); // // Mode Group // import_mode_group=new QButtonGroup(this); import_mode_group->hide(); connect(import_mode_group,SIGNAL(clicked(int)), this,SLOT(modeClickedData(int))); // // Input Mode Button // import_importmode_button=new QRadioButton(tr("Import File"), this); import_mode_group->insert(import_importmode_button); import_importmode_button->setGeometry(10,10,sizeHint().width()-40,15); import_importmode_button->setFont(mode_font); import_importmode_button->setChecked(true); // // Input Filename // import_in_filename_edit=new QLineEdit(this); import_in_filename_edit->setGeometry(85,30,sizeHint().width()-180,20); connect(import_in_filename_edit,SIGNAL(textChanged(const QString &)), this,SLOT(filenameChangedData(const QString &))); import_in_filename_label= new QLabel(import_in_filename_edit,tr("Filename:"),this); import_in_filename_label->setGeometry(10,30,70,20); import_in_filename_label->setFont(label_font); import_in_filename_label->setAlignment(AlignVCenter|AlignRight); // // Input File Selector Button // import_in_selector_button=new QPushButton(tr("&Select"),this); import_in_selector_button->setGeometry(sizeHint().width()-85,27,70,26); connect(import_in_selector_button,SIGNAL(clicked()), this,SLOT(selectInputFileData())); // // Input Metadata // import_in_metadata_box=new QCheckBox(tr("Import file metadata"),this); import_in_metadata_box->setGeometry(95,56,160,15); import_in_metadata_box->setChecked(*import_import_metadata); import_in_metadata_box->setFont(label_font); // // Input Channels // import_channels_box=new QComboBox(this); import_channels_box->setGeometry(310,54,50,20); import_channels_label= new QLabel(import_channels_box,tr("Channels:"),this); import_channels_label->setGeometry(230,54,75,20); import_channels_label->setFont(label_font); import_channels_label->setAlignment(AlignRight|AlignVCenter); // // Autotrim Check Box // import_autotrim_box=new QCheckBox(tr("Autotrim"),this); import_autotrim_box->setGeometry(95,82,80,15); import_autotrim_box->setChecked(true); import_autotrim_box->setFont(label_font); connect(import_autotrim_box,SIGNAL(toggled(bool)), this,SLOT(autotrimCheckData(bool))); // // Autotrim Level // import_autotrim_spin=new QSpinBox(this); import_autotrim_spin->setGeometry(235,80,40,20); import_autotrim_spin->setRange(-99,0); import_autotrim_label=new QLabel(import_autotrim_spin,tr("Level:"),this); import_autotrim_label->setGeometry(185,80,45,20); import_autotrim_label->setFont(label_font); import_autotrim_label->setAlignment(AlignRight|AlignVCenter); import_autotrim_unit=new QLabel(tr("dBFS"),this); import_autotrim_unit->setGeometry(280,80,40,20); import_autotrim_unit->setFont(label_font); import_autotrim_unit->setAlignment(AlignLeft|AlignVCenter); // // Output Mode Button // import_exportmode_button=new QRadioButton(tr("Export File"),this); import_mode_group->insert(import_exportmode_button); import_exportmode_button->setGeometry(10,120,sizeHint().width()-40,15); import_exportmode_button->setFont(mode_font); // // Output Filename // import_out_filename_edit=new QLineEdit(this); import_out_filename_edit->setGeometry(85,140,sizeHint().width()-180,20); connect(import_out_filename_edit,SIGNAL(textChanged(const QString &)), this,SLOT(filenameChangedData(const QString &))); import_out_filename_edit->setReadOnly(true); import_out_filename_label= new QLabel(import_out_filename_edit,tr("Filename:"),this); import_out_filename_label->setGeometry(10,140,70,20); import_out_filename_label->setFont(label_font); import_out_filename_label->setAlignment(AlignVCenter|AlignRight); // // Output File Selector Button // import_out_selector_button=new QPushButton(tr("&Select"),this); import_out_selector_button->setGeometry(sizeHint().width()-85,137,70,26); connect(import_out_selector_button,SIGNAL(clicked()), this,SLOT(selectOutputFileData())); // // Output Metadata // import_out_metadata_box=new QCheckBox(tr("Export file metadata"),this); import_out_metadata_box->setGeometry(95,161,sizeHint().width()-210,15); import_out_metadata_box->setChecked(*import_import_metadata); import_out_metadata_box->setFont(label_font); // // Output Format // import_format_edit=new QLineEdit(this); import_format_edit->setGeometry(85,181,sizeHint().width()-180,20); import_format_edit->setReadOnly(true); import_format_edit->setText(import_settings->description()); import_format_label=new QLabel(import_out_filename_edit,tr("Format:"),this); import_format_label->setGeometry(10,181,70,20); import_format_label->setFont(label_font); import_format_label->setAlignment(AlignVCenter|AlignRight); // // Output Format Selector Button // import_out_format_button=new QPushButton(tr("S&et"),this); import_out_format_button->setGeometry(sizeHint().width()-85,178,70,26); connect(import_out_format_button,SIGNAL(clicked()), this,SLOT(selectOutputFormatData())); // // Progress Bar // import_bar=new RDBusyBar(this); import_bar->setGeometry(10,230,sizeHint().width()-20,20); // // Normalize Check Box // import_normalize_box=new QCheckBox(tr("Normalize"),this); import_normalize_box->setGeometry(10,262,113,15); import_normalize_box->setChecked(true); import_normalize_box->setFont(label_font); connect(import_normalize_box,SIGNAL(toggled(bool)), this,SLOT(normalizeCheckData(bool))); // // Normalize Level // import_normalize_spin=new QSpinBox(this); import_normalize_spin->setGeometry(160,260,40,20); import_normalize_spin->setRange(-30,0); import_normalize_label=new QLabel(import_normalize_spin,tr("Level:"),this); import_normalize_label->setGeometry(110,260,45,20); import_normalize_label->setFont(label_font); import_normalize_label->setAlignment(AlignRight|AlignVCenter); import_normalize_unit=new QLabel(tr("dBFS"),this); import_normalize_unit->setGeometry(205,260,40,20); import_normalize_unit->setFont(label_font); import_normalize_unit->setAlignment(AlignLeft|AlignVCenter); // // Import Button // import_import_button=new QPushButton(tr("&Import"),this); import_import_button-> setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); import_import_button->setFont(button_font); connect(import_import_button,SIGNAL(clicked()),this,SLOT(importData())); // // Cancel Button // import_cancel_button=new QPushButton(tr("&Cancel"),this); import_cancel_button-> setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50); import_cancel_button->setFont(button_font); import_cancel_button->setDefault(true); connect(import_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); // // Populate Data // import_normalize_spin->setValue(settings->normalizationLevel()/100); import_autotrim_spin->setValue(settings->autotrimLevel()/100); import_channels_box->insertItem("1"); import_channels_box->insertItem("2"); import_channels_box->setCurrentItem(settings->channels()-1); filenameChangedData(""); modeClickedData(import_mode_group->selectedId()); }
void cube::shiftCube( char direction, bool orientation ) { /* * shifts the contents of the cube in the given direction. out-of-bound locations * will be ignored and set to 'off' */ cube *tmpCube = new cube; tmpCube->allOff(); signed short int modifier; if(orientation == 1) { modifier = 1; } else { modifier = -1; } byte t_x, t_y, t_z; for(byte i_x = 1; i_x <= 4; i_x++ ) { for(byte i_y = 1; i_y <= 4; i_y++ ) { for(byte i_z = 1; i_z <= 4; i_z++ ) { if( getState( i_x, i_y, i_z ) == 1 ) { switch(direction) { case 'x': t_x = i_x + modifier; if( t_x <= 0 || t_x > 4 ){ continue; } t_y = i_y; t_z = i_z; break; case 'y': t_x = i_x; t_y = i_y + modifier; if( t_y <= 0 || t_y > 4 ){ continue; } t_z = i_z; break; case 'z': t_x = i_x; t_y = i_y; t_z = i_z + modifier; if( t_z <= 0 || t_z > 4 ){ continue; } break; default: continue; break; } tmpCube->setState( t_x, t_y, t_z, 1 ); } } } } importData( tmpCube->_cube_state ); delete tmpCube; }
LRESULT PropPageTextStyles::onImport(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { tstring x = _T(""); if(WinUtil::browseFile(x, m_hWnd, false, x, types, defExt) == IDOK) { SimpleXML xml; xml.fromXML(File(Text::fromT(x), File::READ, File::OPEN).read()); xml.resetCurrentChild(); xml.stepIn(); if(xml.findChild(("Settings"))) { xml.stepIn(); importData("Font", TEXT_FONT); importData("BackgroundColor", BACKGROUND_COLOR); importData("TextColor", TEXT_COLOR); importData("DownloadBarColor", DOWNLOAD_BAR_COLOR); importData("UploadBarColor", UPLOAD_BAR_COLOR); importData("TextGeneralBackColor", TEXT_GENERAL_BACK_COLOR); importData("TextGeneralForeColor", TEXT_GENERAL_FORE_COLOR); importData("TextGeneralBold", TEXT_GENERAL_BOLD); importData("TextGeneralItalic", TEXT_GENERAL_ITALIC); importData("TextMyOwnBackColor", TEXT_MYOWN_BACK_COLOR); importData("TextMyOwnForeColor", TEXT_MYOWN_FORE_COLOR); importData("TextMyOwnBold", TEXT_MYOWN_BOLD); importData("TextMyOwnItalic", TEXT_MYOWN_ITALIC); importData("TextPrivateBackColor", TEXT_PRIVATE_BACK_COLOR); importData("TextPrivateForeColor", TEXT_PRIVATE_FORE_COLOR); importData("TextPrivateBold", TEXT_PRIVATE_BOLD); importData("TextPrivateItalic", TEXT_PRIVATE_ITALIC); importData("TextSystemBackColor", TEXT_SYSTEM_BACK_COLOR); importData("TextSystemForeColor", TEXT_SYSTEM_FORE_COLOR); importData("TextSystemBold", TEXT_SYSTEM_BOLD); importData("TextSystemItalic", TEXT_SYSTEM_ITALIC); importData("TextServerBackColor", TEXT_SERVER_BACK_COLOR); importData("TextServerForeColor", TEXT_SERVER_FORE_COLOR); importData("TextServerBold", TEXT_SERVER_BOLD); importData("TextServerItalic", TEXT_SERVER_ITALIC); importData("TextTimestampBackColor", TEXT_TIMESTAMP_BACK_COLOR); importData("TextTimestampForeColor", TEXT_TIMESTAMP_FORE_COLOR); importData("TextTimestampBold", TEXT_TIMESTAMP_BOLD); importData("TextTimestampItalic", TEXT_TIMESTAMP_ITALIC); importData("TextMyNickBackColor", TEXT_MYNICK_BACK_COLOR); importData("TextMyNickForeColor", TEXT_MYNICK_FORE_COLOR); importData("TextMyNickBold", TEXT_MYNICK_BOLD); importData("TextMyNickItalic", TEXT_MYNICK_ITALIC); importData("TextFavBackColor", TEXT_FAV_BACK_COLOR); importData("TextFavForeColor", TEXT_FAV_FORE_COLOR); importData("TextFavBold", TEXT_FAV_BOLD); importData("TextFavItalic", TEXT_FAV_ITALIC); importData("TextURLBackColor", TEXT_URL_BACK_COLOR); importData("TextURLForeColor", TEXT_URL_FORE_COLOR); importData("TextURLBold", TEXT_URL_BOLD); importData("TextURLItalic", TEXT_URL_ITALIC); importData("BoldAuthorsMess", BOLD_AUTHOR_MESS); importData("ProgressTextDown", PROGRESS_TEXT_COLOR_DOWN); importData("ProgressTextUp", PROGRESS_TEXT_COLOR_UP); importData("ErrorColor", ERROR_COLOR); importData("ProgressOverrideColors", PROGRESS_OVERRIDE_COLORS); importData("MenubarTwoColors", MENUBAR_TWO_COLORS); importData("MenubarLeftColor", MENUBAR_LEFT_COLOR); importData("MenubarRightColor", MENUBAR_RIGHT_COLOR); importData("MenubarBumped", MENUBAR_BUMPED); importData("Progress3DDepth", PROGRESS_3DDEPTH); importData("ProgressOverrideColors2", PROGRESS_OVERRIDE_COLORS2); importData("TextOPBackColor", TEXT_OP_BACK_COLOR); importData("TextOPForeColor", TEXT_OP_FORE_COLOR); importData("TextOPBold", TEXT_OP_BOLD); importData("TextOPItalic", TEXT_OP_ITALIC); importData("SearchAlternateColour", SEARCH_ALTERNATE_COLOUR); importData("ProgressBackColor", PROGRESS_BACK_COLOR); importData("ProgressCompressColor", PROGRESS_COMPRESS_COLOR); importData("ProgressSegmentColor", PROGRESS_SEGMENT_COLOR); importData("ColorDone", COLOR_DONE); importData("ColorDownloaded", COLOR_DOWNLOADED); importData("ColorRunning", COLOR_RUNNING); importData("IgnoredColor", IGNORED_COLOR); importData("FavoriteColor", FAVORITE_COLOR); importData("NormalColour", NORMAL_COLOUR); importData("PasiveColor", PASIVE_COLOR); importData("OpColor", OP_COLOR); importData("ProgressbaroDCStyle", PROGRESSBAR_ODC_STYLE); importData("ProgressbaroDCStyle", PROGRESSBAR_ODC_STYLE); } xml.resetCurrentChild(); xml.stepOut(); } SendMessage(WM_DESTROY,0,0); //SettingsManager::getInstance()->save(); PropertiesDlg::needUpdate = true; SendMessage(WM_INITDIALOG,0,0); // RefreshPreview(); return 0; }