Inform the user if the current user doesn't belong to the vitamtp group.

Updated translations.
This commit is contained in:
codestation
2015-03-15 21:06:52 -04:30
parent 135f42b498
commit 1a30cee9c5
8 changed files with 213 additions and 117 deletions

View File

@@ -92,6 +92,10 @@ void HeadlessManager::start()
QSettings settings;
if(!settings.value("disableUSB", false).toBool()) {
if(!belongsToGroup("vitamtp"))
qCritical() << tr("This user doesn't belong to the vitamtp group, there could be a problem while reading the USB bus.");
usb_thread = new QThread();
client = new CmaClient(m_db);
usb_thread->setObjectName("usb_thread");

View File

@@ -36,15 +36,27 @@
#include "headlessmanager.h"
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
static void noMessageOutput(QtMsgType type, const QMessageLogContext &, const QString & str)
static void noDebugOutput(QtMsgType type, const QMessageLogContext &, const QString & msg)
{
const char * msg = str.toStdString().c_str();
QByteArray localMsg = msg.toLocal8Bit();
const char *message = localMsg.constData();
#else
static void noMessageOutput(QtMsgType type, const char *msg)
static void noDebugOutput(QtMsgType type, const char *message)
{
#endif
Q_UNUSED(type);
Q_UNUSED(msg);
switch (type) {
case QtDebugMsg:
break;
case QtWarningMsg:
fprintf(stderr, "Warning: %s\n", message);
break;
case QtCriticalMsg:
fprintf(stderr, "Critical: %s\n", message);
break;
case QtFatalMsg:
fprintf(stderr, "Fatal: %s\n", message);
abort();
}
}
static bool setup_handlers()
@@ -102,9 +114,9 @@ int main(int argc, char *argv[])
} else {
VitaMTP_Set_Logging(VitaMTP_NONE);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
qInstallMessageHandler(noMessageOutput);
qInstallMessageHandler(noDebugOutput);
#else
qInstallMsgHandler(noMessageOutput);
qInstallMsgHandler(noDebugOutput);
#endif
}