Changeset 2482

Show
Ignore:
Timestamp:
04/02/12 22:45:04 (14 months ago)
Author:
wolke
Message:

change jacksession file handling. untitled song will saved into a jacksession without qmessage box question. remove white spaces from song-file names if they saved in a jack session.

Location:
trunk
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/data/hydrogen.default.conf

    r2335 r2482  
    1414        <useLash>false</useLash> 
    1515        <useTimeLine>false</useTimeLine> 
    16         <maxBars>400</maxBars> 
    17         <JackSessionUseSessionDir>true</JackSessionUseSessionDir> 
     16        <maxBars>400</maxBars> 
    1817        <showDevelWarning>true</showDevelWarning> 
    1918        <hearNewNotes>true</hearNewNotes> 
  • trunk/src/core/include/hydrogen/Preferences.h

    r2467 r2482  
    587587        } 
    588588 
    589         bool getJackSessionUseSessionDir(){ 
    590             return m_bjackSessionUseSessionDir; 
    591         } 
    592         void setJackSessionUseSessionDir( bool val ){ 
    593             m_bjackSessionUseSessionDir = val; 
    594         } 
    595589#endif 
    596590 
     
    659653        QString jackSessionUUID; 
    660654        QString jackSessionApplicationPath; 
    661         bool m_bjackSessionUseSessionDir; 
    662655#endif 
    663656        bool waitingForSessionHandler; 
  • trunk/src/core/src/IO/jack_output.cpp

    r2470 r2482  
    759759        SAVE_SESSION, 
    760760        SAVE_AND_QUIT, 
    761         SAVE_TEMPLATE, 
    762         SAVE_SESSION_NEW_FILE 
     761        SAVE_TEMPLATE 
    763762    }; 
    764763 
     
    767766    /* Valid Song is needed */ 
    768767    if(Hydrogen::get_instance()->getSong()->get_filename().isEmpty()){ 
    769         EventQueue::get_instance()->push_event(EVENT_JACK_SESSION, SAVE_SESSION_NEW_FILE); 
    770         jack_session_reply(client, ev ); 
    771         jack_session_event_free (ev); 
    772         return; 
     768            Hydrogen::get_instance()->getSong()->set_filename("Untitled_Song"); 
    773769    } 
     770    if(Hydrogen::get_instance()->getSong()->get_filename().contains(" ")){ 
     771            QStringList removeWhiteSpaces = Hydrogen::get_instance()->getSong()->get_filename().split(" "); 
     772            Hydrogen::get_instance()->getSong()->set_filename( removeWhiteSpaces.join("_") ); 
     773    } 
    774774 
    775775    QString songfilename; 
    776     if(Preferences::get_instance()->getJackSessionUseSessionDir()){ 
    777         QString jackSessionDirectory = (QString)ev->session_dir; 
    778         QStringList list1 = Hydrogen::get_instance()->getSong()->get_filename().split("/"); 
    779         QString realFillename = list1[list1.size()-1]; 
    780         Hydrogen::get_instance()->getSong()->set_filename(jackSessionDirectory + realFillename); 
    781         songfilename = "\"${SESSION_DIR}\"" + realFillename; 
    782     }else 
    783     { 
    784         songfilename = Hydrogen::get_instance()->getSong()->get_filename(); 
    785     } 
    786  
     776    QString jackSessionDirectory = (QString)ev->session_dir; 
     777    QStringList list1 = Hydrogen::get_instance()->getSong()->get_filename().split("/"); 
     778    QString realFillename = list1[list1.size()-1]; 
     779    Hydrogen::get_instance()->getSong()->set_filename(jackSessionDirectory + realFillename); 
     780    songfilename = "\"${SESSION_DIR}\"" + realFillename; 
    787781 
    788782    QString retval = QString(Preferences::get_instance()->getJackSessionApplicationPath() + " -s" + songfilename + " --jacksessionid " + ev->client_uuid); 
     
    793787    } 
    794788    if (ev->type == JackSessionSaveAndQuit) { 
    795         if(Preferences::get_instance()->getJackSessionUseSessionDir()){ 
    796789            EventQueue::get_instance()->push_event(EVENT_JACK_SESSION, SAVE_SESSION); 
    797         } 
    798         EventQueue::get_instance()->push_event(EVENT_JACK_SESSION, SAVE_AND_QUIT); 
     790            EventQueue::get_instance()->push_event(EVENT_JACK_SESSION, SAVE_AND_QUIT); 
    799791    } 
    800792 
  • trunk/src/core/src/preferences.cpp

    r2467 r2482  
    7373        m_brestartLash = false; 
    7474        m_bsetLash = false; 
    75  
    76 #ifdef H2CORE_HAVE_JACKSESSION 
    77         m_bjackSessionUseSessionDir = false; 
    78 #endif 
    7975 
    8076        //init pre delete default 
     
    410406                        hearNewNotes = LocalFileMng::readXmlBool( rootNode, "hearNewNotes", hearNewNotes ); 
    411407                        quantizeEvents = LocalFileMng::readXmlBool( rootNode, "quantizeEvents", quantizeEvents ); 
    412  
    413 #ifdef H2CORE_HAVE_JACKSESSION 
    414                         m_bjackSessionUseSessionDir = LocalFileMng::readXmlBool( rootNode, "JackSessionUseSessionDir", m_bjackSessionUseSessionDir ); 
    415 #endif 
    416408                         
    417409                        //rubberband 
     
    764756        LocalFileMng::writeXmlString( rootNode, "postDelete", QString("%1").arg(m_nRecPostDelete) ); 
    765757 
    766 #ifdef H2CORE_HAVE_JACKSESSION 
    767         LocalFileMng::writeXmlString( rootNode, "JackSessionUseSessionDir", m_bjackSessionUseSessionDir ? "true": "false" ); 
    768 #endif 
    769  
    770758        //show development version warning 
    771759        LocalFileMng::writeXmlString( rootNode, "showDevelWarning", m_bShowDevelWarning ? "true": "false" ); 
  • trunk/src/gui/src/MainForm.cpp

    r2481 r2482  
    487487 
    488488        QString filename; 
    489         if (fd->exec() == QDialog::Accepted) { 
     489        if (fd->exec() == QDialog::Accepted) { 
    490490                filename = fd->selectedFiles().first(); 
    491491        } 
     
    511511        QString filename = song->get_filename(); 
    512512 
    513         if ( filename.isEmpty() ) { 
    514                 // just in case! 
    515                 return action_file_save_as(); 
    516         } 
     513        if ( filename.isEmpty() ) { 
     514                // just in case! 
     515                return action_file_save_as(); 
     516        } 
    517517 
    518518        bool saved = false; 
     
    14691469                      action_file_exit(); 
    14701470                      break; 
    1471                case 3: 
    1472                       action_file_save(); 
    1473                       QMessageBox::information( this, "Hydrogen", trUtf8( "Sorry, the Hydrogen-Songfile is not saved properly in this Jack-Session! You have to repeat the \"Save-Session\" procedure from your Jack-Session-Manager.") ); 
    14741471        } 
    14751472 
  • trunk/src/gui/src/MainForm.h

    r2481 r2482  
    6868                void action_file_open(); 
    6969                void action_file_openDemo(); 
    70                 void action_file_save(); 
     70                void action_file_save(); 
    7171                void action_file_save_as(); 
    7272                void action_file_openPattern(); 
  • trunk/src/gui/src/PreferencesDialog.cpp

    r2471 r2482  
    261261#endif 
    262262 
    263 #ifdef H2CORE_HAVE_JACKSESSION 
    264         useJackSessinStoreFiles->setVisible(true); 
    265         useJackSessinStoreFiles->setChecked(pPref->getJackSessionUseSessionDir()); 
    266 #else 
    267         useJackSessinStoreFiles->setVisible(false); 
    268 #endif 
    269  
    270263        m_bNeedDriverRestart = false; 
    271264        connect(m_pMidiDriverComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT( onMidiDriverComboBoxIndexChanged(int) )); 
     
    421414        //path to rubberband 
    422415        pPref-> m_rubberBandCLIexecutable = rubberbandLineEdit->text(); 
    423  
    424 #ifdef H2CORE_HAVE_JACKSESSION 
    425         pPref->setJackSessionUseSessionDir(useJackSessinStoreFiles->isChecked()); 
    426 #endif 
    427416 
    428417        //check preferences  
  • trunk/src/gui/src/UI/PreferencesDialog_UI.ui

    r2359 r2482  
    331331     </property> 
    332332    </widget> 
    333     <widget class="QCheckBox" name="useJackSessinStoreFiles"> 
    334      <property name="geometry"> 
    335       <rect> 
    336        <x>10</x> 
    337        <y>100</y> 
    338        <width>511</width> 
    339        <height>31</height> 
    340       </rect> 
    341      </property> 
    342      <property name="text"> 
    343       <string>Save song files in Jack Session Directory (default on)</string> 
    344      </property> 
    345     </widget> 
    346333   </widget> 
    347334   <widget class="QWidget" name="tab_2">