Changeset 483
- Timestamp:
- 09/16/08 19:56:42 (5 years ago)
- Location:
- branches/audiofilebrowser
- Files:
-
- 5 modified
-
gui/src/AudioFileBrowser/AudioFileBrowser.cpp (modified) (7 diffs)
-
gui/src/AudioFileBrowser/AudioFileBrowser.h (modified) (2 diffs)
-
gui/src/AudioFileBrowser/AudioFileBrowser_UI.ui (modified) (8 diffs)
-
libs/hydrogen/include/hydrogen/Preferences.h (modified) (1 diff)
-
libs/hydrogen/src/preferences.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/audiofilebrowser/gui/src/AudioFileBrowser/AudioFileBrowser.cpp
r482 r483 60 60 installEventFilter(this); 61 61 62 QDir lastsampleDirectory = Preferences::getInstance()->__lastsampleDirectory; 63 62 64 63 65 model = new QDirModel(); … … 70 72 71 73 // namelabel->setText(model->headerData()); 72 QTreeView *tree = new QTreeView(treeView);74 tree = new QTreeView(treeView); 73 75 tree->setModel(model); 74 76 tree->resize(799, 310); 75 77 tree->header()->resizeSection ( 0, 405 ); 76 tree->setRootIndex(model->index(QDir::homePath())); 77 78 tree->setRootIndex(model->index(Preferences::getInstance()->__lastsampleDirectory)); 79 80 pathLineEdit->setText(Preferences::getInstance()->__lastsampleDirectory); 78 81 m_psamplefilename = ""; 79 82 m_pselectedFile = ""; 80 83 81 84 connect(tree, SIGNAL(clicked(const QModelIndex&)), SLOT(clicked(const QModelIndex&))); 85 connect(pathLineEdit, SIGNAL( returnPressed() ), SLOT( updateModelIndex( ) )); 86 87 // QTimer *timer = new QTimer( this ); 88 // connect(timer, SIGNAL(timeout() ), this, SLOT( updateModelIndex() ) ); 89 // timer->start( 1000 ); 82 90 83 91 } … … 91 99 92 100 101 void AudioFileBrowser::updateModelIndex( ) 102 { 103 tree->setRootIndex(model->index( pathLineEdit->text())); 104 } 93 105 94 106 void AudioFileBrowser::clicked(const QModelIndex& index) … … 96 108 97 109 QString path = model->filePath(index); 110 pathLineEdit->setText(path); 98 111 filelineedit->setText(path); 112 99 113 if ( model->isDir(index)) 100 114 return; 101 115 102 116 QString name = path.section( '/', -1 ); 117 118 QString path2 = path; 119 QString onlypath = path; 120 if (name != ""){ 121 onlypath = path.replace( name, ""); 122 } 123 103 124 name = name.left('.'); 104 125 105 126 QString message = "Name: " + name; 106 filelineedit->setText(path); 127 filelineedit->setText(path2); 128 pathLineEdit->setText(onlypath); 107 129 108 130 109 131 if ( 110 ( path .endsWith( ".wav" ) ) ||111 ( path .endsWith( ".WAV" ) ) ||112 ( path .endsWith( ".au" ) ) ||113 ( path .endsWith( ".AU" ) ) ||114 ( path .endsWith( ".aiff" ) ) ||115 ( path .endsWith( ".AIFF" ) ) ||116 ( path .endsWith( ".flac" ) ) ||117 ( path .endsWith( ".FLAC" ) )132 ( path2.endsWith( ".wav" ) ) || 133 ( path2.endsWith( ".WAV" ) ) || 134 ( path2.endsWith( ".au" ) ) || 135 ( path2.endsWith( ".AU" ) ) || 136 ( path2.endsWith( ".aiff" ) ) || 137 ( path2.endsWith( ".AIFF" ) ) || 138 ( path2.endsWith( ".flac" ) ) || 139 ( path2.endsWith( ".FLAC" ) ) 118 140 ) { 119 141 120 142 121 Sample *pNewSample = Sample::load( path );143 Sample *pNewSample = Sample::load( path2 ); 122 144 if (pNewSample) { 123 145 m_pNBytesLable->setText( trUtf8( "Size: %1 bytes" ).arg( pNewSample->get_size() ) ); … … 131 153 delete pNewSample; 132 154 } 155 133 156 m_pPlayBtn->setEnabled( true ); 134 157 openBTN->setEnabled( true ); 135 m_psamplefilename = path ;158 m_psamplefilename = path2; 136 159 } 137 160 m_pNameLabel->setText(message); … … 164 187 void AudioFileBrowser::on_cancelBTN_clicked() 165 188 { 189 Preferences::getInstance()->__lastsampleDirectory = pathLineEdit->text(); 166 190 m_pselectedFile = ""; 167 191 reject(); … … 189 213 m_pselectedFile = ""; 190 214 } 215 Preferences::getInstance()->__lastsampleDirectory = pathLineEdit->text(); 191 216 accept(); 192 217 } -
branches/audiofilebrowser/gui/src/AudioFileBrowser/AudioFileBrowser.h
r481 r483 56 56 void clicked(const QModelIndex& index); 57 57 void on_m_pPlayBtn_clicked(); 58 void updateModelIndex(); 58 59 59 60 private: … … 62 63 QString m_pselectedFile; 63 64 QDirModel *model; 65 QTreeView *tree; 64 66 65 67 -
branches/audiofilebrowser/gui/src/AudioFileBrowser/AudioFileBrowser_UI.ui
r482 r483 7 7 <y>0</y> 8 8 <width>824</width> 9 <height>5 02</height>9 <height>529</height> 10 10 </rect> 11 11 </property> … … 16 16 <property name="geometry" > 17 17 <rect> 18 <x>6 40</x>19 <y>4 60</y>20 <width> 75</width>18 <x>604</x> 19 <y>490</y> 20 <width>101</width> 21 21 <height>26</height> 22 22 </rect> … … 30 30 <rect> 31 31 <x>360</x> 32 <y>3 60</y>32 <y>390</y> 33 33 <width>451</width> 34 34 <height>91</height> … … 46 46 <rect> 47 47 <x>10</x> 48 <y>3 60</y>48 <y>390</y> 49 49 <width>341</width> 50 50 <height>91</height> … … 113 113 <property name="geometry" > 114 114 <rect> 115 <x>7 40</x>116 <y>4 60</y>117 <width> 75</width>115 <x>714</x> 116 <y>490</y> 117 <width>101</width> 118 118 <height>26</height> 119 119 </rect> … … 127 127 <rect> 128 128 <x>360</x> 129 <y>4 60</y>130 <width> 91</width>129 <y>490</y> 130 <width>111</width> 131 131 <height>26</height> 132 132 </rect> … … 137 137 </widget> 138 138 <widget class="QWidget" name="layoutWidget" > 139 <property name="geometry" > 140 <rect> 141 <x>10</x> 142 <y>40</y> 143 <width>801</width> 144 <height>341</height> 145 </rect> 146 </property> 147 <layout class="QVBoxLayout" name="verticalLayout" > 148 <item> 149 <widget class="QTreeView" name="treeView" /> 150 </item> 151 <item> 152 <widget class="QLineEdit" name="filelineedit" /> 153 </item> 154 </layout> 155 </widget> 156 <widget class="QCheckBox" name="playSamplescheckBox" > 157 <property name="geometry" > 158 <rect> 159 <x>10</x> 160 <y>490</y> 161 <width>311</width> 162 <height>21</height> 163 </rect> 164 </property> 165 <property name="text" > 166 <string>Play samples by clicking</string> 167 </property> 168 </widget> 169 <widget class="QWidget" name="" > 139 170 <property name="geometry" > 140 171 <rect> … … 142 173 <y>10</y> 143 174 <width>801</width> 144 <height>341</height> 145 </rect> 146 </property> 147 <layout class="QVBoxLayout" name="verticalLayout" > 148 <item> 149 <widget class="QTreeView" name="treeView" /> 150 </item> 151 <item> 152 <widget class="QLineEdit" name="filelineedit" /> 175 <height>27</height> 176 </rect> 177 </property> 178 <layout class="QHBoxLayout" name="horizontalLayout" > 179 <item> 180 <widget class="QLineEdit" name="pathLineEdit" /> 181 </item> 182 <item> 183 <widget class="QToolButton" name="m_pPathUptoolButton" > 184 <property name="text" > 185 <string>up</string> 186 </property> 187 </widget> 153 188 </item> 154 189 </layout> 155 190 </widget> 156 <widget class="QCheckBox" name="playSamplescheckBox" >157 <property name="geometry" >158 <rect>159 <x>10</x>160 <y>460</y>161 <width>311</width>162 <height>21</height>163 </rect>164 </property>165 <property name="text" >166 <string>Play samples by clicking</string>167 </property>168 </widget>169 191 </widget> 192 <tabstops> 193 <tabstop>pathLineEdit</tabstop> 194 <tabstop>m_pPathUptoolButton</tabstop> 195 <tabstop>treeView</tabstop> 196 <tabstop>filelineedit</tabstop> 197 <tabstop>playSamplescheckBox</tabstop> 198 <tabstop>m_pPlayBtn</tabstop> 199 <tabstop>openBTN</tabstop> 200 <tabstop>cancelBTN</tabstop> 201 </tabstops> 170 202 <resources/> 171 203 <connections/> -
branches/audiofilebrowser/libs/hydrogen/include/hydrogen/Preferences.h
r452 r483 144 144 QString m_sPreferencesFilename; 145 145 QString m_sPreferencesDirectory; 146 QString __lastsampleDirectory; 146 147 147 148 bool m_bFollowPlayhead; -
branches/audiofilebrowser/libs/hydrogen/src/preferences.cpp
r452 r483 125 125 m_sDataDirectory = QDir::homePath().append( "/.hydrogen/data/" ); 126 126 #endif 127 127 __lastsampleDirectory = QDir::homePath(); 128 128 129 loadPreferences( true ); // Global settings 129 130 loadPreferences( false ); // User settings