Changeset 181 for smplayer/trunk/src/deviceinfo.cpp
- Timestamp:
- Aug 31, 2016, 5:31:04 PM (9 years ago)
- Location:
- smplayer/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/trunk
- Property svn:mergeinfo changed
/smplayer/vendor/current merged: 179
- Property svn:mergeinfo changed
-
smplayer/trunk/src/deviceinfo.cpp
r176 r181 27 27 DeviceList DeviceInfo::retrieveDevices(DeviceType type) { 28 28 qDebug("DeviceInfo::retrieveDevices: %d", type); 29 29 30 DeviceList l; 31 32 #ifdef CACHE_DEVICE_INFO 30 33 QString inifile = Paths::configPath() + "/device_info.ini"; 31 34 QSettings set(inifile, QSettings::IniFormat); 32 QString section_name = "display _devices";33 if (type == Sound) section_name = "dsound _devices";34 35 QString section_name = "display-devices"; 36 if (type == Sound) section_name = "dsound-devices"; 37 35 38 // Check if we already have the list stored in the INI file 36 DeviceListl = loadList(&set, section_name);39 l = loadList(&set, section_name); 37 40 if (l.count() > 0) return l; 38 41 #endif 42 39 43 QRegExp rx_device("^(\\d+): (.*)"); 40 44 41 45 if (QFile::exists("dxlist.exe")) { 42 46 QProcess p; … … 60 64 } 61 65 } 62 66 67 #ifdef CACHE_DEVICE_INFO 63 68 saveList(&set, section_name, l); 64 69 #endif 70 65 71 return l; 66 72 } … … 79 85 qDebug("DeviceInfo::alsaDevices"); 80 86 87 DeviceList l; 88 89 #ifdef CACHE_DEVICE_INFO 81 90 QString inifile = Paths::configPath() + "/device_info.ini"; 82 91 QSettings set(inifile, QSettings::IniFormat); 83 92 84 93 // Check if we already have the list stored in the INI file 85 DeviceList l = loadList(&set, "alsa_devices");94 l = loadList(&set, "alsa-devices"); 86 95 if (l.count() > 0) return l; 96 #endif 87 97 88 98 QRegExp rx_device("^card\\s([0-9]+).*\\[(.*)\\],\\sdevice\\s([0-9]+):"); … … 111 121 } 112 122 113 saveList(&set, "alsa_devices", l); 123 #ifdef CACHE_DEVICE_INFO 124 saveList(&set, "alsa-devices", l); 125 #endif 114 126 115 127 return l; … … 119 131 qDebug("DeviceInfo::xvAdaptors"); 120 132 133 DeviceList l; 134 135 #ifdef CACHE_DEVICE_INFO 121 136 QString inifile = Paths::configPath() + "/device_info.ini"; 122 137 QSettings set(inifile, QSettings::IniFormat); 123 138 124 139 // Check if we already have the list stored in the INI file 125 DeviceList l = loadList(&set, "xv_adaptors");140 l = loadList(&set, "xv-adaptors"); 126 141 if (l.count() > 0) return l; 142 #endif 127 143 128 144 QRegExp rx_device("^.*Adaptor #([0-9]+): \"(.*)\""); … … 149 165 } 150 166 151 saveList(&set, "xv_adaptors", l); 167 #ifdef CACHE_DEVICE_INFO 168 saveList(&set, "xv-adaptors", l); 169 #endif 152 170 153 171 return l; … … 156 174 #endif 157 175 176 #ifdef CACHE_DEVICE_INFO 158 177 void DeviceInfo::saveList(QSettings * set, const QString & section_name, const DeviceList & list) { 159 178 set->beginWriteArray(section_name); … … 161 180 set->setArrayIndex(i); 162 181 set->setValue("ID", list.at(i).ID()); 163 set->setValue(" password", list.at(i).desc());182 set->setValue("description", list.at(i).desc()); 164 183 } 165 184 set->endArray(); … … 173 192 set->setArrayIndex(i); 174 193 QVariant id = set->value("ID"); 175 QString desc = set->value(" password", "").toString();194 QString desc = set->value("description", "").toString(); 176 195 l.append(DeviceData(id, desc)); 177 196 } … … 181 200 return l; 182 201 } 202 #endif
Note:
See TracChangeset
for help on using the changeset viewer.