| 31 | int RecentFileManager::MAX_SF2_FILES = 10; |
| 32 | |
| 33 | RecentFileManager::RecentFileManager(ConfManager * configuration) : QObject(nullptr), |
| 34 | _configuration(configuration) |
| 35 | { |
| 36 | // Load recent files |
| 37 | _recordFile = _configuration->getValue(ConfManager::SECTION_RECENT_FILES, "record", "").toString(); |
| 38 | _sampleFile = _configuration->getValue(ConfManager::SECTION_RECENT_FILES, "sample", "").toString(); |
| 39 | _exportFile = _configuration->getValue(ConfManager::SECTION_RECENT_FILES, "export", "").toString(); |
| 40 | _pngFile = _configuration->getValue(ConfManager::SECTION_RECENT_FILES, "frequencies", "").toString(); |
| 41 | _executableFile = _configuration->getValue(ConfManager::SECTION_RECENT_FILES, "executable", "").toString(); |
| 42 | _uploadFile = _configuration->getValue(ConfManager::SECTION_RECENT_FILES, "upload", "").toString(); |
| 43 | |
| 44 | // Recent sf2 list |
| 45 | int j = 0; |
| 46 | QString strTmp; |
| 47 | for (int i = 0; i < MAX_SF2_FILES; i++) |
| 48 | { |
| 49 | _listFiles.append(""); |
| 50 | _listDateTimes.append(QDateTime()); |
| 51 | |
| 52 | // Test if still valid |
| 53 | strTmp = _configuration->getValue(ConfManager::SECTION_RECENT_FILES, "file_" + QString::number(i), "").toString(); |
| 54 | QFileInfo fileInfo(strTmp); |
| 55 | if (fileInfo.exists()) |
| 56 | { |
| 57 | _listFiles[j] = strTmp; |
| 58 | |
| 59 | // Date |
| 60 | QString dateStr = _configuration->getValue(ConfManager::SECTION_RECENT_FILES, "file_time_" + QString::number(i), "").toString(); |
| 61 | _listDateTimes[j++] = QDateTime::fromString(dateStr, "yyyy/MM/dd HH:mm:ss"); |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | void RecentFileManager::addRecentFile(FileType fileType, QString filePath) |
| 67 | { |