void CommandScriptController::ExecuteScript(ScriptConfig::Script* script) { PrintMessage(Message::mkInfo, "Executing script %s with command %s", script->GetName(), *m_command); SetArgs({script->GetLocation()}); BString<1024> infoName("script %s with command %s", script->GetName(), *m_command); SetInfoName(infoName); SetLogPrefix(script->GetDisplayName()); PrepareParams(script->GetName()); int exitCode = Execute(); infoName[0] = 'S'; // uppercase SetLogPrefix(nullptr); switch (exitCode) { case COMMANDPROCESS_SUCCESS: PrintMessage(Message::mkInfo, "%s successful", *infoName); break; case COMMANDPROCESS_ERROR: case -1: // Execute() returns -1 if the process could not be started (file not found or other problem) PrintMessage(Message::mkError, "%s failed", *infoName); break; default: PrintMessage(Message::mkError, "%s failed (terminated with unknown status)", *infoName); break; } }
static void FillHostDeviceInfo(DeviceSourceMap *map, const PaDeviceInfo *info, int deviceIndex, int isInput) { wxString hostapiName(Pa_GetHostApiInfo(info->hostApi)->name, wxConvLocal); wxString infoName(info->name, wxConvLocal); map->deviceIndex = deviceIndex; map->hostIndex = info->hostApi; map->deviceString = infoName; map->hostString = hostapiName; map->numChannels = isInput ? info->maxInputChannels : info->maxOutputChannels; }
TankInfoModel::TankInfoModel() : rows(-1) { setHeaderDataStrings( QStringList() << tr("Description") << tr("Ml") << tr("Bar")); struct tank_info_t *info = tank_info; for (info = tank_info; info->name; info++, rows++){ QString infoName(info->name); if (infoName.count() > biggerEntry.count()) biggerEntry = infoName; } if (rows > -1) { beginInsertRows(QModelIndex(), 0, rows); endInsertRows(); } }
TankInfoModel::TankInfoModel() : QAbstractTableModel(), rows(-1) { struct tank_info *info = tank_info; for (info = tank_info; info->name; info++, rows++){ QString infoName(info->name); if (infoName.count() > biggerEntry.count()){ biggerEntry = infoName; } } if (rows > -1) { beginInsertRows(QModelIndex(), 0, rows); endInsertRows(); } }
void QueueScriptController::ExecuteScript(ScriptConfig::Script* script) { PrintMessage(m_event == QueueScriptCoordinator::qeFileDownloaded ? Message::mkDetail : Message::mkInfo, "Executing queue-script %s for %s", script->GetName(), FileSystem::BaseFileName(m_nzbName)); SetArgs({script->GetLocation()}); BString<1024> infoName("queue-script %s for %s", script->GetName(), FileSystem::BaseFileName(m_nzbName)); SetInfoName(infoName); SetLogPrefix(script->GetDisplayName()); m_prefixLen = strlen(script->GetDisplayName()) + 2; // 2 = strlen(": "); PrepareParams(script->GetName()); Execute(); SetLogPrefix(nullptr); }