/** * \fn void MainWindow::newWorkspace() * \brief Nouveau Workspace * Slot permettant de changer de workspace en proposant la sauvegarde à l'utilisateur. */ void MainWindow::newWorkspace() { if(NoteManager::exist()) { QMessageBox message(this); message.setText("An instance of workspace already exists."); message.setInformativeText("Do you want to save your changes ?"); message.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); message.setDefaultButton(QMessageBox::Save); message.setIcon(QMessageBox::Warning); int ret = message.exec(); switch(ret){ case QMessageBox::Save: try{ saveWorkspace(); NoteManager::releaseInstance(); NoteManager::getInstance(); }catch(MyException& e) { QMessageBox::critical(ui->centralwidget,"Alert",e.getInfo()); } break; case QMessageBox::Discard: NoteManager::releaseInstance(); emit clear(); NoteManager::getInstance(); return; case QMessageBox::Cancel: return; default: return; } } }
/** * \fn MainWindow::MainWindow(QWidget *parent) * \brief Construction de la MainWindow * \param Widget parent de MainWindow. 'NULL' par defaut. */ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); id = 0; NoteManager::getInstance(); //Configuration QWidget* spacer= new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); //Action ui->actionArticle->setIcon(QIcon("/Users/Antoine/Documents/ProjetInfo/Github/Notify_Github/Icons/articleIcon48.png")); ui->actionDocument->setIcon(QIcon("/Users/Antoine/Documents/ProjetInfo/Github/Notify_Github/Icons/document1Icon48.png")); ui->actionImage_2->setIcon(QIcon("/Users/Antoine/Documents/ProjetInfo/Github/Notify_Github/Icons/imageIcon48.png")); ui->actionAudio->setIcon(QIcon("/Users/Antoine/Documents/ProjetInfo/Github/Notify_Github/Icons/audioIcon48.png")); ui->actionVideo->setIcon(QIcon("/Users/Antoine/Documents/ProjetInfo/Github/Notify_Github/Icons/videoIcon48.png")); ui->actionQuit->setIcon(QIcon("/Users/Antoine/Documents/ProjetInfo/Github/Notify_Github/Icons/stop_2_48.png")); //Toolbar ui->toolBar->addAction(ui->actionArticle); ui->toolBar->addAction(ui->actionDocument); ui->toolBar->addAction(ui->actionImage_2); ui->toolBar->addAction(ui->actionAudio); ui->toolBar->addAction(ui->actionVideo); ui->toolBar->addWidget(spacer); ui->toolBar->addAction(ui->actionQuit); //Connection QObject::connect(ui->actionQuit,SIGNAL(triggered()),qApp,SLOT(quit())); QObject::connect(ui->actionWorkspace,SIGNAL(triggered()),this,SLOT(newWorkspace())); QObject::connect(ui->actionArticle,SIGNAL(triggered()),this,SLOT(newArticle())); QObject::connect(ui->actionDocument,SIGNAL(triggered()),this,SLOT(newDocument())); QObject::connect(ui->actionVideo,SIGNAL(triggered()),this,SLOT(newVideo())); QObject::connect(ui->actionImage_2,SIGNAL(triggered()),this,SLOT(newImage())); QObject::connect(ui->actionAudio,SIGNAL(triggered()),this,SLOT(newAudio())); QObject::connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(saveWorkspace())); QObject::connect(ui->actionSave_As,SIGNAL(triggered()),this,SLOT(saveWorkspaceAs())); QObject::connect(this,SIGNAL(clear()),&Workspace::getInstance(),SLOT(clear())); //Zone de travail gridLayout = new QGridLayout(ui->centralwidget); ui->centralwidget->setLayout(gridLayout); work = &Workspace::getInstance(ui->centralwidget); editor = &Editorspace::getInstance(ui->centralwidget); gridLayout->addWidget(work,0,0,1,1); gridLayout->addWidget(editor,0,1,2,1); gridLayout->addWidget(&Tags::TagManagerWidget::getInstance(ui->centralwidget),1,0,1,1); }
void Config::save() { saveWorkspace(); saveAdvanced(); }
void WorkspacePresenter::saveSingleWorkspace() { auto view = lockView(); view->saveWorkspace(view->getSaveFileType()); }
void MainWindow::createActions() { //loadAct loadSceneAct = new QAction(tr("&Load Scene"), this); loadSceneAct->setShortcut(Qt::CTRL + Qt::Key_O); loadSceneAct->setStatusTip(tr("Load scene")); connect(loadSceneAct, SIGNAL(triggered()), this, SLOT(loadScene())); //quickLoadAct quickLoadAct = new QAction(tr("&Quick Load"), this); quickLoadAct->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_Q); quickLoadAct->setStatusTip(tr("Load last scene")); connect(quickLoadAct, SIGNAL(triggered()), this, SLOT(quickLoad())); //saveSceneAct saveSceneAct = new QAction(tr("&Save Scene"), this); saveSceneAct->setShortcut(Qt::CTRL + Qt::Key_S); saveSceneAct->setStatusTip(tr("Save Scene")); connect(saveSceneAct, SIGNAL(triggered()), this, SLOT(saveScene())); loadPluginFileAct = new QAction(tr("&Load Plugin"), this); loadPluginFileAct->setShortcut(Qt::CTRL + Qt::Key_L); loadPluginFileAct->setStatusTip(tr("Load plugin file")); connect(loadPluginFileAct, SIGNAL(triggered()), this, SLOT(loadPluginFileWithDialog())); loadPluginDirAct = new QAction(tr("&Load Plugin Directory"), this); loadPluginDirAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_L); loadPluginDirAct->setStatusTip(tr("Load all plugins in directory")); connect(loadPluginDirAct, SIGNAL(triggered()), this, SLOT(loadPluginDirWithDialog())); /// save workspace configuration action saveWorkspaceConfigurationAct = new QAction(tr("Save Workspace"), this); saveWorkspaceConfigurationAct->setStatusTip(tr("Save the configuration of the workspace")); connect(saveWorkspaceConfigurationAct, SIGNAL(triggered()), this, SLOT(saveWorkspace())); /// save new workspace configuration action saveNewWorkspaceConfigurationAct = new QAction(tr("Save Workspace As..."), this); saveNewWorkspaceConfigurationAct->setStatusTip(tr("Save a new workspace configuration")); connect(saveNewWorkspaceConfigurationAct, SIGNAL(triggered()), this, SLOT(saveNewWorkspace())); /// load workspace configuration action loadWorkspaceConfigurationAct = new QAction(tr("Load Workspace"), this); loadWorkspaceConfigurationAct->setStatusTip(tr("Load a workspace configuration")); connect(loadWorkspaceConfigurationAct, SIGNAL(triggered()), this, SLOT(loadWorkspace())); //closeAct closeSceneAct = new QAction(tr("&Close"), this); closeSceneAct->setShortcut(Qt::CTRL + Qt::Key_W); closeSceneAct->setStatusTip(tr("Close Scene")); connect(closeSceneAct, SIGNAL(triggered()), this, SLOT(close())); //exitAct exitAct = new QAction(tr("&Exit"), this); exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), this, SLOT(exit())); //frontAct frontAct = new QAction(tr("Front"), this); frontAct->setStatusTip(tr("Camera Front View")); connect(frontAct, SIGNAL(triggered()), this, SLOT(front())); //topAct topAct = new QAction(tr("Top"), this); topAct->setStatusTip(tr("Camera Top View")); connect(topAct, SIGNAL(triggered()), this, SLOT(top())); //sideAct sideAct = new QAction(tr("Side"), this); sideAct->setStatusTip(tr("Camera Side View")); connect(sideAct, SIGNAL(triggered()), this, SLOT(side())); //startSimulationAct startSimulationAct = new QAction(tr("Start Simulation"), this); startSimulationAct->setShortcut(Qt::CTRL + Qt::Key_R); connect(startSimulationAct, SIGNAL(triggered()), this, SLOT(startSimulation())); //stopSimulationAct stopSimulationAct = new QAction(tr("Stop Simulation"), this); stopSimulationAct->setShortcut(Qt::CTRL + Qt::Key_C); connect(stopSimulationAct, SIGNAL(triggered()), this, SLOT(stopSimulation())); //simulateSingleStepAct simulateSingleStepAct = new QAction(tr("Simulate Single Step"), this); simulateSingleStepAct->setStatusTip(tr("Simulates one step at a time")); simulateSingleStepAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_R); connect(simulateSingleStepAct, SIGNAL(triggered()), this, SLOT(simulateSingleStep())); //renderDuringSimulationAct renderDuringSimulationAct = new QAction(tr("Render during Simulation"), this); connect(renderDuringSimulationAct, SIGNAL(triggered()), this, SLOT(renderDuringSimulation())); //whiteAct whiteAct = new QAction(tr("White"), this); connect(whiteAct, SIGNAL(triggered()), this, SLOT(white())); //grayAct grayAct = new QAction(tr("Gray"), this); connect(grayAct, SIGNAL(triggered()), this, SLOT(gray())); //BlackAct blackAct = new QAction(tr("Black"), this); connect(blackAct, SIGNAL(triggered()), this, SLOT(black())); //resetCameraAct resetCameraAct = new QAction(tr("Reset Camera"), this); resetCameraAct->setStatusTip(tr("Reset Camera Angle")); connect(resetCameraAct, SIGNAL(triggered()), this, SLOT(resetCamera())); //xga1024x768Act xga1024x768Act = new QAction(tr("XGA 1024 x 768"), this); xga1024x768Act->setCheckable(true); xga1024x768Act->setChecked(true); connect(xga1024x768Act, SIGNAL(triggered()), this, SLOT(xga1024x768())); //vga640x480Act vga640x480Act = new QAction(tr("VGA 640 x 768"), this); vga640x480Act->setCheckable(true); connect(vga640x480Act, SIGNAL(triggered()), this, SLOT(vga640x480())); //hd1280x720Act hd1280x720Act = new QAction(tr("HD 1280 x 720"), this); hd1280x720Act->setCheckable(true); connect(hd1280x720Act, SIGNAL(triggered()), this, SLOT(hd1280x720())); //aboutAct aboutAct = new QAction(tr("About"), this); aboutAct->setShortcut(Qt::Key_F1); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); }