Changeset 481
- Timestamp:
- 09/16/08 13:06:57 (5 years ago)
- Location:
- branches/audiofilebrowser/gui/src
- Files:
-
- 4 modified
-
AudioFileBrowser/AudioFileBrowser.cpp (modified) (6 diffs)
-
AudioFileBrowser/AudioFileBrowser.h (modified) (1 diff)
-
AudioFileBrowser/AudioFileBrowser_UI.ui (modified) (6 diffs)
-
InstrumentEditor/InstrumentEditor.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/audiofilebrowser/gui/src/AudioFileBrowser/AudioFileBrowser.cpp
r480 r481 30 30 #include <hydrogen/Preferences.h> 31 31 #include <hydrogen/hydrogen.h> 32 #include <hydrogen/sample.h> 32 33 33 34 #include "../widgets/Button.h" … … 62 63 model->setSorting(QDir::DirsFirst |QDir::Name); 63 64 QModelIndex index = model->index(QDir::currentPath()); 64 65 66 m_pPlayBtn->setEnabled( false ); 65 67 66 68 … … 69 71 tree->setModel(model); 70 72 tree->resize(799, 310); 73 tree->header()->resizeSection ( 0, 405 ); 71 74 tree->setRootIndex(model->index(QDir::homePath())); 72 75 73 74 75 lastUsedDir = ""; 76 m_pselectedFile = lastUsedDir; 76 m_psamplefilename = ""; 77 m_pselectedFile = ""; 77 78 78 79 connect(tree, SIGNAL(clicked(const QModelIndex&)), SLOT(clicked(const QModelIndex&))); … … 89 90 void AudioFileBrowser::clicked(const QModelIndex& index) 90 91 { 92 93 QString path = model->filePath(index); 94 filelineedit->setText(path); 91 95 if ( model->isDir(index)) 92 96 return; 93 QString path = model->filePath(index); 94 QString message = "File: " + path; 95 namelabel->setText(message); 97 98 QString name = path.section( '/', -1 ); 99 name = name.left('.'); 100 101 QString message = "Name: " + name; 102 filelineedit->setText(path); 103 104 // QString fileinfo = model->fileInfo(index); 105 96 106 if ( 97 107 ( path.endsWith( ".wav" ) ) || … … 104 114 ( path.endsWith( ".FLAC" ) ) 105 115 ) { 106 107 m_pselectedFile = path; 108 }else 109 { 110 m_pselectedFile = ""; 116 117 Sample *pNewSample = Sample::load( path ); 118 if (pNewSample) { 119 m_pNBytesLable->setText( trUtf8( "Size: %1 bytes" ).arg( pNewSample->get_size() ) ); 120 m_pSamplerateLable->setText( trUtf8( "Samplerate: %1" ).arg( pNewSample->get_sample_rate() ) ); 121 m_pLengthLable->setText( trUtf8( "Samplelength: %1 s" ).arg( pNewSample->get_n_frames() / pNewSample->get_sample_rate() ) ); 122 123 delete pNewSample; 124 m_pPlayBtn->setEnabled( true ); 125 m_psamplefilename = path; 126 } 127 m_pNameLabel->setText(message); 128 }else{ 129 m_pNameLabel->setText( trUtf8( "Name:")); 130 m_pNBytesLable->setText( trUtf8( "Size:" ) ); 131 m_pSamplerateLable->setText( trUtf8( "Samplerate:" ) ); 132 m_pLengthLable->setText( trUtf8( "Samplelength:" ) ); 133 m_pPlayBtn->setEnabled( false ); 134 m_psamplefilename = ""; 111 135 } 112 136 } 113 137 138 139 void AudioFileBrowser::on_m_pPlayBtn_clicked() 140 { 141 } 114 142 115 143 void AudioFileBrowser::on_cancelBTN_clicked() … … 122 150 void AudioFileBrowser::on_openBTN_clicked() 123 151 { 152 if ( 153 ( ( filelineedit->text().endsWith( ".wav" ) ) || 154 ( filelineedit->text().endsWith( ".WAV" ) ) || 155 ( filelineedit->text().endsWith( ".au" ) ) || 156 ( filelineedit->text().endsWith( ".AU" ) ) || 157 ( filelineedit->text().endsWith( ".aiff" ) ) || 158 ( filelineedit->text().endsWith( ".AIFF" ) ) || 159 ( filelineedit->text().endsWith( ".flac" ) ) || 160 ( filelineedit->text().endsWith( ".FLAC" ) ) ) && 161 ( QFile( filelineedit->text() ).exists() == true ) 162 ) { 163 m_pselectedFile = filelineedit->text(); 164 165 }else 166 { 167 m_pselectedFile = ""; 168 } 124 169 accept(); 125 170 } -
branches/audiofilebrowser/gui/src/AudioFileBrowser/AudioFileBrowser.h
r480 r481 55 55 void on_openBTN_clicked(); 56 56 void clicked(const QModelIndex& index); 57 void on_m_pPlayBtn_clicked(); 57 58 58 59 private: 59 60 InstrumentEditor* m_pInstrumentEditor; 60 QString lastUsedDir;61 QString m_psamplefilename; 61 62 QString m_pselectedFile; 62 63 QDirModel *model; -
branches/audiofilebrowser/gui/src/AudioFileBrowser/AudioFileBrowser_UI.ui
r480 r481 57 57 <enum>QFrame::Raised</enum> 58 58 </property> 59 <widget class="QLabel" name=" namelabel" >59 <widget class="QLabel" name="m_pNameLabel" > 60 60 <property name="geometry" > 61 61 <rect> … … 70 70 </property> 71 71 </widget> 72 <widget class="QLabel" name=" lenghtlabel" >72 <widget class="QLabel" name="m_pSamplerateLable" > 73 73 <property name="geometry" > 74 74 <rect> … … 80 80 </property> 81 81 <property name="text" > 82 <string> Length:</string>82 <string>Samplerate:</string> 83 83 </property> 84 84 </widget> 85 <widget class="QLabel" name=" sampleratelabel" >85 <widget class="QLabel" name="m_pNBytesLable" > 86 86 <property name="geometry" > 87 87 <rect> … … 93 93 </property> 94 94 <property name="text" > 95 <string>S amplerate:</string>95 <string>Size:</string> 96 96 </property> 97 97 </widget> 98 <widget class="QLabel" name=" sampledepthlabel" >98 <widget class="QLabel" name="m_pLengthLable" > 99 99 <property name="geometry" > 100 100 <rect> … … 106 106 </property> 107 107 <property name="text" > 108 <string> Sampledepht:</string>108 <string>Length:</string> 109 109 </property> 110 110 </widget> … … 123 123 </property> 124 124 </widget> 125 <widget class="QPushButton" name=" listenBTN" >125 <widget class="QPushButton" name="m_pPlayBtn" > 126 126 <property name="geometry" > 127 127 <rect> 128 128 <x>360</x> 129 129 <y>460</y> 130 <width> 75</width>130 <width>91</width> 131 131 <height>26</height> 132 132 </rect> 133 133 </property> 134 134 <property name="text" > 135 <string> Listen</string>135 <string>Play Sample</string> 136 136 </property> 137 137 </widget> -
branches/audiofilebrowser/gui/src/InstrumentEditor/InstrumentEditor.cpp
r480 r481 486 486 487 487 Hydrogen *engine = Hydrogen::get_instance(); 488 MainForm *pMainForm = HydrogenApp::getInstance()->getMainForm();488 // MainForm *pMainForm = HydrogenApp::getInstance()->getMainForm(); 489 489 490 490