void FormGame::circleOfPowerDesactive(ITank* killer) { CircleOfPower* circle_of_power = (CircleOfPower*)sender(); circle_of_power->team() == 1 ? ++_green_circles_destroyers:++_red_circles_destroyers; PlayerData pd1 = _players_data.at(_tanks.indexOf(killer)); PlayerData pd2 = _players_data.at(_tanks.indexOf(circle_of_power->tank())); if(killer->isEnemy() != circle_of_power->tank()->isEnemy()) { KillsDeaths kills = _results.value(pd1).value(pd2); kills._circle_of_power_destroyed = true; QMap<PlayerData , KillsDeaths> value; value.insert(pd2, kills); _results.insert(pd1, value); } if(_green_circles_destroyers == _game->getTeam1()->getTanks().size()) { showResults(2); } else if (_red_circles_destroyers == _game->getTeam2()->getTanks().size()) { showResults(1); } else { QString pd1_team = pd1._team == 1?"g":"r"; QString pd2_team = pd2._team == 1?"g":"r"; QString log("<span class='%1'>%2</span><span> ha destruido el centro de energía de </span><span class='%3'>%4</span>"); addLog(_text_style_template.arg(log.arg(pd1_team).arg(pd1._nick).arg(pd2_team).arg(pd2._nick))); } }
void showMenuDownload(BYTE showMask) { if(showMask & SHOWMENU_STATICTEXT) { (void) Clear_home(); (void) Cconws("\33p[Floppy image download, Jookie 2014-18]\33q\r\n"); } if(showMask & SHOWMENU_SEARCHSTRING) { showSearchString(); } if(showMask & SHOWMENU_RESULTS_ALL) { showPageNumber(); } showResults(showMask); if(showMask & SHOWMENU_STATICTEXT) { Goto_pos(0, 19); (void) Cconws("\33pA..Z\33q - search, \33p(shift) arrows\33q - move\r\n"); if(status.doWeHaveStorage) { // with storage (void) Cconws("\33pF1, F2, F3\33q - insert into slot 1, 2, 3\r\n"); (void) Cconws("\33pF4\33q - download, \33pF5\33q - refresh list,\r\n"); } else { // without storage (void) Cconws(" \r\n"); (void) Cconws(" \33pF5\33q - refresh list,\r\n"); } (void) Cconws("\33pF8\33q - setup screen, \33pF10\33q - quit\r\n"); } }
void NameStatWidget::configLeftArea(const StatisticsExtractor& statsExtractor) { sitesCombo_->addItem("lenta.ru"); fillNamesCombo(statsExtractor); QBoxLayout* leftLayout = new QBoxLayout(QBoxLayout::TopToBottom); leftLayout->addWidget(sitesCombo_); leftLayout->addWidget(namesCombo_); QIntValidator* pagesValidator = new QIntValidator(MinPagesCount, MaxPagesCount, this); pageCountEdit_->setValidator(pagesValidator); // Разрешим вводить в поле только цифры. QLabel* pages = new QLabel(tr("Страниц (шт):")); pages->setBuddy(pageCountEdit_); leftLayout->addWidget(pages); leftLayout->addWidget(pageCountEdit_); QLabel* labelFrom = new QLabel(tr("&От:")); labelFrom->setBuddy(beginPeriod_); leftLayout->addWidget(labelFrom); leftLayout->addWidget(beginPeriod_); QLabel* labelTo = new QLabel(tr("&До:")); labelTo->setBuddy(endPeriod_); leftLayout->addWidget(labelTo); leftLayout->addWidget(endPeriod_); leftLayout->addWidget(okBt_, 2, Qt::AlignRight); leftLayout->addStretch(); leftGroup_->setLayout(leftLayout); connect(okBt_, &QPushButton::clicked, this, [&](){ showResults(statsExtractor); }); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { currLayerNumber = 0; ui->setupUi(this); ui->qwtPlot->setTitle("Error"); ui->qwtPlot->setAxisTitle(ui->qwtPlot->xBottom, "Epoch"); ui->qwtPlot->setAxisTitle(ui->qwtPlot->yLeft,"Error"); QPen pen = QPen(Qt::red); curve = new QwtPlotCurve; curve->setRenderHint(QwtPlotItem::RenderAntialiased); curve->setPen(pen); curve->attach(ui->qwtPlot); Preprocessor p; Dataset d = p.readFile("1.dat"); showResults(d); connect(ui->saveImageButton,SIGNAL(clicked()),this,SLOT(saveImage())); connect(ui->numberOfLayers,SIGNAL(valueChanged(int)),this,SLOT(changeLayers(int))); }
void trainModel(NNModel* model){ /* =============== Reading data from files =============== */ DataParser *traininSet = new DataParser(numTrainingExamples, numFeatures, 10, "trainingSet.csv"); mat xTrain = traininSet->getExampleSet(); mat yTrain = traininSet->getLabelSet(); DataParser *crossValidationSet = new DataParser(numCrossValidationExamples, numFeatures, 10, "crossValidation.csv"); mat xCross = crossValidationSet->getExampleSet(); mat yCross = crossValidationSet->getLabelSet(); /* =============================== Training model =============== */ NNBackPropagation* backPropagation = new NNBackPropagation(model, xTrain, yTrain, lambda); double f = backPropagation->optimize(numLbfgsIterations); model = backPropagation->getUpdatedModel(); cout << "Training finished with cost: " << f << endl; /* ======== Showing performance ========= */ showResults(xTrain, yTrain, xCross, yCross, model); /* ======== Saving results ============= */ saveResults(model); system("PAUSE"); exit(0); }
// TODO: Track and display TPS in GUI. void GuiManager::runCurrentMatch() { interrupted_ = false; restarting_ = false; runnerConsole_->Hide(); destroyResultsDialog(); sf::RenderWindow *window = window_; try { while (window->isOpen() && !interrupted_ && !restarting_ && !quitting_) { while (!paused_ && !restarting_ && !engine_->isGameOver() && engine_->getGameTime() < nextDrawTime_) { engine_->processTick(); } while (!interrupted_ && !restarting_ && !quitting_ && (nextDrawTime_ <= engine_->getGameTime() || engine_->isGameOver())) { processMainWindowEvents(window, gfxManager_, viewWidth_, viewHeight_); clearTeamErroredForActiveConsoles(engine_); drawFrame(window); if (!paused_ && !engine_->isGameOver()) { nextDrawTime_ += tpsFactor_; } if (engine_->isGameOver() && !showedResults_) { ReplayBuilder *replayBuilder = engine_->getReplayBuilder(); Team **teams = engine_->getRankedTeams(); replayBuilder->setResults(teams, engine_->getNumTeams()); delete teams; showResults(replayBuilder); showedResults_ = true; } } } } catch (EngineException *e) { errorConsole_->println(e->what()); wxMessageDialog errorMessage(NULL, e->what(), "BerryBots encountered an error", wxOK | wxICON_EXCLAMATION); errorMessage.ShowModal(); newMatchDialog_->Show(); delete e; return; } if (!window->isOpen()) { listener_->onAllWindowsClosed(); } // TODO: Display CPU usage in GUI if (!interrupted_) { gfxManager_->destroyBbGfx(); delete engine_; engine_ = 0; delete gfxHandler_; gfxHandler_ = 0; } }
void HelloWorld::resetTest() { if(_testTimes < _allTestTimes) { _testTimes ++; initBattle(); } else { showResults(); } }
ScanDialog::ScanDialog(QWidget *parent, const char *name) : QDialog( parent) { setWindowTitle(name); setModal(false); ui.setupUi(this); scanthread=new Scanner(this); connect(ui.pushButtonBrowse, SIGNAL(clicked()), this, SLOT(browse())); connect(ui.pushButtonFind, SIGNAL(clicked()), this, SLOT(find())); connect(ui.pushButtonAbort, SIGNAL(clicked()), this, SLOT(abort())); connect(scanthread, SIGNAL(finished()), this, SLOT(showResults())); connect(scanthread, SIGNAL(fileCountChanged(int)), this, SLOT(setFileCount(int))); ui.pushButtonAbort->setEnabled(false); connect(ui.treeWidget, SIGNAL(itemDoubleClicked (QTreeWidgetItem*,int)), this, SLOT(ClickedOnResult(QTreeWidgetItem*,int))); }
int main(int numArgs, char* args[]) { AnSolv as; as.loadWords("words.txt"); // No args given, hence ask for word if (numArgs <= 1) { std::string q = ""; std::cout << "Query: "; getline(std::cin, q); showResults(q, as.search(q)); // Use given args } else { for (int i = 1; i < numArgs; i++) { showResults(args[i], as.search(args[i])); } } return 0; }
void MQLEdit::execQuery() { if(!_loggedIn) { QMessageBox::warning(this, tr("Not Connected"), tr("You must be connected to a database in order to execute a query.")); return; } _results->_table->setRowCount(0); _results->_table->setColumnCount(0); _sql->_log->clear(); _log->_log->clear(); _log->_log->append(tr("---- Parsing Query ----\n")); MetaSQLQuery mql(_text->toPlainText()); _log->_log->append(mql.parseLog()); if(mql.isValid()) { _log->_log->append(tr("Query parsed.")); _log->_log->append(tr("---- Executing Query ----")); ParameterList plist = _pEdit->getParameterList(); XSqlQuery qry = mql.toQuery(plist); _sql->_log->append(qry.executedQuery()); if(qry.isActive()) { QSqlRecord rec = qry.record(); int ncols = rec.count(); _results->_table->setColumnCount(ncols); int c; for(c = 0; c < ncols; c++) { _results->_table->setHorizontalHeaderItem(c, new QTableWidgetItem(rec.fieldName(c))); } int nrows = 0; while(qry.next()) { _results->_table->setRowCount(nrows + 1); for(c = 0; c < ncols; c++) { _results->_table->setItem(nrows, c, new QTableWidgetItem(qry.value(c).toString())); } nrows++; } showResults(); } else { _log->_log->append(tr("Failed to execute query.")); QSqlError err = qry.lastError(); _log->_log->append(err.text()); } } else { _log->_log->append(tr("ERROR: Invalid query!")); showLog(); } }
/** * @brief ConcertSearch::ConcertSearch * @param parent */ ConcertSearch::ConcertSearch(QWidget *parent) : QDialog(parent), ui(new Ui::ConcertSearch) { ui->setupUi(this); ui->results->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); ui->searchString->setType(MyLineEdit::TypeLoading); #ifdef Q_WS_MAC setWindowFlags((windowFlags() & ~Qt::WindowType_Mask) | Qt::Sheet); setStyleSheet(styleSheet() + " #ConcertSearch { border: 1px solid rgba(0, 0, 0, 100); border-top: none; }"); #else setWindowFlags((windowFlags() & ~Qt::WindowType_Mask) | Qt::Dialog); #endif foreach (ConcertScraperInterface *scraper, Manager::instance()->concertScrapers()) { ui->comboScraper->addItem(scraper->name(), Manager::instance()->concertScrapers().indexOf(scraper)); connect(scraper, SIGNAL(searchDone(QList<ScraperSearchResult>)), this, SLOT(showResults(QList<ScraperSearchResult>))); }
MQLEdit::MQLEdit(QWidget* parent, Qt::WindowFlags fl) : QMainWindow(parent, fl) { setupUi(this); (void)statusBar(); // signals and slots connections connect(fileNewAction, SIGNAL(activated()), this, SLOT(fileNew())); connect(fileOpenAction, SIGNAL(activated()), this, SLOT(fileOpen())); connect(fileSaveAction, SIGNAL(activated()), this, SLOT(fileSave())); connect(fileSaveAsAction, SIGNAL(activated()), this, SLOT(fileSaveAs())); connect(filePrintAction, SIGNAL(activated()), this, SLOT(filePrint())); connect(fileExitAction, SIGNAL(activated()), this, SLOT(fileExit())); connect(editFindAction, SIGNAL(activated()), this, SLOT(editFind())); connect(helpIndexAction, SIGNAL(activated()), this, SLOT(helpIndex())); connect(helpContentsAction, SIGNAL(activated()), this, SLOT(helpContents())); connect(helpAboutAction, SIGNAL(activated()), this, SLOT(helpAbout())); connect(fileDatabaseConnectAction, SIGNAL(activated()), this, SLOT(fileDatabaseConnect())); connect(fileDatabaseDisconnectAction, SIGNAL(activated()), this, SLOT(fileDatabaseDisconnect())); connect(viewParameter_ListAction, SIGNAL(activated()), this, SLOT(showParamList())); connect(toolsParse_QueryAction, SIGNAL(activated()), this, SLOT(parseQuery())); connect(toolsExecute_QueryAction, SIGNAL(activated()), this, SLOT(execQuery())); connect(viewLog_OutputAction, SIGNAL(activated()), this, SLOT(showLog())); connect(viewResultsAction, SIGNAL(activated()), this, SLOT(showResults())); connect(viewExecuted_SQLAction, SIGNAL(activated()), this, SLOT(showExecutedSQL())); QSqlDatabase db = QSqlDatabase(); if(_loggedIn && db.isValid() && db.isOpen()) { _loggedIn = true; } else { _loggedIn = false; } fileDatabaseConnectAction->setEnabled(!_loggedIn); fileDatabaseDisconnectAction->setEnabled(_loggedIn); _pEdit = new ParameterEdit(this); _log = new LogOutput(this); _sql = new LogOutput(this); _results = new ResultsOutput(this); }
void studrating::on_contentsWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous) { if(!current) current = previous; ui->pagesWidget->setCurrentIndex(ui->contentsWidget->row(current)); switch(ui->pagesWidget->currentIndex()) { case 0: break; case 1: showDisciplinList(); break; case 2: showGroupslinList(); break; case 3: manager->setDisciplinView(ui->srDisciplinComboBox); manager->setGroupView(ui->srGroupsComboBox); showCriteriaAdvances(); break; case 4: manager->setDisciplinView(ui->ratingDisciplinComboBox); manager->setGroupView(ui->ratingGroupsComboBox); setCriterionList(); showRating(); break; case 5: manager->setDisciplinView(ui->resultDisciplinComboBox); manager->setGroupView(ui->resultGroupComboBox); showResults(); break; default: break; } }
void ReplayGain::scannerDone() { TrackScanner *s=qobject_cast<TrackScanner *>(sender()); if (!s) { return; } Track &track=tracks[s->index()]; if (!track.finished) { track.finished=true; track.success=s->success(); track.progress=100; showProgress(); totalScanned++; } if (toScan.isEmpty()) { if (totalScanned==files.count()) { showResults(); } } else { int index=toScan.takeAt(0); createScanner(index); } }
int wmain( int argc, LPTSTR argv[] ) { // Vars declarations int targetDirInd = 0; BOOL flags[ MAX_OPTIONS ] = { 0 }; TCHAR workDir[ MAX_PATH ] = { 0 }; TCHAR targetDir[ MAX_PATH ] = { 0 }; DWORD workLength = 0; List resultsList = { 0 }; Item resultsItem = { 0 }; PVOID oldValueWow64 = NULL; BOOL wow64Disabled = FALSE; TCHAR* ptTchar = NULL; // Get index of first argument after options // Also determine which options are active targetDirInd = Options( argc, argv, TEXT( "h" ), &flags[ FL_HELP ], NULL ); // Get current working dir workLength = GetCurrentDirectory( _countof( workDir ), workDir ); // Validate target dir if ( ( argc > targetDirInd + 1 ) || flags[ FL_HELP ] ) { // More than one target or // target with gaps (no quotes) specified or // asked for help // Print usage wprintf_s( TEXT( "\n Usage: jdots [options] [target dir]\n\n" ) ); wprintf_s( TEXT( " Options:\n\n" ) ); wprintf_s( TEXT( " -h : Print usage\n\n" ) ); wprintf_s( TEXT( " If no target dir is specified, then the current working dir will be used\n" ) ); return 1; } else if ( ( argc < targetDirInd + 1 ) && ( workLength <= MAX_PATH - 3 ) ) { // No target specified --> assume current dir wcscpy_s( targetDir, MAX_PATH, workDir ); } else if ( argc == targetDirInd + 1 ) { // One target specified // Validate target dir starting with '\' if ( argv[ targetDirInd ][ 0 ] == '\\' ) { // Fetch drive letter from working dir wcsncpy_s( targetDir, MAX_PATH, workDir, 2 ); } // Append passed dir to target dir wcscat_s( targetDir, MAX_PATH, argv[ targetDirInd ] ); } // Set up absolute target dir --> resolve '.' and '..' in target dir if ( !SetCurrentDirectory( targetDir ) ) { ReportError( TEXT( "\nTarget directory not found.\n" ), 0, TRUE ); return 1; } // Display absolute target dir GetCurrentDirectory( _countof( targetDir ), targetDir ); wprintf_s( TEXT( "\n Target dir: \"%s\"\n\n" ), targetDir ); // Initialize results list InitializeList( &resultsList ); // Initialize list's name (measurement name) ptTchar = wcsrchr( targetDir, L'\\' ); if ( ptTchar != NULL ) IniListName( &resultsList, ptTchar + 1 ); else IniListName( &resultsList, TEXT( "" ) ); // Check mem availability if ( ListIsFull( &resultsList ) ) { wprintf_s( TEXT( "\nNo memory available!\n" ) ); return 1; } // Disable file system redirection wow64Disabled = Wow64DisableWow64FsRedirection( &oldValueWow64 ); // Scan target dir scanDir( targetDir, &resultsList, &resultsItem ); // Re-enable redirection if ( wow64Disabled ) { if ( !( Wow64RevertWow64FsRedirection( oldValueWow64 ) ) ) ReportError( TEXT( "Re-enable redirection failed." ), 1, TRUE ); } // Display results if ( ListIsEmpty( &resultsList ) ) wprintf_s( TEXT( "\nNo data.\n\n" ) ); else { // Sort by name (a to Z) SortList( &resultsList, cmpItemsName ); // Display sorted results showResults( &resultsList, &resultsItem ); // Generate KML file outputKml( &resultsList ); } // Housekeeping EmptyTheList( &resultsList ); return 0; }
//MAIN FUNCTION int main(int argc, const char *argv[]){ int i; const char **tabFile; const char **tabUrl; int stdin_bool = FALSE; pthread_t file; pthread_t url; pthread_t Stdin; //recherche des différents données sur les paramètres for(i=1;i<argc;i++){ if(strcmp("-maxthreads",argv[i])==0){ N=atoi(argv[i+1]); i++;} else if(strcmp("-stdin",argv[i])==0){ stdin_bool = TRUE;} else if(strlen(argv[i])>9){ //nombre de caractère nécessaire pour une URL valide if(argv[i][4]==':'){ sizetabUrl++; } else { sizetabFile++; } } else { sizetabFile++; } } //création des tableau d'argument par type tabFile = malloc(sizetabFile*sizeof(char *)); tabUrl = malloc(sizetabFile*sizeof(char *)); int runnerf=0; int runnerurl=0; for(i=1;i<argc;i++){ if(strcmp("-maxthreads",argv[i])==0 || strcmp("-stdin",argv[i])==0){ i++;} else if(strlen(argv[i])>9){ //nombre de caractère nécessaire pour une URL valide A CHANGER P E if(argv[i][4]==':'){ tabUrl[runnerurl] = argv[i]; runnerurl++; } else { tabFile[runnerf] = argv[i]; runnerf++; } } else { tabFile[runnerf] = argv[i]; runnerf++; } } //intialisation init(); //création des arguments pour les threads de récupération struct tabArgThread1 *arg1 = malloc(sizeof(struct tabArgThread1)); arg1->tab = tabFile; struct tabArgThread1 *arg2 = malloc(sizeof(struct tabArgThread1)); arg2->tab = tabUrl; //lancement des threads de récupération if(stdin_bool){ err=pthread_create(&Stdin, NULL, &importFromStdin, NULL); } err = pthread_create(&file, NULL,&importFromFile,(void *) arg1); //err = pthread_create(&url, NULL,&importFromUrl,(void *) arg2); pthread_t tabThread[N]; int j; for(j=0;j<N;j++){ err=pthread_create(&tabThread[j],NULL,&factorisation,(void *) &Arg1); } pthread_t compteur; err=pthread_create(&compteur,NULL,&comptabilisateur,(void *) &Arg2); err=pthread_join(file,NULL); //err=pthread_join(url,NULL); if(stdin_bool){ err=pthread_join(Stdin,NULL); } int boolean_wait = TRUE; int elem; int iterateur; while(boolean_wait){ iterateur =0; err=pthread_mutex_lock(&mutex1); elem= 0; while(elem==0){ if(iterateur==N){ boolean_wait=FALSE; elem=1;//permet de sortir du do...while for(j=0;j<N;j++){ tabNbr[0][j]=-1; sem_post(&full1); } } else{ elem = tabNbr[0][iterateur]; iterateur++; } } err=pthread_mutex_unlock(&mutex1); } for(j=0;j<N;j++){ err=pthread_join(tabThread[j],NULL); } boolean_wait=1; while(boolean_wait){ iterateur =0; err=pthread_mutex_lock(&mutex2); do{ if(iterateur==N){ boolean_wait=FALSE; elem=1;//permet de sortir du do...while tabFact[0][0]=-1; // fichier = (structure->tabNbr)[1][parcour]; C'est quoi cette daube? sem_post(&full2); } else{ elem = tabFact[0][iterateur]; iterateur++; } } while(elem==0); err=pthread_mutex_unlock(&mutex2); } err=pthread_join(compteur,NULL); showResults(tabFile, tabUrl); //PAS oublier de libérer tableau!! //Regarder comment on est sensé retourner les valeurs!!!! //printf("%s\n",tabFile[1]); return(EXIT_SUCCESS); }
DnsManager::DnsManager() { dns = new QDnsLookup(this); connect(dns, SIGNAL(finished()), this, SLOT(showResults())); }
int wmain( int argc, LPTSTR argv[] ) { // Declare vars TCHAR targetDir[ MAX_PATH ] = { 0 }; TCHAR workDir[ MAX_PATH ] = { 0 }; DWORD targetLength = 0; DWORD workLength = 0; Item resultsItem = { 0 }; List resultsList = { 0 }; LARGE_INTEGER freq; LARGE_INTEGER startingT, endingT, elapsedTicks; BOOL flags[ MAX_OPTIONS ] = { 0 }; int targetDirInd = 0; PVOID oldValueWow64 = NULL; BOOL wow64Disabled = FALSE; // Fetch frec & initial ticks count QueryPerformanceFrequency( &freq ); QueryPerformanceCounter( &startingT ); // Get index of first argument after options // Also determine which options are active targetDirInd = Options( argc, argv, TEXT( "sfdmnthb" ), &flags[ FL_SIZE ], &flags[ FL_FILES ], &flags[ FL_DIRS ], &flags[ FL_MODIF ], &flags[ FL_NAME ], &flags[ FL_TYPE ], &flags[ FL_HELP ], &flags[ FL_DBG ], NULL ); // Get current working dir workLength = GetCurrentDirectory( _countof( workDir ), workDir ); // Validate target dir if ( ( argc > targetDirInd + 1 ) || flags[ FL_HELP ] ) { // More than one target or // target with gaps (no quotes) specified or // asked for help // Print usage wprintf_s( TEXT( "\n Usage: dgl [options] [target dir]\n\n" ) ); wprintf_s( TEXT( " Options:\n\n" ) ); wprintf_s( TEXT( " -s : Sort by size [bytes] (default)\n" ) ); wprintf_s( TEXT( " -f : Sort by files count (descending)\n" ) ); wprintf_s( TEXT( " -d : Sort by dirs count (descending)\n" ) ); wprintf_s( TEXT( " -m : Sort by date modified (latest to earliest)\n" ) ); wprintf_s( TEXT( " -n : Soft by name (a to Z)\n" ) ); wprintf_s( TEXT( " -t : Sort by type (<DIR>, <LIN>, file)\n" ) ); wprintf_s( TEXT( " -h : Print usage\n" ) ); wprintf_s( TEXT( " -b : Extended output (debug purposes)\n\n" ) ); wprintf_s( TEXT( " If no option is specidied, then '-s' will be used\n" ) ); wprintf_s( TEXT( " If no target dir is specified, then the current working dir will be used\n" ) ); return 1; } else if ( ( argc < targetDirInd + 1 ) && ( workLength <= MAX_PATH - 3 ) ) { // No target specified --> assume current dir wcscpy_s( targetDir, MAX_PATH, workDir ); } else if ( argc == targetDirInd + 1 ) { // One target specified // Validate target dir starting with '\' if ( argv[ targetDirInd ][ 0 ] == '\\' ) { // Fetch drive letter from working dir wcsncpy_s( targetDir, MAX_PATH, workDir, 2 ); } // Append passed dir to target dir wcscat_s( targetDir, MAX_PATH, argv[ targetDirInd ] ); } // Set up absolute target dir --> resolve '.' and '..' in target dir if ( !SetCurrentDirectory( targetDir ) ) { ReportError( TEXT( "\nTarget directory not found.\n" ), 0, TRUE ); return 1; } // Display absolute target dir GetCurrentDirectory( _countof( targetDir ), targetDir ); wprintf_s( TEXT( "\n Target dir: \"%s\"\n\n" ), targetDir ); // Initialize results list InitializeList( &resultsList ); if ( ListIsFull( &resultsList ) ) { wprintf_s( TEXT( "\nNo memory available!\n" ) ); return 1; } // Debug output if ( flags[ FL_DBG ] ) wprintf_s( TEXT( " %s\n" ), targetDir ); // Disable file system redirection wow64Disabled = Wow64DisableWow64FsRedirection( &oldValueWow64 ); // Scan target dir scanDir( targetDir, &resultsList, &resultsItem, TRUE, flags[ FL_DBG ] ); // Re-enable redirection if ( wow64Disabled ) { if ( !( Wow64RevertWow64FsRedirection( oldValueWow64 ) ) ) ReportError( TEXT( "Re-enable redirection failed." ), 1, TRUE ); } // Display results if ( ListIsEmpty( &resultsList ) ) wprintf_s( TEXT( "\nNo data.\n\n" ) ); else { // Sort results // if-else chain determines sorting priority // one sorting type high prio excludes low prio types if ( flags[ FL_SIZE ] ) // Sort by size (descending) SortList( &resultsList, cmpItemsSizeCount ); else if ( flags[ FL_FILES ] ) // Sort by files count (descending) SortList( &resultsList, cmpItemsFilesCount ); else if ( flags[ FL_DIRS ] ) // Sort by dirs count (descending) SortList( &resultsList, cmpItemsDirsCount ); else if ( flags[ FL_MODIF ] ) // Sort by modification date (latest to earliest) SortList( &resultsList, cmpItemsLastWriteTime ); else if ( flags[ FL_NAME ] ) // Sort by name (a to Z) SortList( &resultsList, cmpItemsName ); else // Default: sort by size (descending) SortList( &resultsList, cmpItemsSizeCount ); // Debug output if ( flags[ FL_DBG ] ) wprintf_s( TEXT( "\n" ) ); // Display sorted results showResults( &resultsList, &resultsItem ); } // Housekeeping EmptyTheList( &resultsList ); // Fetch final ticks count QueryPerformanceCounter( &endingT ); // Calc elapsed ticks elapsedTicks.QuadPart = endingT.QuadPart - startingT.QuadPart; // Calc and display elapsed time calcDispElapTime( &elapsedTicks.QuadPart, &freq.QuadPart ); return 0; }
TrailerDialog::TrailerDialog(QWidget *parent) : QDialog(parent), ui(new Ui::TrailerDialog) { ui->setupUi(this); #ifdef Q_OS_MAC QFont font = ui->trailers->font(); font.setPointSize(font.pointSize()-1); ui->trailers->setFont(font); ui->time->setFont(font); #endif ui->results->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); ui->trailers->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); ui->trailers->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents); ui->trailers->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents); ui->searchString->setType(MyLineEdit::TypeLoading); ui->stackedWidget->setAnimation(QEasingCurve::OutCubic); ui->stackedWidget->setSpeed(400); #ifdef Q_OS_MAC // setWindowFlags((windowFlags() & ~Qt::WindowType_Mask) | Qt::Sheet); #else setWindowFlags((windowFlags() & ~Qt::WindowType_Mask) | Qt::Dialog); #endif m_qnam = new QNetworkAccessManager(this); foreach (TrailerProvider *provider, Manager::instance()->trailerProviders()) { ui->comboScraper->addItem(provider->name(), Manager::instance()->trailerProviders().indexOf(provider)); connect(provider, SIGNAL(sigSearchDone(QList<ScraperSearchResult>)), this, SLOT(showResults(QList<ScraperSearchResult>))); connect(provider, SIGNAL(sigLoadDone(QList<TrailerResult>)), this, SLOT(showTrailers(QList<TrailerResult>))); }
MQLEdit::MQLEdit(QWidget* parent, Qt::WindowFlags fl) : QWidget(parent, fl) { setupUi(this); if (OpenRPT::name.isEmpty()) OpenRPT::name = tr("MetaSQL Editor"); _mqlSelector = 0; _document = _text->document(); _document->setDefaultFont(QFont("Courier")); connect(_document, SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool))); connect(editFindAction, SIGNAL(triggered()), this, SLOT(editFind())); connect(fileDatabaseConnectAction, SIGNAL(triggered()), this, SLOT(fileDatabaseConnect())); connect(fileDatabaseDisconnectAction,SIGNAL(triggered()), this, SLOT(fileDatabaseDisconnect())); connect(fileDatabaseOpenAction, SIGNAL(triggered()), this, SLOT(fileDatabaseOpen())); connect(fileDatabaseSaveAsAction, SIGNAL(triggered()), this, SLOT(fileDatabaseSaveAs())); connect(fileExitAction, SIGNAL(triggered()), this, SLOT(fileExit())); connect(fileNewAction, SIGNAL(triggered()), this, SLOT(fileNew())); connect(fileOpenAction, SIGNAL(triggered()), this, SLOT(fileOpen())); connect(filePrintAction, SIGNAL(triggered()), this, SLOT(filePrint())); connect(fileSaveAction, SIGNAL(triggered()), this, SLOT(fileSave())); connect(fileSaveAsAction, SIGNAL(triggered()), this, SLOT(fileSaveAs())); connect(helpAboutAction, SIGNAL(triggered()), this, SLOT(helpAbout())); connect(helpContentsAction, SIGNAL(triggered()), this, SLOT(helpContents())); connect(helpIndexAction, SIGNAL(triggered()), this, SLOT(helpIndex())); connect(searchForParametersAction, SIGNAL(triggered()), this, SLOT(populateParameterEdit())); connect(toolsExecute_QueryAction, SIGNAL(triggered()), this, SLOT(execQuery())); connect(toolsParse_QueryAction, SIGNAL(triggered()), this, SLOT(parseQuery())); connect(viewExecuted_SQLAction, SIGNAL(triggered()), this, SLOT(showExecutedSQL())); connect(viewLog_OutputAction, SIGNAL(triggered()), this, SLOT(showLog())); connect(viewParameter_ListAction, SIGNAL(triggered()), this, SLOT(showParamList())); connect(viewResultsAction, SIGNAL(triggered()), this, SLOT(showResults())); QSqlDatabase db = QSqlDatabase().database(); if(db.isValid() && db.isOpen()) OpenRPT::loggedIn = true; else { OpenRPT::loggedIn = false; db = QSqlDatabase(); } if (parent) // then must be embedded { if (DEBUG) qDebug("MQLEdit::MQLEdit(%p) OpenRPT::loggedIn = %d", parent, OpenRPT::loggedIn); fileDatabaseConnectAction->setVisible(! OpenRPT::loggedIn); fileDatabaseDisconnectAction->setVisible(! OpenRPT::loggedIn); fileExitAction->setText(tr("Close")); QToolBar *menuproxy = new QToolBar(this); menuproxy->setObjectName("menuproxy"); menuproxy->setOrientation(Qt::Horizontal); verticalLayout->insertWidget(0, menuproxy); menuproxy->addAction(fileMenu->menuAction()); menuproxy->addAction(editMenu->menuAction()); menuproxy->addAction(ViewMenu->menuAction()); menuproxy->addAction(ToolsMenu->menuAction()); menuproxy->addAction(helpMenu->menuAction()); } fileDatabaseConnectAction->setEnabled(!OpenRPT::loggedIn); fileDatabaseDisconnectAction->setEnabled(OpenRPT::loggedIn); fileDatabaseOpenAction->setEnabled(OpenRPT::loggedIn); fileDatabaseSaveAsAction->setEnabled(OpenRPT::loggedIn); _pEdit = new ParameterEdit(this, Qt::Window); _log = new LogOutput(this); _sql = new LogOutput(this); _results = new ResultsOutput(this); _highlighter = new MetaSQLHighlighter(_document); clear(); setDestType(MQLUnknown); }