indicador de volumen con dos decimales

This commit is contained in:
snt 2024-04-24 20:23:20 +02:00
parent 32a1e5cb0c
commit 3613d8fa51
12 changed files with 53 additions and 187 deletions

View file

@ -20,133 +20,11 @@
#include "libremediaserver-audio.h"
// Handler for pipe the stderr to a log file and texEdit
//bool initMessageHandler = false;
//QFile outFile;
//QMutex mutex;
//QMutexLocker mutexLocker(mutex);
/*
void MessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
Q_UNUSED(context);
// mutex.lock();
// Create the log dir and log file
if (!initMessageHandler) {
QDir dir;
if (!dir.exists("log")) {
if (!dir.mkdir("log")) {
qDebug()<<"MessageHandler: Can not create log folder";
return;
}
}
QString filename;
QDate date = QDate::currentDate();
QTime time = QTime::currentTime();
filename.append("./log/log_");
filename.append(date.toString("ddMMyy-"));
filename.append(time.toString("hhmmss.txt"));
outFile.setFileName(filename);
if (!outFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
qWarning("main/MessageHandler/Qfile::open: can not open log file");
return;
}
initMessageHandler = true;
}
QTextStream ts(&outFile);*/
/* if (libreMediaServerAudio::textEdit == 0)
{
QByteArray localMsg = msg.toLocal8Bit();
switch (type) {
case QtDebugMsg:
fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtWarningMsg:
fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtCriticalMsg:
fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtFatalMsg:
fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
abort();
}
}
else
{
QString txt;
switch (type) {
case QtDebugMsg:
txt.append("Debug from File: ");
txt.append(context.file);
txt.append(" Line: ");
txt.append(QString::number(context.line));
// txt.append(" Function: ");
// txt.append(context.function);
txt.append(" Message: ");
txt.append(msg);
// libreMediaServerAudio::textEdit->append(msg);, context.file, context.line, context.function);
libreMediaServerAudio::textEdit->append(txt);
break;
case QtWarningMsg:
txt.append("Warning from File: ");
txt.append(context.file);
txt.append(" Line: ");
txt.append(QString::number(context.line));
txt.append(" Function: ");
txt.append(context.function);
txt.append(" Message: ");
txt.append(msg);
// libreMediaServerAudio::textEdit->append(msg);, context.file, context.line, context.function);
libreMediaServerAudio::textEdit->append(txt);
abort();
break;
case QtCriticalMsg:
// txt.append("Critical from File: ");
txt.append(context.file);
txt.append(" Line: ");
txt.append(QString::number(context.line));
txt.append(" Function: ");
txt.append(context.function);
txt.append(" Message ");
txt.append(msg);
// libreMediaServerAudio::textEdit->append(msg);, context.file, context.line, context.function);
libreMediaServerAudio::textEdit->append(txt);
abort();
break;
case QtFatalMsg:
// txt.append("Fatal from File: ");
txt.append(context.file);
txt.append(" Line: ");
txt.append(QString::number(context.line));
txt.append(" Function: ");
txt.append(context.function);
txt.append(" Message: ");
txt.append(msg);
// libreMediaServerAudio::textEdit->append(msg);, context.file, context.line, context.function);
libreMediaServerAudio::textEdit->append(txt);// ts << txt << endl;
abort();
}
// outFile.write(txt.toLatin1().constData(), txt.size());
// ts << txt << endl;
// libreMediaServerAudio::textEdit->append(txt);
}
// mutex.unlock();
}*/
int main(int argc, char *argv[])
{
// ToDo: discriminar niveles de log y log a fichero segúna argumentos
/*
if (args.contains("-log"))
{
qInstallMessageHandler(MessageHandler);
}*/
QApplication app(argc, argv);
QStringList args = app.arguments();
if (args.size() > 1)
{
if (args.contains("-v"))
@ -163,7 +41,6 @@ int main(int argc, char *argv[])
qDebug() << LICENSE;
qDebug() << "Help for command line options:";
qDebug() << "-v show the version and exits";
qDebug() << "-log write the debug information to a log file instead stderr";
qDebug() << "-h this help";
return 0;
}
@ -172,5 +49,3 @@ int main(int argc, char *argv[])
libreMediaServerAudio.show();
return app.exec();
}