//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RIApplication::loadProject(const QString& projectFileName) { if (!closeProject(true)) return false; if (!QFile::exists(projectFileName)) return false; m_project->fileName = projectFileName; m_project->readFile(); if (m_project->projectFileVersionString().isEmpty()) { closeProject(false); QString tmp = QString("Unknown project file version detected in file \n%1\n\nCould not open project.").arg(projectFileName); QMessageBox::warning(NULL, "Error when opening project file", tmp); RIMainWindow* mainWnd = RIMainWindow::instance(); mainWnd->setPdmRoot(NULL); // Delete all object possibly generated by readFile() delete m_project; m_project = new RimProject; } else { m_preferences->lastUsedProjectFileName = projectFileName; writePreferences(); size_t i; for (i = 0; i < m_project->reservoirs().size(); ++i) { RimReservoir* ri = m_project->reservoirs()[i]; CVF_ASSERT(ri); size_t j; for (j = 0; j < ri->reservoirViews().size(); j++) { RimReservoirView* riv = ri->reservoirViews()[j]; CVF_ASSERT(riv); riv->loadDataAndUpdate(); } } } onProjectOpenedOrClosed(); return true; }
//--------------------------------------------------------------------------- //создаём новый проект Project & ProjectManager::newProject() { closeProject(); currentProject = new Project(); setIsProjectOpen(true); return *currentProject; }
void RunContextManager::setDateTimeOutputDir() { closeProject(); m_OutputDir = m_UserDataDir + "/" + "OPENFLUID." + QDateTime::currentDateTime().toString("yyyyMMdd'T'hhmmss").toStdString() + ".OUT"; updateWaresEnvironment(); }
void MainWindow::openProject(const QString& fileName) { QDomDocument doc; QFile file(fileName); if (!file.open(QIODevice::ReadOnly)) { QMessageBox::information(this, "Information", "Could not open the project file: " + fileName); return; } if (!doc.setContent(&file)) { QMessageBox::information(this, "Information", "Could not parse the project file: " + fileName); file.close(); return; } file.close(); closeProject(); projectFileName_ = fileName; libraryWidget_->loadXml(projectFileName_, doc); updateUI(); setWindowTitle(projectName() + "[*] - " + tr("Gideros")); addToRecentProjects(projectFileName_); }
/* //////////////////////////////////////////////////////////////////////////// * Exit Application */ void TTMpeg2MainWnd::onExit() { if (isProjectOpen) closeProject(); qApp->quit(); }
/** * Handles the "Project->Open" action. * Displays the "Open Project" dialogue. */ void MainWindow::openProject() { // If an active project exists, it needs to be closed first. if (ProjectManager::hasProject()) { QString msg = tr("The active project needs to be closed.\n" "Would you like to close it now?"); int result = QMessageBox::question(this, tr("Close Project"), msg, QMessageBox::Yes | QMessageBox::No); if (result == QMessageBox::No || !closeProject()) return; } // Show the "Open Project" dialogue. OpenProjectDialog dlg(this); switch (dlg.exec()) { case OpenProjectDialog::Open: try { ProjectManager::load<Cscope::ManagedProject>(dlg.path()); } catch (Core::Exception* e) { e->showMessage(); delete e; } break; case OpenProjectDialog::New: newProject(); break; default: ; } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); connect(ui->actionNew_project, SIGNAL(triggered()), SLOT(addNewProject())); connect(ui->actionOpen_project, SIGNAL(triggered()), SLOT(openProject())); connect(ui->actionSave_project, SIGNAL(triggered()), SLOT(saveProject())); connect(ui->actionSave_project_as, SIGNAL(triggered()), SLOT(saveProjectAs())); connect(ui->actionClose_project, SIGNAL(triggered()), SLOT(closeProject())); connect(ui->actionUndo, SIGNAL(triggered()), SLOT(undo())); connect(ui->actionRedo, SIGNAL(triggered()), SLOT(redo())); connect(ui->actionImport, SIGNAL(triggered()), SLOT(importProject())); connect(ui->actionExport, SIGNAL(triggered()), SLOT(exportProject())); connect(ui->actionAbout, SIGNAL(triggered()), SLOT(showAbout())); connect(ui->actionAbout_Qt, SIGNAL(triggered()), SLOT(showAboutQt())); QString fileName = //"/home/gogi/Downloads/pcsc_pcsc_00001.vcf"; "G:\\pcsc_pcsc_00001.vcf"; QFile file(fileName); //showProject(new VCardProject(file)); updateProjectState(); }
void ProjectWindow::openProject() { bool autoOpen = ebe["project/auto_open"].toBool(); if (projectFileName != "") closeProject(); QString filename = QFileDialog::getOpenFileName(this, tr("Select project name"), 0, tr("Projects (*.ebe)")); if (filename != "") { QFile file(filename); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; QTextStream in(&file); QString name; name = in.readLine(); int i = 0; while (!name.isNull()) { fileNames.append(QDir::current().absoluteFilePath(name)); list->addItem(QDir::current().relativeFilePath(name)); if (autoOpen) { sourceFrame->open(name, i); i++; } name = in.readLine(); } projectFileName = filename; } }
void ProjectView::slotProject(int id) { ProjectViewItem *item = dynamic_cast<ProjectViewItem*>(currentItem()); if(item) { if(item->type() == KileType::Project) { switch(id) { case KPV_ID_BUILDTREE: emit(buildProjectTree(item->url())); break; case KPV_ID_OPTIONS: emit(projectOptions(item->url())); break; case KPV_ID_CLOSE: emit(closeProject(item->url())); return; //don't access "item" later on case KPV_ID_ARCHIVE: emit(projectArchive(item->url())); break; case KPV_ID_ADDFILES: emit(addFiles(item->url())); break; case KPV_ID_OPENALLFILES: emit(openAllFiles(item->url())); break; default: break; } } } }
bool ProjectContentComponent::perform (const InvocationInfo& info) { switch (info.commandID) { case CommandIDs::saveProject: case CommandIDs::closeProject: case CommandIDs::saveDocument: case CommandIDs::saveDocumentAs: case CommandIDs::closeDocument: case CommandIDs::goToPreviousDoc: case CommandIDs::goToNextDoc: case CommandIDs::goToCounterpart: case CommandIDs::saveAndOpenInIDE: if (reinvokeCommandAfterCancellingModalComps (info)) { grabKeyboardFocus(); // to force any open labels to close their text editors return true; } break; default: break; } if (isCurrentlyBlockedByAnotherModalComponent()) return false; switch (info.commandID) { case CommandIDs::saveProject: saveProject(); break; case CommandIDs::closeProject: closeProject(); break; case CommandIDs::saveDocument: saveDocument(); break; case CommandIDs::saveDocumentAs: saveAs(); break; case CommandIDs::closeDocument: closeDocument(); break; case CommandIDs::goToPreviousDoc: goToPreviousFile(); break; case CommandIDs::goToNextDoc: goToNextFile(); break; case CommandIDs::goToCounterpart: goToCounterpart(); break; case CommandIDs::showFilePanel: showFilesTab(); break; case CommandIDs::showConfigPanel: showConfigTab(); break; case CommandIDs::showProjectSettings: showProjectSettings(); break; case CommandIDs::showProjectModules: showModules(); break; case CommandIDs::openInIDE: openInIDE (false); break; case CommandIDs::saveAndOpenInIDE: openInIDE (true); break; case CommandIDs::createNewExporter: showNewExporterMenu(); break; case CommandIDs::deleteSelectedItem: deleteSelectedTreeItems(); break; case CommandIDs::showTranslationTool: showTranslationTool(); break; default: return false; } return true; }
void MainWindow::newProject() { if(m_project) { if(!closeProject()) return; } //TODO show project wizard m_project = new Project(); m_project->setName("Test Project"); connect (m_project, SIGNAL(projectChanged()), this, SLOT(unsavedChanges())); showProjectView(); m_unsavedChanges = false; ui->actSaveProject->setEnabled(true); ui->actSaveProjectAs->setEnabled(true); ui->actCloseProject->setEnabled(true); ui->actImportAutomaton->setEnabled(true); ui->menuAutomata->setEnabled(true); ui->menuServer->setEnabled(true); ui->actShowSettings->setEnabled(true); ui->actDeleteAutomaton->setEnabled(true); m_projectWidget->setMode("unknown"); }
void TupMainWindow::setupFileActions() { TAction *newProject = new TAction(QPixmap(THEME_DIR + "icons/new.png"), tr("New project"), QKeySequence(tr("Ctrl+N")), this, SLOT(newProject()), m_actionManager); newProject->setStatusTip(tr("Open new project")); m_actionManager->insert(newProject, "newproject", "file"); TAction *openFile = new TAction(QPixmap(THEME_DIR + "icons/open.png"), tr("Open project"), QKeySequence(tr("Ctrl+O")), this, SLOT(openProject()), m_actionManager); m_actionManager->insert( openFile, "openproject", "file" ); openFile->setStatusTip(tr("Load existent project")); TAction *openNetFile = new TAction(QPixmap(THEME_DIR + "icons/net_document.png"), tr("Open project from server..."), tr(""), this, SLOT(openProjectFromServer()), m_actionManager); m_actionManager->insert(openNetFile, "opennetproject", "file"); TAction *importNetFile = new TAction(QPixmap(THEME_DIR + "icons/import_project.png"), tr("Export project to server..."), tr(""), this, SLOT(importProjectToServer()), m_actionManager); m_actionManager->insert(importNetFile, "exportprojectserver", "file"); TAction *save = new TAction(QPixmap(THEME_DIR + "icons/save.png"), tr( "Save project" ), QKeySequence(tr("Ctrl+S")), this, SLOT(saveProject()), m_actionManager); m_actionManager->insert(save, "saveproject", "file"); save->setStatusTip(tr("Save current project in current location")); TAction *saveAs = new TAction(QPixmap(THEME_DIR + "icons/save_as.png"), tr("Save project &As..."), QKeySequence(tr("Ctrl+Shift+S")), m_actionManager); connect(saveAs, SIGNAL(triggered()), this, SLOT(saveAs())); saveAs->setStatusTip(tr("Open dialog box to save current project in any location")); m_actionManager->insert(saveAs, "saveprojectas", "file"); TAction *close = new TAction(QPixmap(THEME_DIR + "icons/close.png"), tr("Cl&ose project"), QKeySequence(tr("Ctrl+W")), m_actionManager); connect(close, SIGNAL(triggered()), this, SLOT(closeProject())); close->setStatusTip(tr("Close active project")); m_actionManager->insert(close, "closeproject", "file"); // Import Palette action TAction *importPalette = new TAction(QPixmap(THEME_DIR + "icons/import.png"), tr("&Import GIMP palettes"), QKeySequence(tr("Ctrl+G")), this, SLOT(importPalettes()), m_actionManager); importPalette->setStatusTip(tr("Import palettes")); m_actionManager->insert(importPalette, "importpalettes", "file"); // Export Project action TAction *exportProject = new TAction(QPixmap(THEME_DIR + "icons/export.png"), tr("&Export Project"), QKeySequence(tr("Ctrl+R")), this, SLOT(exportProject()), m_actionManager); exportProject->setStatusTip(tr("Export project to several video formats")); m_actionManager->insert(exportProject, "export", "file"); // Exit action TAction *exit = new TAction(QPixmap(THEME_DIR + "icons/exit.png"), tr("E&xit"), QKeySequence(tr("Ctrl+Q")), qApp, SLOT(closeAllWindows()), m_actionManager); exit->setStatusTip(tr("Close application")); m_actionManager->insert(exit, "exit", "file"); // when the last window is closed, the application should quit connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit())); }
void MainWindow::writeSettings() { //Close active project if any... closeProject(); QSettings settings; settings.setValue("pos", pos()); settings.setValue("size", size()); }
void MainWindow::closeEvent(QCloseEvent *event) { if (closeProject() == false) { event->ignore(); return; } QMainWindow::closeEvent(event); }
void MainWindow::closeEvent(QCloseEvent *event) { if(closeProject()) { writeSettings(); event->accept(); } else { event->ignore(); } }
IProject *ProjectManager::loadProject(const QString &filePath) { if (project && project->filePath() == filePath) { this->reloadProject(); return project; } ProjectFile * file = new ProjectFile(this); if (file->open(filePath)) { closeProject(); project = file; connect(project,SIGNAL(closeProject()),this,SLOT(closeProject())); connect(project,SIGNAL(reloadProject()),this,SLOT(reloadProject())); resetProjectTree(); liteApp->projectEvent()->fireProjectChanged(project); return project; } else { delete file; } return NULL; }
/** * Handles the "Project->New..." action. * Closes the current project, and displays the "New Project" dialogue. */ void MainWindow::newProject() { // If an active project exists, it needs to be closed first. if (ProjectManager::hasProject()) { QString msg = tr("The active project needs to be closed.\n" "Would you like to close it now?"); int result = QMessageBox::question(this, tr("Close Project"), msg, QMessageBox::Yes | QMessageBox::No); if (result == QMessageBox::No || !closeProject()) return; } redo: // Show the "New Project" dialogue. ProjectDialog dlg(this); dlg.setParamsForProject<Cscope::ManagedProject>(NULL); if (dlg.exec() == QDialog::Rejected) return; // Get the new parameters from the dialogue. Core::ProjectBase::Params params; dlg.getParams<Cscope::ManagedProject>(params); try { QDir dir(params.projPath_); if (dir.exists()) { QString msg = QString("'%1' already exists, overwrite it?").arg(params.projPath_); int result = QMessageBox::question(this, tr("New Project"), msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (result == QMessageBox::No) goto redo; //Yes FileUtils::removeDir(params.projPath_, false); } // Create a project. Cscope::ManagedProject proj; proj.create(params); // Load the new project. ProjectManager::load<Cscope::ManagedProject>(params.projPath_); } catch (Core::Exception* e) { e->showMessage(); delete e; return; } }
/* ///////////////////////////////////////////////////////////////////////////// * Menu "File new" action */ void TTCutMainWindow::onFileNew() { if (TTCut::isVideoOpen) { if (ttAssigned(cutListData) && cutListData->count() > 0) { //TODO: Ask for saving changes log->infoMsg(oName, "TODO: Ask for saving changes in project"); } closeProject(); } }
/** * Called before the main window closes. * @param event Information on the closing event */ void MainWindow::closeEvent(QCloseEvent* event) { if (!closeProject()) { event->ignore(); return; } // Save main-window geometry. writeSettings(); // Close the main window and terminate the application. event->accept(); }
void MainWindow::moveProject (File newProjectFileToOpen) { auto openInIDE = currentProject->shouldOpenInIDEAfterSaving(); closeProject (currentProject.get(), false); openFile (newProjectFileToOpen); if (currentProject != nullptr) { ProjucerApplication::getApp().getCommandManager().invokeDirectly (openInIDE ? CommandIDs::saveAndOpenInIDE : CommandIDs::saveProject, false); } }
void MainWindow::openProject() { if(m_project) if(!closeProject()) return; QString fileName = QFileDialog::getOpenFileName(this, tr("Open DES Project"), QDir::currentPath(), tr("DES Files (*.xml)")); if (fileName.isEmpty()) return; QFile file(fileName); if (!file.open(QFile::ReadOnly | QFile::Text)) { QMessageBox::warning(this, tr("DES Project Reader"), tr("Cannot open file %1:\n%2.") .arg(fileName) .arg(file.errorString())); return; } ProjectSerializer serializer; m_project = serializer.loadProject(&file); if(m_project) { statusBar()->showMessage(tr("Project opened"), 20000); m_project->setFileName(fileName); connect (m_project, SIGNAL(projectChanged()), this, SLOT(unsavedChanges())); showProjectView(); m_unsavedChanges = false; ui->actSaveProject->setEnabled(true); ui->actSaveProjectAs->setEnabled(true); ui->actCloseProject->setEnabled(true); ui->actImportAutomaton->setEnabled(true); ui->menuAutomata->setEnabled(true); ui->menuServer->setEnabled(true); ui->actShowSettings->setEnabled(true); ui->actDeleteAutomaton->setEnabled(true); m_projectWidget->setMode("unknown"); } else { delete m_project; m_project = 0; } }
/*! \brief \fn cdegs_main::connectSlots */ void cdegs_main::connectSlots(){ QObject::connect(ui->actionNew_Project, SIGNAL(triggered()), this, SLOT(newProject())); QObject::connect(ui->actionNew_Config, SIGNAL(triggered()), this, SLOT(newConfig())); QObject::connect(ui->actionOpen_Project, SIGNAL(triggered()), this, SLOT(openProject())); QObject::connect(ui->actionSave_Project, SIGNAL(triggered()), this, SLOT(saveProject())); QObject::connect(ui->actionSave_Project_as, SIGNAL(triggered()), this, SLOT(saveProjectAs())); QObject::connect(ui->actionClose_Project, SIGNAL(triggered()), this, SLOT(closeProject())); QObject::connect(ui->tabProjects, SIGNAL(currentChanged(int)), this, SLOT(changeTab())); QObject::connect(ui->tabProjects, SIGNAL(tabCloseRequested(int)), this, SLOT(closeProject(int))); QObject::connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); QObject::connect(ui->actionStylesheet, SIGNAL(triggered()), this, SLOT(openStyleDialog())); QObject::connect(ui->actionOpen_Config, SIGNAL(triggered()), this, SLOT(openConfigDialog())); QObject::connect(ui->actionSave_Config, SIGNAL(triggered()), this, SLOT(saveConfig())); QObject::connect(ui->actionClose_Config, SIGNAL(triggered()), this, SLOT(closeConfig())); QObject::connect(ui->actionExport_Config, SIGNAL(triggered()), this, SLOT(exportConfig())); QObject::connect(ui->actionExport_Config_as, SIGNAL(triggered()), this, SLOT(exportConfigAs())); QObject::connect(ui->actionSave_All_Configs, SIGNAL(triggered()), this, SLOT(saveAllConfigs())); }
void ProjectWindow::newProject() { if (projectFileName != "") closeProject(); QString filename = QFileDialog::getSaveFileName(this, tr("Select project name"), 0, tr("Projects (*.ebe)")); if (filename != "") { if (filename.right(4) != ".ebe") { //qDebug() << "append .ebe"; filename += ".ebe"; } QFile file(filename); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return; file.resize(0); projectFileName = filename; } }
/* //////////////////////////////////////////////////////////////////////////// * Load an existing video file */ void TTMpeg2MainWnd::onLoadVideoFile(QString fn) { closeProject(); openProject(fn); if (!openVideoFile(fn)) { //TODO: throw exception return; } videoFileInfo->setFileName(fn); isProjectOpen = true; onAnalyze(); }
void KTMainWindow::closeEvent( QCloseEvent *event ) { if (! closeProject() ) { event->ignore(); return; } delete m_pBottomDock; delete m_pLeftDock; delete m_pRightDock; DCONFIG->beginGroup("General"); DCONFIG->setValue("recents", m_recentProjects); DMainWindow::closeEvent(event); }
void RDOEditorProject::newProject() { if ( closeProject() ) { RDOEditorTabCtrl* tabCtrl = &((RDOEditorMainFrame*)AfxGetMainWnd())->childView.tab; for ( int i = 0; i < tabCtrl->getItemCount(); i++ ) { RDOEditorEdit* edit = tabCtrl->getItemEdit( i ); edit->setReadOnly( false ); edit->clearAll(); int resID = -1; switch ( i ) { case RDOEDIT_PAT: resID = ID_INSERT_PAT_PATOPERATION; break; case RDOEDIT_RTP: resID = ID_INSERT_RTP_RTPPERMANENT; break; case RDOEDIT_RSS: resID = ID_INSERT_RSS_RSS; break; case RDOEDIT_OPR: resID = ID_INSERT_OPR_OPR; break; case RDOEDIT_FRM: resID = ID_INSERT_FRM_FRM; break; case RDOEDIT_FUN: resID = ID_INSERT_FUN_FUN; break; case RDOEDIT_SMR: resID = ID_INSERT_SMR_SMR; break; } CString s = ""; if ( resID != - 1 && s.LoadString( resID ) ) { int incPos = -1; switch ( resID ) { case ID_INSERT_PAT_PATOPERATION : incPos = 9; break; case ID_INSERT_RTP_RTPPERMANENT : incPos = 15; break; case ID_INSERT_RSS_RSS : incPos = 13; break; case ID_INSERT_OPR_OPR : incPos = 14; break; case ID_INSERT_FRM_FRM : incPos = 7; break; case ID_INSERT_FUN_FUN : incPos = 10; break; case ID_INSERT_SMR_SMR : incPos = 17; break; } edit->replaceCurrent( s, incPos ); } edit->setModifyFalse(); } setName( "" ); } }
void MainWindow::newProject() { if (maybeSave()) { closeProject(); NewProjectDialog* newProjectDialog = new NewProjectDialog(this); if (newProjectDialog->exec() == QDialog::Accepted) { // try to create directory QString dir = newProjectDialog->fullDirectory(); if (QDir().mkpath(dir) == false) { QMessageBox::information(this, "Information", "Could not create the directory: " + dir); return; } // try to create project QString fileName = newProjectDialog->fullName(); QFile file(fileName); if (file.open(QIODevice::WriteOnly | QIODevice::Text) == false) { QMessageBox::information(this, "Information", "Could not create the project: " + fileName); return; } QTextStream(&file) << libraryWidget_->toXml().toString(); file.close(); projectFileName_ = fileName; libraryWidget_->setProjectFileName(projectFileName_); updateUI(); setWindowTitle(projectName() + "[*] - " + tr("Gideros")); QSettings settings; settings.setValue("location", newProjectDialog->location()); addToRecentProjects(projectFileName_); } } }
/* ///////////////////////////////////////////////////////////////////////////// * React to the application window close event * - save settings * - ask for saving changes * - close the project */ void TTCutMainWindow::closeEvent(QCloseEvent* event) { // If project file open and has changes ask for save changes if (TTCut::isVideoOpen) { if (ttAssigned(cutListData) && cutListData->count() > 0) { log->infoMsg(oName, "TODO: Ask for saving changes in project"); } } closeProject(); if ( ttAssigned(settings) ) settings->writeSettings(); event->accept(); }
void ProjectWindow::contextMenuEvent(QContextMenuEvent * /* event */) { if (projectFileName == "") { QMenu menu(tr("Project menu")); menu.addAction(tr("New project"), this, SLOT(newProject())); menu.addAction(tr("Open project"), this, SLOT(openProject())); menu.addAction(tr("ignore"), this, SLOT(ignore())); menu.exec(QCursor::pos()); } else { QMenu menu(tr("Project menu")); menu.addAction(tr("Add file to project"), this, SLOT(addFile())); menu.addAction(tr("Open file in editor"), this, SLOT(editFile())); menu.addAction(tr("Drop file from project"), this, SLOT(dropFile())); menu.addAction(tr("Close project"), this, SLOT(closeProject())); menu.addAction(tr("ignore"), this, SLOT(ignore())); menu.exec(QCursor::pos()); } }
void KTMainWindow::openProject(const QString &path) { KTPackageHandler packageHandler; if ( packageHandler.importPackage(path) ) { if ( closeProject() ) { m_pActiveTabWidget->setCurrentWidget(m_drawingSpace); if ( m_projectManager->load( packageHandler.importedProjectPath() ) ) { m_fileName = path; if ( QDir::isRelativePath(path) ) { m_fileName = QDir::currentPath()+"/"+path; } int pos = m_recentProjects.indexOf(m_fileName); if ( pos == -1 ) { if ( m_recentProjects.count() <= 6 ) { m_recentProjects << m_fileName; } else { m_recentProjects.push_front(m_fileName); } } else { m_recentProjects.push_front(m_recentProjects.takeAt(pos)); } newViewDocument(); messageToOSD( tr("Project opened!")); } } } }