Commit ac46081d authored by Leander Schulten's avatar Leander Schulten
Browse files

AudioManager: The SettingsView will now display the capture lib at startup.

ModelVector: Add support for inserting values.
parent 2ae9449c
Pipeline #190750 passed with stage
in 4 minutes and 58 seconds
......@@ -155,14 +155,14 @@ bool AudioCaptureManager::startCapturingFromInput(unsigned input) {
return true;
}
bool AudioCaptureManager::loadCaptureLibrary(QString name, QString filePathToCaptureLibrary) {
bool AudioCaptureManager::loadCaptureLibrary(const QString &name, const QString &filePathToCaptureLibrary) {
auto func = reinterpret_cast<CaptureLibEntry>(QLibrary::resolve(filePathToCaptureLibrary, "captureAudio"));
if (func) {
// replace if name is already there
auto res = captureLibraries.emplace(name, func);
if (res.second) {
auto pos = std::distance(captureLibraries.begin(), res.first);
captureDeviceNames.getVector().insert(captureDeviceNames.cbegin() + pos, name);
captureDeviceNames.insert(static_cast<int>(pos), name);
if (currentCaptureDevice >= pos) {
currentCaptureDevice++;
emit currentCaptureDeviceChanged();
......
......@@ -103,7 +103,7 @@ public:
* @param filePathToCaptureLibrary The path to the capture lib
* @return true, if the loading was successfull, false otherwise
*/
bool loadCaptureLibrary(QString name, QString filePathToCaptureLibrary);
bool loadCaptureLibrary(const QString &name, const QString &filePathToCaptureLibrary);
/**
* @brief startCapturingFromDevice starts the capturing with a capture device with the given name. For the names, see getCaptureDeviceNames()
......
......@@ -164,6 +164,14 @@ public:
* @brief endPushBack Call this function if you have started push_backing with beginPushBack and are finisched
*/
void endPushBack(){endInsertRows();}
void beginInsert(int firstIndex, int length) { beginInsertRows(QModelIndex(), firstIndex, firstIndex + length - 1); }
void endInsert() { endInsertRows(); }
auto insert(int index, const Type &value) {
beginInsert(index, 1);
auto res = model.insert(cbegin() + index, value);
endInsert();
return res;
}
typename std::vector<Type>::const_iterator cbegin()const{
return model.cbegin();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment