void MainWindow::onActionOpenTriggered() { QString fn = QFileDialog::getOpenFileName( 0, tr("Open OPC Package"), m_recentFilesList.isEmpty() ? "" : m_recentFilesList[0], "Office files (*.xlsx *.docx *.pptx);;All files(*.*)"); if (fn.isEmpty()) return; openPackage(fn); }
void MainWindow::onActionRecentFileTriggered() { QAction *act = qobject_cast<QAction *>(sender()); QString fileName = act->data().toString(); if (!openPackage(fileName)) { m_recentFilesList.removeOne(fileName); updateRecentFilesMenu(); } }
bool packPackage(const wchar_t* sourceDir, const wchar_t* packagePath, bool isBfeFormat) { writeLog(LOG_NORMAL, L"Packing files under directory: %s", sourceDir); writeLog(LOG_NORMAL, L"To package: %s", packagePath); NexasPackage* package = openPackage(packagePath); if (!package) return false; bool result = determineEntryCountAndWriteHeader(package, sourceDir, isBfeFormat) && recordAndWriteEntries(package, isBfeFormat) && writeIndexes(package, isBfeFormat); closePackage(package); writeLog(LOG_NORMAL, (result) ? L"Packing Successful." : L"ERROR: Packing Failed."); return result; }
bool unpackPackage(const wchar_t* packagePath, const wchar_t* targetDir) { writeLog(LOG_NORMAL, L"Unpacking package: %s", packagePath); writeLog(LOG_NORMAL, L"To Directory: %s", targetDir); if (!fsEnsureDirectoryExists(targetDir)) { writeLog(LOG_QUIET, L"ERROR: Target directory does not exist and cannot be created.", targetDir); return false; } NexasPackage* package = openPackage(packagePath); if (!package) return false; bool result = validateHeader(package) && readIndex(package) && extractFiles(package, targetDir); closePackage(package); writeLog(LOG_NORMAL, (result) ? L"Unpacking Successful." : L"ERROR: Unpacking Failed."); return result; }
VisualizeSquareMazeRunner::VisualizeSquareMazeRunner (SquareMaze *_maze) { pauseTimeInSec=0.05; // default maze=_maze; maze->setChangeListener(this); // set up our window int windowWidth,windowHeight; windowWidth=maze->getWidth()*PixelsPerNode; windowHeight=maze->getHeight()*PixelsPerNode; openPackage(windowWidth+1,windowHeight+1); drawInitialWindow(); flush(); // flush graphics operations to screen }