int ProjectHandle::closeProject(){ QMessageBox msgBox; msgBox.setText("Do you want to save your changes?"); msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Save); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Save: // Save was clicked saveProject(); clearProject(); return 0; case QMessageBox::Discard: // Don't Save was clicked clearProject(); return 0; case QMessageBox::Cancel: // Cancel was clicked return 1; default: // should never be reached return 1; } }
void MainWindow::openProject() { int reply = QMessageBox::question(this,"Сохранение изменений","Сохранить текущий проект?",QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel); if(reply == QMessageBox::Cancel) return; if(reply == QMessageBox::Yes) saveProject(); Settings conf; bool res = conf.openData(lcd->getData(),vars); if(res) { portName = conf.getPortName(); portBaud = conf.getPortBaud(); strVars = conf.getStringVars(); lcd->setPos(0,0); lcd->setLineNumber(0,0); lcd->setLineNumber(1,0); lcd->setLineNumber(2,0); lcd->setLineNumber(3,0); if(lcd->getReplaceMode()) lcd->setReplaceMode(false); statusBar()->showMessage("Проект успешно открыт",2000); } display->update(); fillLists(lcd->getData()); }
void DesktopMainWindow::createActions() { _newProjectAction = new QAction(tr("New Project"), this); _newProjectAction->setShortcut(QKeySequence::New); _newProjectAction->setStatusTip(tr("Start a new project")); connect(_newProjectAction, SIGNAL(triggered()), this, SLOT(newProject())); _openProjectAction = new QAction(QIcon(":/resources/images/open.png"), tr("&Open Project"), this); _openProjectAction->setShortcut(QKeySequence::Open); _openProjectAction->setStatusTip(tr("Open an existing file")); connect(_openProjectAction, SIGNAL(triggered()), this, SLOT(openProject())); _saveProjectAction = new QAction(QIcon(":/resources/images/save.png"), tr("&Save Project"), this); _saveProjectAction->setShortcut(QKeySequence::Save); _saveProjectAction->setStatusTip(tr("Save current project")); connect(_saveProjectAction, SIGNAL(triggered()), this, SLOT(saveProject())); _exitAction = new QAction(tr("&Exit"), this); connect(_exitAction, SIGNAL(triggered()), this, SLOT(close())); _undoAction = new QAction(QIcon(":/resources/images/undo.png"), tr("&Undo"), this); connect(_undoAction, SIGNAL(triggered()), this, SLOT(undo())); _settingsAction = new QAction(QIcon(":/resources/images/gear.png"), tr("&Options"), this); connect(_settingsAction, SIGNAL(triggered()), this, SLOT(editSettings())); _restoreLayoutAction = new QAction(tr("&Restore Layout"), this); connect(_restoreLayoutAction, SIGNAL(triggered()), this, SLOT(restoreLayout())); _aboutAction = new QAction(QIcon(":/resources/images/info.png"), tr("&About"), this); _aboutAction->setStatusTip(tr("About Godzi")); connect(_aboutAction, SIGNAL(triggered()), this, SLOT(showAbout())); }
void Project::autoSaveRequired() { if ( m_projectFile == NULL ) return ; saveProject( m_projectFile->fileName() + Project::backupSuffix ); }
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; }
bool RunContextManager::createProject(const std::string& Path, const std::string& Name, const std::string& Description, const std::string& Authors, const bool Inc) { if (m_ProjectIsOpen) return false; if (QDir().mkpath(QString::fromStdString(getInputDirFromProjectPath(Path)))) { m_ProjectPath = Path; m_InputDir = getInputDirFromProjectPath(Path); m_OutputDir = getOuputDirFromProjectPath(Path); QString PrjFilePath = QString::fromStdString(getFilePathFromProjectPath(Path)); mp_ProjectFile = new QSettings(PrjFilePath,QSettings::IniFormat); m_ProjectName = Name; m_ProjectDescription = Description; m_ProjectAuthors = Authors; m_ProjectIncOutputDir = Inc; m_ProjectCreationDate = getNow(); updateWaresEnvironment(); m_ProjectIsOpen = true; return saveProject(); } return false; }
void MainWindow::on_actionNew_Project_triggered() { if(project_open) on_actionClose_Project_triggered(); if(project_open) return; QString tempdir = QFileDialog::getExistingDirectory(this, QString("Choose Project Directory")); if(tempdir.isEmpty()) return; current_project_directory = QDir(tempdir); current_project_name = current_project_directory.dirName(); editor = new DocumentEditorView(this); editor->hide(); QString temp = current_project_name; requirements = new DocumentView(QString(current_project_name + "_requirements.xml"), this); requirements->hide(); traceability = new TraceabilityView(requirements, this); ui->centralWidget->layout()->addWidget(traceability); QObject::connect(ui->showReq, SIGNAL(pressed()), this, SLOT(showRequirements())); QObject::connect(ui->showEdit, SIGNAL(pressed()), this, SLOT(showEditor())); QObject::connect(ui->showTrace, SIGNAL(pressed()), this, SLOT(showTraceability())); QObject::connect(editor, SIGNAL(docAdded(DocumentView*)), traceability, SLOT(addModels(DocumentView*))); QObject::connect(editor, SIGNAL(removeDocument(int)), traceability, SLOT(removeDocument(int))); project_open = true; saveProject(); ui->frame_2->hide(); ui->frame->show(); }
/** Add shaders meta information to this manager */ void InfoManager::addShader(QString path, InfoManager::SHADERTYPE type, QString projectName) { QString project; if(projectName.isEmpty()) project = activeProject; else project = projectName; Q_ASSERT(projects.contains(project)); if(!projects.contains(project)) return; switch(type) { case InfoManager::VERTEX: projects[project]->addVertex(path); break; case InfoManager::FRAGMENT: projects[project]->addFragment(path); break; default: break; } // save changes to project file saveProject(projects[project]->getName()); }
void UmlPackage::fileControl(bool ci) { UmlPackage * prj = getProject(); Q3CString prjfile = prj->supportFile(); BooL rec; BooL reload; Q3CString cmd; if (! prj->propertyValue((ci) ? "check-in-cmd" : "check-out-cmd", cmd)) cmd = "specify the command containing %file and %dir or %dironly"; Dialog dialog(ci, cmd, rec, reload); // the dialog execution set 'cmd' and 'rec' if (dialog.exec() == QDialog::Accepted) { // save the command for a future usage prj->set_PropertyValue((ci) ? "check-in-cmd" : "check-out-cmd", cmd); if (reload) saveProject(); // get files list Q3Dict<void> files; getFiles(files, (rec) ? ~0u : 1); if (this == prj) getAuxFiles(files); // apply the command on each file Q3DictIterator<void> it(files); QFileInfo prjpath(prjfile); QString dir = prjpath.dirPath(TRUE); QString dironly = dir; int index; if ((dironly.length() > 3) && (((const char *) dironly)[1] == ':') && (((const char *) dironly)[2] == '/')) dironly = dironly.mid(2); while ((index = cmd.find("%dironly")) != -1) cmd.replace(index, 8, dironly); while ((index = cmd.find("%dir")) != -1) cmd.replace(index, 4, dir); while (it.current()) { QString s = cmd; while ((index = s.find("%file")) != -1) s.replace(index, 5, it.currentKey()); system((const char *) s); ++it; } UmlCom::trace("Done."); if (reload) loadProject(prjfile); } }
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())); }
bool MainWindow::maybeSave() { if (libraryWidget_->isModified()) { QMessageBox::StandardButton button = QMessageBox::question(this, "Save", QString("Save project \"%1\"?").arg(projectName()), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch(button) { case QMessageBox::Yes: saveProject(); return true; break; case QMessageBox::No: return true; break; case QMessageBox::Cancel: return false; break; default: break; } } return true; }
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 Project::emergencyBackup() { Q_ASSERT( m_projectFile != NULL ); const QString& name = m_projectFile->fileName() + Project::backupSuffix; saveProject( name ); Core::getInstance()->settings()->setValue( "private/EmergencyBackup", name ); }
/** * @brief InfoManager::projectChanged Slot for saving project when changed. */ void InfoManager::projectChanged(QString /*projectName*/) { MetaProject* proj = dynamic_cast<MetaProject*>(sender()); if(proj == NULL) return; saveProject(proj->getName()); }
/** * @brief InfoManager::attachShaderToProgram Attach shader to shader program within given project * @param shader Name of the shader * @param programName Name of the shader program * @param project Name of the project. If project is not set then use active project. */ void InfoManager::attachShaderToProgram(QString shader, QString programName, QString project) { if(project.isEmpty()) project = activeProject; projects[activeProject]->setShaderToProgram(shader,programName); saveProject(); }
/** * @brief InfoManager::createProgram Create shader program with given shader program name to given project. * @param name Name of the shader program * @param project Name of the project */ void InfoManager::createProgram(QString name, QString project) { if(project.isEmpty()) project = activeProject; projects[project]->addProgram(name); saveProject(); }
void MainWindow::on_actionSave_project_triggered() { if (projectName=="") saveProjectAs(); else { tmpProjectFolder = projectFolder; tmpProjectName = projectName; saveProject(); } }
void ProjectContentComponent::saveDocument() { if (currentDocument != nullptr) { if (! currentDocument->save()) showSaveWarning (currentDocument); } else saveProject(); }
void MainWindow::save() { if (currentSaveFile.isEmpty()) { saveAs(); } else { if(currentSaveFile.endsWith(".chmvp")) saveProject(currentSaveFile); else saveImage(currentSaveFile); } }
void MainWindow::on_actionSave_Project_triggered() { if(!project_open){ QMessageBox::warning(this, "No project", "No project open!"); return; } saveProject(); QMessageBox::information(this, "Project saved", "Project saved!"); }
ProjectManager::ProjectManager(std::string projectFile, std::string videoFile) : QObject() , projectFile(projectFile) , project() , breakpoints() { project["breakpoints"] = YAML::Load("[]"); project["video-file"] = videoFile; saveProject(); }
void Project::saveAs() { if ( m_projectManagerUi == NULL ) return ; QFileInfo fInfo( *m_projectFile ); const QString& fileName = m_projectManagerUi->getProjectFileDestination( fInfo.absolutePath() ); if ( fileName.isEmpty() ) return ; saveProject( fileName ); emit projectUpdated( name() ); }
int MainWindow::saveProjectAs() { ProjectDialog *proj_dialog = new ProjectDialog(this, baseProjectFolder, false); tmpProjectName = ""; proj_dialog->exec(); if (tmpProjectName=="") return 1; projectFolder = tmpProjectFolder; projectName = tmpProjectName; if (saveProject()!=0) return 1; return 0; }
void ProjectContentComponent::openInIDE (int exporterIndex, bool saveFirst) { if (saveFirst) saveProject(); int i = 0; if (project != nullptr) for (Project::ExporterIterator exporter (*project); exporter.next();) if (exporter->canLaunchProject()) if (i++ == exporterIndex && exporter->launchProject()) break; }
bool FileManager::saveProject(Project* project, QString filename, QString* error) { Q_ASSERT(project); //Set filename if different if(filename != project->filename()) { project->setFilename(filename); m_projectMap.remove(project->filename()); m_projectMap.insert(filename, project); } //Save project return saveProject(project, error); }
/*! \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())); }
OutOfMemoryDialog::OutOfMemoryDialog(QWidget* parent) : QDialog(parent) { ui.setupUi(this); if (sizeof(void*) > 32) { ui.only_32bit_1->hide(); ui.only_32bit_2->hide(); } ui.topLevelStack->setCurrentWidget(ui.mainPage); connect(ui.saveProjectBtn, SIGNAL(clicked()), SLOT(saveProject())); connect(ui.saveProjectAsBtn, SIGNAL(clicked()), SLOT(saveProjectAs())); connect(ui.dontSaveBtn, SIGNAL(clicked()), SLOT(reject())); }
bool MainWindow::closeProject() { if(m_unsavedChanges) { QMessageBox msgBox; msgBox.setText(tr("The project has been modified.")); msgBox.setInformativeText(tr("Do you want to save your changes?")); msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Save); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Save: saveProject(); break; case QMessageBox::Discard: // do nothing, don't sav and close project further down break; case QMessageBox::Cancel: // skip project closing return false; break; default: return false; break; } } showEmptyView(); m_controller->stopController(); if( m_hw->server() ) m_hw->server()->disconnect(); delete m_project; m_project = 0; ui->actSaveProject->setEnabled(false); ui->actSaveProjectAs->setEnabled(false); ui->actCloseProject->setEnabled(false); ui->actImportAutomaton->setEnabled(false); ui->menuAutomata->setEnabled(false); ui->menuServer->setEnabled(false); ui->actShowSettings->setEnabled(false); return true; }
bool DesktopMainWindow::checkSave() { if (_app->isProjectDirty()) { QMessageBox::StandardButton ret = QMessageBox::warning(this, tr("Project Modified"), tr("The project has been modified.\nDo you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); if (ret == QMessageBox::Save) return saveProject(); else if (ret == QMessageBox::Cancel) return false; } return true; }
void MainWindow::ConnectProject(Project *newProject) { if (newProject) { connect(newProject, SIGNAL(newDomainSelected()), this, SLOT(updateVisibleDomain())); connect(newProject, SIGNAL(newDomainSelected()), ui->GLPanel, SLOT(updateGL())); connect(ui->createSubdomainButton, SIGNAL(clicked()), newProject, SLOT(createSubdomain())); connect(ui->saveProjectButton, SIGNAL(clicked()), newProject, SLOT(saveProject())); connect(ui->actionProjectSettings, SIGNAL(triggered()), newProject, SLOT(showProjectSettings())); connect(ui->runFullDomainButton, SIGNAL(clicked()), newProject, SLOT(runFullDomain())); connect(newProject, SIGNAL(showProjectExplorerPane()), this, SLOT(showProjectExplorerPane())); connect(newProject, SIGNAL(showCreateSubdomainPane()), this, SLOT(showCreateSubdomainPane())); connect(newProject, SIGNAL(showEditSubdomainPane()), this, SLOT(showEditSubdomainPane())); connect(newProject, SIGNAL(showAdcircPane()), this, SLOT(showAdcircPane())); connect(newProject, SIGNAL(showAnalyzeResultsPane()), this, SLOT(showAnalyzeResultsPane())); } }