Example #1
0
// save current song and update the gui
bool song::guiSaveProject()
{
	DataFile dataFile( DataFile::SongProject );
	m_fileName = dataFile.nameWithExtension( m_fileName );
	if( saveProjectFile( m_fileName ) && engine::hasGUI() )
	{
		textFloat::displayMessage( tr( "Project saved" ),
					tr( "The project %1 is now saved."
							).arg( m_fileName ),
				embed::getIconPixmap( "project_save", 24, 24 ),
									2000 );
		configManager::inst()->addRecentlyOpenedProject( m_fileName );
		m_modified = false;
		engine::mainWindow()->resetWindowTitle();
	}
	else if( engine::hasGUI() )
	{
		textFloat::displayMessage( tr( "Project NOT saved." ),
				tr( "The project %1 was not saved!" ).arg(
							m_fileName ),
				embed::getIconPixmap( "error" ), 4000 );
		return false;
	}

	return true;
}
Example #2
0
void MainWindow::saveTab() {
    qDebug() << "\n[*] MainWindow::saveTab";

    /* Determine page type */
    ProjectView *projectView = qobject_cast<ProjectView*>(mTabWidget->currentWidget());
    TransistionDiagramWidget *diagramWidget = qobject_cast<TransistionDiagramWidget*>(mTabWidget->currentWidget());

    if (projectView) {
        qDebug() << "[+] Saving Project View";
        saveProjectFile();
        return;
    } else if (diagramWidget) {
        qDebug() << "[+] Saving Diagram Window";
        mTransistionDiagram->saveStates();
        return;
    }

    qDebug() << "[+] Saving Page";

    Page *page = qobject_cast<Page*>(mTabWidget->currentWidget());

    //if (page->document()->isModified()) {
    //    QMessageBox::StandardButton ret;
    //    ret = QMessageBox::warning(this, tr("HOLIDE"), tr("The document has been modified.\n"
    //                                                     "Do you want to save your changes?"),
    //                               QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
    //    if (ret == QMessageBox::Save)
    return save(page);
    //}
}
Example #3
0
File: Song.cpp Project: LMMS/lmms
// Save the current song
bool Song::guiSaveProject()
{
	DataFile dataFile( DataFile::SongProject );
	QString fileNameWithExtension = dataFile.nameWithExtension( m_fileName );
	setProjectFileName(fileNameWithExtension);

	bool const saveResult = saveProjectFile( m_fileName );

	if( saveResult )
	{
		setModified(false);
	}

	return saveResult;
}
Example #4
0
bool baseProject::save(bool createMakeFile){

    // only save an addons.make file if requested on ANY platform
    // this way we don't thrash the git repo for our examples, but
    // we do make the addons.make file for any new projects...that
    // way it can be distributed and re-used by others with the PG

    if(createMakeFile){
        ofFile addonsMake(ofFilePath::join(projectDir,"addons.make"), ofFile::WriteOnly);
        for(int i = 0; i < addons.size(); i++){
            addonsMake << addons[i].name << endl;
        }
    }

	return saveProjectFile();
}
void testApp::keyPressed( int key )
{
    cout << "key : " << key << endl ;
 //   if ( canvasAlpha > 0.0f )
 //   {
        WordBlock * wb = quote.getEditableBlock( ) ;
        if ( wb == NULL )
        {
            switch ( key )
            {
                case 'p':
                case 'P':
                    exportPDF() ;
                    break ;

                case 'r':
                case 'R':
                    resetAgents() ;
                    break ;

                case 's':
                case 'S':
                    saveProjectFile( ) ;
                    break ;

                case 'o':
                case 'O':
                    openProjectFile( ) ;
                    break ;

                case ' ':
                    bRunAgents = !bRunAgents ;
                    break ;

                case 'd':
                case 'D':
                    bDebugDraw = !bDebugDraw ;
                    break ;

                case 'n':
                case 'N':
                    cout << "new WordBlock" << endl ;
                    createNewWordBlock() ;
                    break ;

                case 13 :
                    cout << "end typing wordBlock" << endl ;
                    break ;

                case 'e':
                case 'E':
                    quote.editWordBlockAt ( mouseX , mouseY ) ;
                    break ;

                case 'f':
                case 'F':
                    openFontDialogue() ;
                    break ;
                case 127 :
                case 8 :
                    quote.removeWordBlockAt ( mouseX , mouseY ) ;
                    break ;

            }
            cout << "no editable path!" << endl;
        }
        else
        {
            if ( key == 13 )
            {
                wb->bEditable = false ;
                return ;
            }

            //Backspace
            else if ( key == 127|| key == 8 )
            {
                string word = wb->word ;
                if ( word.size() > 0 )
                {
                    string word1 = word.substr( 0 , word.size()-1 ) ;
                    word = word1 ;
                }
                wb->word = word ;

                updateNewWordBlock( wb->word , newFontSize ) ;
                //updateNewWordBlock( wb->word , newFontSize ) ;
                return ;
            }

            wb->word += key ;
            cout << "updating word blcok with : " << wb->word << endl ;
            //void testApp::updateNewWordBlock ( string _word , float _fontSize )
           //   WordBlock * wb = quote.getEditableBlock( ) ;
            updateNewWordBlock( wb->word , newFontSize ) ;

        }
  //  }

}
Example #6
0
void MainWindow::createActions()
{   
  
  newAction = new QAction("&New",this);
  newAction->setIcon(QIcon(":/images/new.png"));      
  newAction->setShortcut(tr("Ctrl+N"));
  newAction->setStatusTip("Create a new edit session");
  connect(newAction,SIGNAL(triggered()),
          this,SLOT(newFile()));
  
  openFileAction = new QAction("&Open file",this);
  openFileAction->setIcon(QIcon(":/images/open.png"));    
  openFileAction->setShortcut(tr("Ctrl+O"));
  openFileAction->setStatusTip("Open/load data from file");
  connect(openFileAction,SIGNAL(triggered()),
          this,SLOT(openFile()));
  
  
  
  openVideoAction= new QAction("Open video image",this);
  openVideoAction->setIcon(QIcon(":/images/video-x-generic.svg"));    
  //openVideoAction->setShortcut(tr("Ctrl+O+O"));
  //openVideoAction->setStatusTip("Open/load contexts data from file");
  connect(openVideoAction,SIGNAL(triggered()),
          this,SLOT(openVideoFile()));
  
  
  saveProjectAction= new QAction("&Save project",this);
  saveProjectAction->setIcon(QIcon(":/images/save.png"));     
  saveProjectAction->setShortcut(tr("Ctrl+P"));
  saveProjectAction->setStatusTip("Save data to project file");
  connect(saveProjectAction,SIGNAL(triggered()),
          this,SLOT(saveProjectFile()));
  
  saveContextsAction = new QAction("Save contexts",this);
  saveContextsAction->setIcon(QIcon(":/images/insert-object.svg"));     
  saveContextsAction->setShortcut(tr("Ctrl+S+C"));
  saveContextsAction->setStatusTip("Save contexts data to file");  
  connect(saveContextsAction,SIGNAL(triggered()),
          this,SLOT(saveContextsToFile())); 
  
  saveRulesAction = new QAction("Save rules",this);
  saveRulesAction->setIcon(QIcon(":/images/insert-object.svg"));     
  saveRulesAction->setShortcut(tr("Ctrl+S+C"));
  saveRulesAction->setStatusTip("Save rule data to file");  
  connect(saveRulesAction,SIGNAL(triggered()),
          this,SLOT(saveRulesToFile()));   
  
  
  exitAction = new QAction("&Exit",this);
  exitAction->setIcon(QIcon(":/images/application-exit.svg"));     
  exitAction->setShortcut(tr("Ctrl+Q"));
  exitAction->setStatusTip("Close application");
  connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));   
  
  aboutAction = new QAction("&About",this);
  aboutAction->setIcon(QIcon(":/images/find.png"));     
  aboutAction->setShortcut(tr("Ctrl+A"));
  aboutAction->setStatusTip("About");
  connect(aboutAction,SIGNAL(triggered()),
          this,SLOT(about()));
  
  newRuleAction = new QAction("&New rule",this);
  newRuleAction->setIcon(QIcon(":/images/rule.svg"));
  connect(newRuleAction,SIGNAL(triggered()),
          this,SLOT(newRule()));
  
  runVirtualFencingAction = new QAction("&Video",this);
  runVirtualFencingAction->setIcon(QIcon(":/images/arrow.png"));      
  connect(runVirtualFencingAction,SIGNAL(triggered()),
          this,SLOT(runVirtualFencing()));
  
  addLineAction = new QAction("Add &Line",this);
  addLineAction->setIcon(QIcon(":/images/linepointer.png"));     
  addLineAction->setShortcut(tr("Ctrl+L"));
  addLineAction->setStatusTip("Add line");
  connect(addLineAction,SIGNAL(triggered()),
          this,SLOT(about()));                  
  
  
}