Added a bunch of warning flags and fixed most of the shadowed
variables.
This commit is contained in:
		@@ -18,6 +18,14 @@ HEADERS += \
 | 
			
		||||
    src/indicator/trayindicator.h \
 | 
			
		||||
    src/indicator/unityindicator.h
 | 
			
		||||
 | 
			
		||||
CXXFLAGS_WARNINGS = -Wall -Wextra -Wshadow -Wcast-align -Wctor-dtor-privacy \
 | 
			
		||||
                    -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations \
 | 
			
		||||
                    -Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls \
 | 
			
		||||
                    -Wstrict-overflow=5 -Wundef -Wno-unused -Wno-missing-field-initializers \
 | 
			
		||||
                    -Wno-format-nonliteral
 | 
			
		||||
 | 
			
		||||
QMAKE_CXXFLAGS += -Wno-write-strings -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS $$CXXFLAGS_WARNINGS
 | 
			
		||||
 | 
			
		||||
DATADIR = $$PREFIX/share
 | 
			
		||||
 | 
			
		||||
actions64.path = $$DATADIR/icons/hicolor/64x64/actions
 | 
			
		||||
 
 | 
			
		||||
@@ -58,8 +58,14 @@ RESOURCES += qcmares.qrc translations.qrc
 | 
			
		||||
CONFIG += link_pkgconfig
 | 
			
		||||
PKGCONFIG = libvitamtp libavformat libavcodec libavutil libswscale
 | 
			
		||||
 | 
			
		||||
CXXFLAGS_WARNINGS = -Wall -Wextra -Wshadow -Wcast-align -Wctor-dtor-privacy \
 | 
			
		||||
                    -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations \
 | 
			
		||||
                    -Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls \
 | 
			
		||||
                    -Wstrict-overflow=5 -Wundef -Wno-unused -Wno-missing-field-initializers \
 | 
			
		||||
                    -Wno-format-nonliteral
 | 
			
		||||
 | 
			
		||||
# custom CXXFLAGS
 | 
			
		||||
QMAKE_CXXFLAGS += -Wno-write-strings -Wall -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
 | 
			
		||||
QMAKE_CXXFLAGS += -Wno-write-strings -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS $$CXXFLAGS_WARNINGS
 | 
			
		||||
 | 
			
		||||
#Linux-only config
 | 
			
		||||
unix:!macx {
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,14 @@ HEADERS += \
 | 
			
		||||
    src/indicator/kdenotifier.h \
 | 
			
		||||
    src/indicator/kdenotifiertray.h
 | 
			
		||||
 | 
			
		||||
CXXFLAGS_WARNINGS = -Wall -Wextra -Wshadow -Wcast-align -Wctor-dtor-privacy \
 | 
			
		||||
                    -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations \
 | 
			
		||||
                    -Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls \
 | 
			
		||||
                    -Wstrict-overflow=5 -Wundef -Wno-unused -Wno-missing-field-initializers \
 | 
			
		||||
                    -Wno-format-nonliteral
 | 
			
		||||
 | 
			
		||||
QMAKE_CXXFLAGS += -Wno-write-strings -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS $$CXXFLAGS_WARNINGS
 | 
			
		||||
 | 
			
		||||
target.path = /usr/lib/qcma
 | 
			
		||||
 | 
			
		||||
INSTALLS += target
 | 
			
		||||
 
 | 
			
		||||
@@ -142,7 +142,7 @@ QByteArray AVDecoder::getAudioThumbnail(int width, int height)
 | 
			
		||||
    return data;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AVFrame *AVDecoder::getDecodedFrame(AVCodecContext *pCodecCtx, int stream_index)
 | 
			
		||||
AVFrame *AVDecoder::getDecodedFrame(AVCodecContext *codec_ctx, int frame_stream_index)
 | 
			
		||||
{
 | 
			
		||||
    AVFrame *pFrame = avcodec_alloc_frame();
 | 
			
		||||
 | 
			
		||||
@@ -150,8 +150,8 @@ AVFrame *AVDecoder::getDecodedFrame(AVCodecContext *pCodecCtx, int stream_index)
 | 
			
		||||
    int frame_finished = 0;
 | 
			
		||||
 | 
			
		||||
    while(!frame_finished && av_read_frame(pFormatCtx, &packet)>=0) {
 | 
			
		||||
        if(packet.stream_index == stream_index) {
 | 
			
		||||
            avcodec_decode_video2(pCodecCtx, pFrame, &frame_finished, &packet);
 | 
			
		||||
        if(packet.stream_index == frame_stream_index) {
 | 
			
		||||
            avcodec_decode_video2(codec_ctx, pFrame, &frame_finished, &packet);
 | 
			
		||||
        }
 | 
			
		||||
        av_free_packet(&packet);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -28,8 +28,8 @@
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
#include <vitamtp.h>
 | 
			
		||||
 | 
			
		||||
HeadlessManager::HeadlessManager(QObject *parent) :
 | 
			
		||||
    QObject(parent), dbus_conn(QDBusConnection::sessionBus())
 | 
			
		||||
HeadlessManager::HeadlessManager(QObject *obj_parent) :
 | 
			
		||||
    QObject(obj_parent), dbus_conn(QDBusConnection::sessionBus())
 | 
			
		||||
{
 | 
			
		||||
    new HeadlessManagerAdaptor(this);
 | 
			
		||||
    QDBusConnection dbus = QDBusConnection::sessionBus();
 | 
			
		||||
 
 | 
			
		||||
@@ -36,11 +36,11 @@
 | 
			
		||||
#include "headlessmanager.h"
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
void noMessageOutput(QtMsgType type, const QMessageLogContext &, const QString & str)
 | 
			
		||||
static void noMessageOutput(QtMsgType type, const QMessageLogContext &, const QString & str)
 | 
			
		||||
{
 | 
			
		||||
    const char * msg = str.toStdString().c_str();
 | 
			
		||||
#else
 | 
			
		||||
void noMessageOutput(QtMsgType type, const char *msg)
 | 
			
		||||
static void noMessageOutput(QtMsgType type, const char *msg)
 | 
			
		||||
{
 | 
			
		||||
#endif
 | 
			
		||||
    Q_UNUSED(type);
 | 
			
		||||
 
 | 
			
		||||
@@ -44,8 +44,8 @@ const char *CmaBroadcast::broadcast_query_end = " * HTTP/1.1\r\n";
 | 
			
		||||
const char *CmaBroadcast::broadcast_ok = "HTTP/1.1 200 OK";
 | 
			
		||||
const char *CmaBroadcast::broadcast_unavailable = "HTTP/1.1 503 NG";
 | 
			
		||||
 | 
			
		||||
CmaBroadcast::CmaBroadcast(QObject *parent) :
 | 
			
		||||
    QObject(parent)
 | 
			
		||||
CmaBroadcast::CmaBroadcast(QObject *obj_parent) :
 | 
			
		||||
    QObject(obj_parent)
 | 
			
		||||
{
 | 
			
		||||
    QSettings settings;
 | 
			
		||||
    // generate a GUID if doesn't exist yet in settings
 | 
			
		||||
@@ -69,14 +69,14 @@ void CmaBroadcast::readPendingDatagrams()
 | 
			
		||||
        QByteArray datagram;
 | 
			
		||||
        datagram.resize(socket->pendingDatagramSize());
 | 
			
		||||
 | 
			
		||||
        QHostAddress sender;
 | 
			
		||||
        QHostAddress cma_sender;
 | 
			
		||||
        quint16 senderPort;
 | 
			
		||||
 | 
			
		||||
        socket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
 | 
			
		||||
        socket->readDatagram(datagram.data(), datagram.size(), &cma_sender, &senderPort);
 | 
			
		||||
 | 
			
		||||
        if(datagram.startsWith(broadcast_query_start) && datagram.contains(broadcast_query_end)) {
 | 
			
		||||
            QMutexLocker locker(&mutex);
 | 
			
		||||
            socket->writeDatagram(reply, sender, senderPort);
 | 
			
		||||
            socket->writeDatagram(reply, cma_sender, senderPort);
 | 
			
		||||
        } else {
 | 
			
		||||
            qWarning("Unknown request: %.*s\n", datagram.length(), datagram.constData());
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -44,15 +44,15 @@ bool CmaClient::in_progress = false;
 | 
			
		||||
 | 
			
		||||
CmaClient *CmaClient::this_object = NULL;
 | 
			
		||||
 | 
			
		||||
CmaClient::CmaClient(Database *db, QObject *parent) :
 | 
			
		||||
    QObject(parent), m_db(db), m_broadcast(NULL)
 | 
			
		||||
CmaClient::CmaClient(Database *db, QObject *obj_parent) :
 | 
			
		||||
    QObject(obj_parent), m_db(db), m_broadcast(NULL)
 | 
			
		||||
{
 | 
			
		||||
    this_object = this;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CmaClient::CmaClient(Database *db, CmaBroadcast *broadcast, QObject *parent) :
 | 
			
		||||
    QObject(parent), m_db(db), m_broadcast(broadcast)
 | 
			
		||||
CmaClient::CmaClient(Database *db, CmaBroadcast *broadcast, QObject *obj_parent) :
 | 
			
		||||
    QObject(obj_parent), m_db(db), m_broadcast(broadcast)
 | 
			
		||||
{
 | 
			
		||||
    this_object = this;
 | 
			
		||||
}
 | 
			
		||||
@@ -195,46 +195,46 @@ int CmaClient::generatePin(wireless_vita_info_t *info, int *p_err)
 | 
			
		||||
 | 
			
		||||
void CmaClient::enterEventLoop(vita_device_t *device)
 | 
			
		||||
{
 | 
			
		||||
    vita_event_t event;
 | 
			
		||||
    vita_event_t obj_event;
 | 
			
		||||
 | 
			
		||||
    qDebug("Starting event loop");
 | 
			
		||||
 | 
			
		||||
    CmaEvent eventLoop(m_db, device);
 | 
			
		||||
    QThread thread;
 | 
			
		||||
    thread.setObjectName("event_thread");
 | 
			
		||||
    QThread obj_thread;
 | 
			
		||||
    obj_thread.setObjectName("event_thread");
 | 
			
		||||
 | 
			
		||||
    eventLoop.moveToThread(&thread);
 | 
			
		||||
    connect(&thread, SIGNAL(started()), &eventLoop, SLOT(process()));
 | 
			
		||||
    eventLoop.moveToThread(&obj_thread);
 | 
			
		||||
    connect(&obj_thread, SIGNAL(started()), &eventLoop, SLOT(process()));
 | 
			
		||||
    connect(&eventLoop, SIGNAL(refreshDatabase()), this, SIGNAL(refreshDatabase()), Qt::DirectConnection);
 | 
			
		||||
    connect(&eventLoop, SIGNAL(finishedEventLoop()), &thread, SLOT(quit()), Qt::DirectConnection);
 | 
			
		||||
    connect(&eventLoop, SIGNAL(finishedEventLoop()), &obj_thread, SLOT(quit()), Qt::DirectConnection);
 | 
			
		||||
    connect(&eventLoop, SIGNAL(messageSent(QString)), this, SIGNAL(messageSent(QString)), Qt::DirectConnection);
 | 
			
		||||
    thread.start();
 | 
			
		||||
    obj_thread.start();
 | 
			
		||||
 | 
			
		||||
    while(isActive()) {
 | 
			
		||||
        if(VitaMTP_Read_Event(device, &event) < 0) {
 | 
			
		||||
        if(VitaMTP_Read_Event(device, &obj_event) < 0) {
 | 
			
		||||
            qWarning("Error reading event from Vita.");
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // do not create a event for this since there aren't more events to read
 | 
			
		||||
        if(event.Code == PTP_EC_VITA_RequestTerminate) {
 | 
			
		||||
        if(obj_event.Code == PTP_EC_VITA_RequestTerminate) {
 | 
			
		||||
            qDebug("Terminating event thread");
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
            // this one shuold be processed inmediately
 | 
			
		||||
        } else if(event.Code == PTP_EC_VITA_RequestCancelTask) {
 | 
			
		||||
            eventLoop.vitaEventCancelTask(&event, event.Param1);
 | 
			
		||||
            qDebug("Ended event, code: 0x%x, id: %d", event.Code, event.Param1);
 | 
			
		||||
        } else if(obj_event.Code == PTP_EC_VITA_RequestCancelTask) {
 | 
			
		||||
            eventLoop.vitaEventCancelTask(&obj_event, obj_event.Param1);
 | 
			
		||||
            qDebug("Ended event, code: 0x%x, id: %d", obj_event.Code, obj_event.Param1);
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // the events are processed synchronously except for cancel/terminate
 | 
			
		||||
        qDebug("Sending new event");
 | 
			
		||||
        eventLoop.setEvent(event);
 | 
			
		||||
        eventLoop.setEvent(obj_event);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    eventLoop.stop();
 | 
			
		||||
    thread.wait();
 | 
			
		||||
    obj_thread.wait();
 | 
			
		||||
    qDebug("Finishing event loop");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@ class CmaClient : public QObject
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    explicit CmaClient(Database *db, QObject *parent = 0);
 | 
			
		||||
    explicit CmaClient(Database *db, CmaBroadcast *broadcast, QObject *parent = 0);
 | 
			
		||||
    explicit CmaClient(Database *db, QObject *obj_parent = 0);
 | 
			
		||||
    explicit CmaClient(Database *db, CmaBroadcast *broadcast, QObject *obj_parent = 0);
 | 
			
		||||
 | 
			
		||||
    static bool isRunning();
 | 
			
		||||
    void launch();
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										339
									
								
								src/cmaevent.cpp
									
									
									
									
									
								
							
							
						
						
									
										339
									
								
								src/cmaevent.cpp
									
									
									
									
									
								
							@@ -33,7 +33,7 @@ QFile *CmaEvent::m_file = NULL;
 | 
			
		||||
static metadata_t g_thumbmeta = {0, 0, 0, NULL, NULL, 0, 0, 0, Thumbnail, {{17, 240, 136, 0, 1, 1.0f, 2}}, NULL};
 | 
			
		||||
 | 
			
		||||
CmaEvent::CmaEvent(Database *db, vita_device_t *s_device) :
 | 
			
		||||
    device(s_device), m_db(db), is_active(true)
 | 
			
		||||
    m_device(s_device), m_db(db), is_active(true)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -46,9 +46,9 @@ void CmaEvent::process()
 | 
			
		||||
        if(!isActive()) {
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
        mutex.lock();
 | 
			
		||||
 | 
			
		||||
        QMutexLocker locker(&mutex);
 | 
			
		||||
        processEvent();
 | 
			
		||||
        mutex.unlock();
 | 
			
		||||
    }
 | 
			
		||||
    qDebug("Finishing event_thread");
 | 
			
		||||
    emit finishedEventLoop();
 | 
			
		||||
@@ -70,81 +70,81 @@ void CmaEvent::stop()
 | 
			
		||||
void CmaEvent::setDevice(vita_device_t *device)
 | 
			
		||||
{
 | 
			
		||||
    QMutexLocker locker(&mutex);
 | 
			
		||||
    this->device = device;
 | 
			
		||||
    m_device = device;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::setEvent(vita_event_t event)
 | 
			
		||||
void CmaEvent::setEvent(vita_event_t cma_event)
 | 
			
		||||
{
 | 
			
		||||
    mutex.lock();
 | 
			
		||||
    this->t_event = event;
 | 
			
		||||
    mutex.unlock();
 | 
			
		||||
    QMutexLocker locker(&mutex);
 | 
			
		||||
    m_event = cma_event;
 | 
			
		||||
    locker.unlock();
 | 
			
		||||
    sema.release();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::processEvent()
 | 
			
		||||
{
 | 
			
		||||
    switch(t_event.Code) {
 | 
			
		||||
    switch(m_event.Code) {
 | 
			
		||||
    case PTP_EC_VITA_RequestSendNumOfObject:
 | 
			
		||||
        vitaEventSendNumOfObject(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventSendNumOfObject(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestSendObjectMetadata:
 | 
			
		||||
        vitaEventSendObjectMetadata(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventSendObjectMetadata(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestSendObject:
 | 
			
		||||
        vitaEventSendObject(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventSendObject(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestSendHttpObjectFromURL:
 | 
			
		||||
        vitaEventSendHttpObjectFromURL(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventSendHttpObjectFromURL(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_Unknown1: // unimplemented
 | 
			
		||||
        vitaEventUnimplementated(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventUnimplementated(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestSendObjectStatus:
 | 
			
		||||
        vitaEventSendObjectStatus(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventSendObjectStatus(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestSendObjectThumb:
 | 
			
		||||
        vitaEventSendObjectThumb(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventSendObjectThumb(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestDeleteObject:
 | 
			
		||||
        vitaEventDeleteObject(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventDeleteObject(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestGetSettingInfo:
 | 
			
		||||
        vitaEventGetSettingInfo(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventGetSettingInfo(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestSendHttpObjectPropFromURL:
 | 
			
		||||
        vitaEventSendHttpObjectPropFromURL(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventSendHttpObjectPropFromURL(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestSendPartOfObject:
 | 
			
		||||
        vitaEventSendPartOfObject(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventSendPartOfObject(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestOperateObject:
 | 
			
		||||
        vitaEventOperateObject(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventOperateObject(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestGetPartOfObject:
 | 
			
		||||
        vitaEventGetPartOfObject(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventGetPartOfObject(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestSendStorageSize:
 | 
			
		||||
        vitaEventSendStorageSize(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventSendStorageSize(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestCheckExistance:
 | 
			
		||||
        vitaEventCheckExistance(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventCheckExistance(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestGetTreatObject:
 | 
			
		||||
        vitaEventGetTreatObject(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventGetTreatObject(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestSendCopyConfirmationInfo:
 | 
			
		||||
        vitaEventSendCopyConfirmationInfo(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventSendCopyConfirmationInfo(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestSendObjectMetadataItems:
 | 
			
		||||
        vitaEventSendObjectMetadataItems(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventSendObjectMetadataItems(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    case PTP_EC_VITA_RequestSendNPAccountInfo:
 | 
			
		||||
        vitaEventSendNPAccountInfo(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventSendNPAccountInfo(&m_event, m_event.Param1);
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        vitaEventUnimplementated(&t_event, t_event.Param1);
 | 
			
		||||
        vitaEventUnimplementated(&m_event, m_event.Param1);
 | 
			
		||||
    }
 | 
			
		||||
    qDebug("Ended event, code: 0x%x, id: %d", t_event.Code, t_event.Param1);
 | 
			
		||||
    qDebug("Ended event, code: 0x%x, id: %d", m_event.Code, m_event.Param1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
quint16 CmaEvent::processAllObjects(metadata_t &parent_metadata, quint32 handle)
 | 
			
		||||
@@ -156,13 +156,13 @@ quint16 CmaEvent::processAllObjects(metadata_t &parent_metadata, quint32 handle)
 | 
			
		||||
    quint32 *p_handles;
 | 
			
		||||
    unsigned int p_len;
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_GetObject_Info(device, handle, &name, &dataType) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_GetObject_Info(m_device, handle, &name, &dataType) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Cannot get object for handle %d", handle);
 | 
			
		||||
        return PTP_RC_VITA_Invalid_Data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(dataType & Folder) {
 | 
			
		||||
        if(VitaMTP_GetObject_Folder(device, handle, &p_handles, &p_len) != PTP_RC_OK) {
 | 
			
		||||
        if(VitaMTP_GetObject_Folder(m_device, handle, &p_handles, &p_len) != PTP_RC_OK) {
 | 
			
		||||
            qWarning("Cannot get folder handles for handle %d", handle);
 | 
			
		||||
            return PTP_RC_VITA_Invalid_Data;
 | 
			
		||||
        }
 | 
			
		||||
@@ -200,7 +200,7 @@ quint16 CmaEvent::processAllObjects(metadata_t &parent_metadata, quint32 handle)
 | 
			
		||||
            // the size gets ignored because we can also get it via info.size()
 | 
			
		||||
            uint64_t size;
 | 
			
		||||
 | 
			
		||||
            VitaMTP_GetObject_Callback(device, handle, &size, CmaEvent::writeCallback);
 | 
			
		||||
            VitaMTP_GetObject_Callback(m_device, handle, &size, CmaEvent::writeCallback);
 | 
			
		||||
            m_file->close();
 | 
			
		||||
            delete m_file;
 | 
			
		||||
        }
 | 
			
		||||
@@ -229,13 +229,13 @@ quint16 CmaEvent::processAllObjects(metadata_t &parent_metadata, quint32 handle)
 | 
			
		||||
    return PTP_RC_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventGetTreatObject(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventGetTreatObject(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    treat_object_t treatObject;
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_GetTreatObject(device, eventId, &treatObject) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_GetTreatObject(m_device, eventId, &treatObject) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Cannot get information on object to get");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -246,19 +246,19 @@ void CmaEvent::vitaEventGetTreatObject(vita_event_t *event, int eventId)
 | 
			
		||||
 | 
			
		||||
    if(!m_db->getObjectMetadata(treatObject.ohfiParent, metadata)) {
 | 
			
		||||
        qWarning("Cannot find parent OHFI %d", treatObject.ohfiParent);
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    VitaMTP_ReportResult(device, eventId, processAllObjects(metadata, treatObject.handle));
 | 
			
		||||
    VitaMTP_ReportResult(m_device, eventId, processAllObjects(metadata, treatObject.handle));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventSendCopyConfirmationInfo(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventSendCopyConfirmationInfo(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    copy_confirmation_info_t *info;
 | 
			
		||||
    if(VitaMTP_SendCopyConfirmationInfoInit(device, eventId, &info) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_SendCopyConfirmationInfoInit(m_device, eventId, &info) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Error recieving initial information.");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -269,33 +269,33 @@ void CmaEvent::vitaEventSendCopyConfirmationInfo(vita_event_t *event, int eventI
 | 
			
		||||
 | 
			
		||||
    // check if the item is a single folder
 | 
			
		||||
    if(info->count == 1) {
 | 
			
		||||
        metadata_t meta;
 | 
			
		||||
        if(m_db->getObjectMetadata(info->ohfi[0], meta)) {
 | 
			
		||||
        metadata_t obj_meta;
 | 
			
		||||
        if(m_db->getObjectMetadata(info->ohfi[0], obj_meta)) {
 | 
			
		||||
            // got a folder
 | 
			
		||||
            if(meta.dataType & Folder) {
 | 
			
		||||
            if(obj_meta.dataType & Folder) {
 | 
			
		||||
                metadata_t *meta_list = NULL;
 | 
			
		||||
                if(m_db->getObjectList(info->ohfi[0], &meta_list)) {
 | 
			
		||||
                    int count = 0;
 | 
			
		||||
                    metadata_t *meta = meta_list;
 | 
			
		||||
                    metadata_t *single_meta = meta_list;
 | 
			
		||||
                    // count files
 | 
			
		||||
                    while(meta) {
 | 
			
		||||
                        if(meta->dataType & File) {
 | 
			
		||||
                    while(single_meta) {
 | 
			
		||||
                        if(single_meta->dataType & File) {
 | 
			
		||||
                            count++;
 | 
			
		||||
                        }
 | 
			
		||||
                        meta = meta->next_metadata;
 | 
			
		||||
                        single_meta = single_meta->next_metadata;
 | 
			
		||||
                    }
 | 
			
		||||
                    // create struct to hold all the file identifiers
 | 
			
		||||
                    info = (copy_confirmation_info_t *)malloc(sizeof(uint32_t) * count + sizeof(copy_confirmation_info_t));
 | 
			
		||||
                    meta = meta_list;
 | 
			
		||||
                    single_meta = meta_list;
 | 
			
		||||
                    info->count = 0;
 | 
			
		||||
                    // copy all the file ohfi
 | 
			
		||||
                    while(meta) {
 | 
			
		||||
                        if(meta->dataType & File) {
 | 
			
		||||
                            info->ohfi[info->count] = meta->ohfi;
 | 
			
		||||
                            total_size += meta->size;
 | 
			
		||||
                    while(single_meta) {
 | 
			
		||||
                        if(single_meta->dataType & File) {
 | 
			
		||||
                            info->ohfi[info->count] = single_meta->ohfi;
 | 
			
		||||
                            total_size += single_meta->size;
 | 
			
		||||
                            info->count++;
 | 
			
		||||
                        }
 | 
			
		||||
                        meta = meta->next_metadata;
 | 
			
		||||
                        single_meta = single_meta->next_metadata;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
@@ -316,21 +316,21 @@ void CmaEvent::vitaEventSendCopyConfirmationInfo(vita_event_t *event, int eventI
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_SendCopyConfirmationInfo(device, eventId, info, total_size) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_SendCopyConfirmationInfo(m_device, eventId, info, total_size) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Error sending copy confirmation");
 | 
			
		||||
    } else {
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    free(info);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventSendObjectMetadataItems(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventSendObjectMetadataItems(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    quint32 ohfi;
 | 
			
		||||
    if(VitaMTP_SendObjectMetadataItems(device, eventId, &ohfi) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_SendObjectMetadataItems(m_device, eventId, &ohfi) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Cannot get OHFI for retreving metadata");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -341,76 +341,75 @@ void CmaEvent::vitaEventSendObjectMetadataItems(vita_event_t *event, int eventId
 | 
			
		||||
 | 
			
		||||
    if(!m_db->getObjectMetadata(ohfi, metadata)) {
 | 
			
		||||
        qWarning("Cannot find OHFI %d in database", ohfi);
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    metadata.next_metadata = NULL;
 | 
			
		||||
    qDebug("Sending metadata for OHFI %d (%s)", ohfi, metadata.path);
 | 
			
		||||
 | 
			
		||||
    quint16 ret = VitaMTP_SendObjectMetadata(device, eventId, &metadata);
 | 
			
		||||
    quint16 ret = VitaMTP_SendObjectMetadata(m_device, eventId, &metadata);
 | 
			
		||||
    if(ret != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Error sending metadata. Code: %04X", ret);
 | 
			
		||||
    } else {
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventSendNPAccountInfo(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventSendNPAccountInfo(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
    // AFAIK, Sony hasn't even implemented this in their CMA
 | 
			
		||||
    qWarning("Event 0x%x unimplemented!", event->Code);
 | 
			
		||||
    qWarning("Event 0x%x unimplemented!", cma_event->Code);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventUnimplementated(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventUnimplementated(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qWarning("Unknown event not handled, code: 0x%x, id: %d", event->Code, eventId);
 | 
			
		||||
    qWarning("Param1: 0x%08X, Param2: 0x%08X, Param3: 0x%08X", event->Param1, event->Param2, event->Param3);
 | 
			
		||||
    qWarning("Unknown event not handled, code: 0x%x, id: %d", cma_event->Code, eventId);
 | 
			
		||||
    qWarning("Param1: 0x%08X, Param2: 0x%08X, Param3: 0x%08X", cma_event->Param1, cma_event->Param2, cma_event->Param3);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventCancelTask(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventCancelTask(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    quint32 eventIdToCancel = event->Param2;
 | 
			
		||||
    quint32 eventIdToCancel = cma_event->Param2;
 | 
			
		||||
    qDebug("Cancelling event %d", eventIdToCancel);
 | 
			
		||||
    quint16 ret = VitaMTP_CancelTask(device, eventIdToCancel);
 | 
			
		||||
    quint16 ret = VitaMTP_CancelTask(m_device, eventIdToCancel);
 | 
			
		||||
 | 
			
		||||
    // wait until the current event finishes so we can report the result to the device
 | 
			
		||||
 | 
			
		||||
    qDebug("Waiting for send event to finish");
 | 
			
		||||
    mutex.lock();
 | 
			
		||||
    QMutexLocker locker(&mutex);
 | 
			
		||||
    if(ret == PTP_RC_OK) {
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
    }
 | 
			
		||||
    mutex.unlock();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventSendNumOfObject(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventSendNumOfObject(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    QMutexLocker locker(&m_db->mutex);
 | 
			
		||||
 | 
			
		||||
    int ohfi = event->Param2;
 | 
			
		||||
    int ohfi = cma_event->Param2;
 | 
			
		||||
    int items = m_db->childObjectCount(ohfi);
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_SendNumOfObject(device, eventId, items) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_SendNumOfObject(m_device, eventId, items) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Error occured receiving object count for OHFI parent %d", ohfi);
 | 
			
		||||
    } else {
 | 
			
		||||
        qDebug("Returned count of %d objects for OHFI parent %d", items, ohfi);
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventSendObjectMetadata(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventSendObjectMetadata(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    browse_info_t browse;
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_GetBrowseInfo(device, eventId, &browse) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_GetBrowseInfo(m_device, eventId, &browse) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("GetBrowseInfo failed");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -421,19 +420,19 @@ void CmaEvent::vitaEventSendObjectMetadata(vita_event_t *event, int eventId)
 | 
			
		||||
    int count = m_db->getObjectMetadatas(browse.ohfiParent, &meta, browse.index, browse.numObjects); // if meta is null, will return empty XML
 | 
			
		||||
    qDebug("Sending %i metadata filtered objects for OHFI %d", count, browse.ohfiParent);
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_SendObjectMetadata(device, eventId, meta) != PTP_RC_OK) {  // send all objects with OHFI parent
 | 
			
		||||
    if(VitaMTP_SendObjectMetadata(m_device, eventId, meta) != PTP_RC_OK) {  // send all objects with OHFI parent
 | 
			
		||||
        qWarning("Sending metadata for OHFI parent %d failed", browse.ohfiParent);
 | 
			
		||||
    } else {
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
    }
 | 
			
		||||
    m_db->freeMetadata(meta);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventSendObject(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventSendObject(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    int ohfi = event->Param2;
 | 
			
		||||
    int ohfi = cma_event->Param2;
 | 
			
		||||
 | 
			
		||||
    QMutexLocker locker(&m_db->mutex);
 | 
			
		||||
 | 
			
		||||
@@ -442,12 +441,12 @@ void CmaEvent::vitaEventSendObject(vita_event_t *event, int eventId)
 | 
			
		||||
    metadata_t *metadata = NULL;
 | 
			
		||||
    if(!m_db->getObjectList(ohfi, &metadata)) {
 | 
			
		||||
        qWarning("Failed to find OHFI %d", ohfi);
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    metadata_t *start = metadata;
 | 
			
		||||
    quint32 parentHandle = event->Param3;
 | 
			
		||||
    quint32 parentHandle = cma_event->Param3;
 | 
			
		||||
    bool send_folder = metadata->dataType & Folder;
 | 
			
		||||
    quint32 handle;
 | 
			
		||||
 | 
			
		||||
@@ -461,7 +460,7 @@ void CmaEvent::vitaEventSendObject(vita_event_t *event, int eventId)
 | 
			
		||||
            if(!m_file->open(QIODevice::ReadOnly)) {
 | 
			
		||||
                qWarning() << "Failed to read" << m_file->fileName();
 | 
			
		||||
                delete m_file;
 | 
			
		||||
                VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Not_Exist_Object);
 | 
			
		||||
                VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Not_Exist_Object);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -481,11 +480,11 @@ void CmaEvent::vitaEventSendObject(vita_event_t *event, int eventId)
 | 
			
		||||
        qDebug("OHFI %d with handle 0x%08X", metadata->ohfi, parentHandle);
 | 
			
		||||
 | 
			
		||||
        VitaMTP_RegisterCancelEventId(eventId);
 | 
			
		||||
        quint16 ret = VitaMTP_SendObject_Callback(device, &parentHandle, &handle, metadata, &CmaEvent::readCallback);
 | 
			
		||||
        quint16 ret = VitaMTP_SendObject_Callback(m_device, &parentHandle, &handle, metadata, &CmaEvent::readCallback);
 | 
			
		||||
        if(ret != PTP_RC_OK) {
 | 
			
		||||
            qWarning("Sending of %s failed. Code: %04X", metadata->name, ret);
 | 
			
		||||
            if(ret == PTP_ERROR_CANCEL) {
 | 
			
		||||
                VitaMTP_ReportResult(device, eventId, PTP_RC_GeneralError);
 | 
			
		||||
                VitaMTP_ReportResult(m_device, eventId, PTP_RC_GeneralError);
 | 
			
		||||
            }
 | 
			
		||||
            m_file->close();
 | 
			
		||||
            delete m_file;
 | 
			
		||||
@@ -510,17 +509,17 @@ void CmaEvent::vitaEventSendObject(vita_event_t *event, int eventId)
 | 
			
		||||
 | 
			
		||||
    m_db->freeMetadata(start);
 | 
			
		||||
 | 
			
		||||
    VitaMTP_ReportResultWithParam(device, eventId, PTP_RC_OK, handle);
 | 
			
		||||
    VitaMTP_ReportResultWithParam(m_device, eventId, PTP_RC_OK, handle);
 | 
			
		||||
 | 
			
		||||
    VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_Data);  // TODO: Send thumbnail
 | 
			
		||||
    VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_Data);  // TODO: Send thumbnail
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventSendHttpObjectFromURL(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventSendHttpObjectFromURL(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    char *url;
 | 
			
		||||
    if(VitaMTP_GetUrl(device, eventId, &url) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_GetUrl(m_device, eventId, &url) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Failed to recieve URL");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -558,15 +557,15 @@ void CmaEvent::vitaEventSendHttpObjectFromURL(vita_event_t *event, int eventId)
 | 
			
		||||
                remote_size += 8;
 | 
			
		||||
                qDebug("Sending %i bytes of data for HTTP request %s", remote_size, url);
 | 
			
		||||
 | 
			
		||||
                if(VitaMTP_SendData_Callback(device, eventId, PTP_OC_VITA_SendHttpObjectFromURL, remote_size, HTTPDownloader::readCallback) != PTP_RC_OK) {
 | 
			
		||||
                if(VitaMTP_SendData_Callback(m_device, eventId, PTP_OC_VITA_SendHttpObjectFromURL, remote_size, HTTPDownloader::readCallback) != PTP_RC_OK) {
 | 
			
		||||
                    qWarning("Failed to send HTTP object");
 | 
			
		||||
                } else {
 | 
			
		||||
                    VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
                    VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            } else {
 | 
			
		||||
                qWarning("No valid content-length in header, aborting");
 | 
			
		||||
                VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Failed_Download);
 | 
			
		||||
                VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Failed_Download);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            free(url);
 | 
			
		||||
@@ -581,22 +580,22 @@ void CmaEvent::vitaEventSendHttpObjectFromURL(vita_event_t *event, int eventId)
 | 
			
		||||
 | 
			
		||||
    qDebug("Sending %i bytes of data for HTTP request %s", data.size(), url);
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_SendHttpObjectFromURL(device, eventId, data.data(), data.size()) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_SendHttpObjectFromURL(m_device, eventId, data.data(), data.size()) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Failed to send HTTP object");
 | 
			
		||||
    } else {
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    free(url);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventSendObjectStatus(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventSendObjectStatus(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    object_status_t objectstatus;
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_SendObjectStatus(device, eventId, &objectstatus) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_SendObjectStatus(m_device, eventId, &objectstatus) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Failed to get information for object status.");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -608,35 +607,35 @@ void CmaEvent::vitaEventSendObjectStatus(vita_event_t *event, int eventId)
 | 
			
		||||
 | 
			
		||||
    if(ohfi == 0) { // not in database, don't return metadata
 | 
			
		||||
        qDebug("Object %s not in database (OHFI: %i). Sending OK response for non-existence", objectstatus.title, objectstatus.ohfiRoot);
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
    } else {
 | 
			
		||||
        metadata_t metadata = metadata_t();
 | 
			
		||||
        m_db->getObjectMetadata(ohfi, metadata);
 | 
			
		||||
        metadata.next_metadata = NULL;
 | 
			
		||||
        qDebug("Sending metadata for OHFI %d", ohfi);
 | 
			
		||||
 | 
			
		||||
        if(VitaMTP_SendObjectMetadata(device, eventId, &metadata) != PTP_RC_OK) {
 | 
			
		||||
        if(VitaMTP_SendObjectMetadata(m_device, eventId, &metadata) != PTP_RC_OK) {
 | 
			
		||||
            qWarning("Error sending metadata for %d", ohfi);
 | 
			
		||||
        } else {
 | 
			
		||||
            VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
            VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    free(objectstatus.title);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventSendObjectThumb(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventSendObjectThumb(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    QMutexLocker locker(&m_db->mutex);
 | 
			
		||||
 | 
			
		||||
    int ohfi = event->Param2;
 | 
			
		||||
    int ohfi = cma_event->Param2;
 | 
			
		||||
    metadata_t metadata;
 | 
			
		||||
 | 
			
		||||
    if(!m_db->getObjectMetadata(ohfi, metadata)) {
 | 
			
		||||
        qWarning("Cannot find OHFI %d in database.", ohfi);
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -645,7 +644,7 @@ void CmaEvent::vitaEventSendObjectThumb(vita_event_t *event, int eventId)
 | 
			
		||||
 | 
			
		||||
    if(data.size() == 0) {
 | 
			
		||||
        qWarning() << "Cannot find/read thumbnail for" << fullpath;
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_Data);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_Data);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -655,10 +654,10 @@ void CmaEvent::vitaEventSendObjectThumb(vita_event_t *event, int eventId)
 | 
			
		||||
    char *locale = strdup(setlocale(LC_ALL, NULL));
 | 
			
		||||
    setlocale(LC_ALL, "C");
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_SendObjectThumb(device, eventId, (metadata_t *)&g_thumbmeta, (uchar *)data.data(), data.size()) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_SendObjectThumb(m_device, eventId, (metadata_t *)&g_thumbmeta, (uchar *)data.data(), data.size()) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Error sending thumbnail");
 | 
			
		||||
    } else {
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // restore locale
 | 
			
		||||
@@ -666,18 +665,18 @@ void CmaEvent::vitaEventSendObjectThumb(vita_event_t *event, int eventId)
 | 
			
		||||
    free(locale);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventDeleteObject(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventDeleteObject(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    QMutexLocker locker(&m_db->mutex);
 | 
			
		||||
 | 
			
		||||
    int ohfi = event->Param2;
 | 
			
		||||
    int ohfi = cma_event->Param2;
 | 
			
		||||
    metadata_t metadata;
 | 
			
		||||
 | 
			
		||||
    if(!m_db->getObjectMetadata(ohfi, metadata)) {
 | 
			
		||||
        qWarning("OHFI %d not found", ohfi);
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -686,15 +685,15 @@ void CmaEvent::vitaEventDeleteObject(vita_event_t *event, int eventId)
 | 
			
		||||
    removeRecursively(fullpath);
 | 
			
		||||
    m_db->deleteEntry(ohfi);
 | 
			
		||||
 | 
			
		||||
    VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
    VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventGetSettingInfo(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventGetSettingInfo(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    settings_info_t *settingsinfo;
 | 
			
		||||
    if(VitaMTP_GetSettingInfo(device, eventId, &settingsinfo) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_GetSettingInfo(m_device, eventId, &settingsinfo) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Failed to get setting info from Vita.");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -711,15 +710,15 @@ void CmaEvent::vitaEventGetSettingInfo(vita_event_t *event, int eventId)
 | 
			
		||||
 | 
			
		||||
    // free all the information
 | 
			
		||||
    VitaMTP_Data_Free_Settings(settingsinfo);
 | 
			
		||||
    VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
    VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventSendHttpObjectPropFromURL(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventSendHttpObjectPropFromURL(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    char *url;
 | 
			
		||||
    if(VitaMTP_GetUrl(device, eventId, &url) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_GetUrl(m_device, eventId, &url) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Failed to get URL");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -730,7 +729,7 @@ void CmaEvent::vitaEventSendHttpObjectPropFromURL(vita_event_t *event, int event
 | 
			
		||||
 | 
			
		||||
    if(!file.exists()) {
 | 
			
		||||
        qWarning("The file %s is not accesible", url);
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Failed_Download);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Failed_Download);
 | 
			
		||||
        free(url);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -741,22 +740,22 @@ void CmaEvent::vitaEventSendHttpObjectPropFromURL(vita_event_t *event, int event
 | 
			
		||||
    httpobjectprop.timestamp = timestamp.toUtf8().data();
 | 
			
		||||
    httpobjectprop.timestamp_len = timestamp.toUtf8().size();
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_SendHttpObjectPropFromURL(device, eventId, &httpobjectprop) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_SendHttpObjectPropFromURL(m_device, eventId, &httpobjectprop) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Failed to send object properties");
 | 
			
		||||
    } else {
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    free(url);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventSendPartOfObject(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventSendPartOfObject(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    send_part_init_t part_init;
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_SendPartOfObjectInit(device, eventId, &part_init) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_SendPartOfObjectInit(m_device, eventId, &part_init) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Cannot get information on object to send");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -767,7 +766,7 @@ void CmaEvent::vitaEventSendPartOfObject(vita_event_t *event, int eventId)
 | 
			
		||||
 | 
			
		||||
    if(fullpath.isNull()) {
 | 
			
		||||
        qWarning("Cannot find object for OHFI %d", part_init.ohfi);
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_Context);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_Context);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -775,7 +774,7 @@ void CmaEvent::vitaEventSendPartOfObject(vita_event_t *event, int eventId)
 | 
			
		||||
 | 
			
		||||
    if(!file.open(QIODevice::ReadOnly)) {
 | 
			
		||||
        qWarning() << "Cannot read" << fullpath;
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Not_Exist_Object);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Not_Exist_Object);
 | 
			
		||||
        return;
 | 
			
		||||
    } else {
 | 
			
		||||
        file.seek(part_init.offset);
 | 
			
		||||
@@ -784,21 +783,21 @@ void CmaEvent::vitaEventSendPartOfObject(vita_event_t *event, int eventId)
 | 
			
		||||
                     fullpath, QString::number(part_init.offset), QString::number(part_init.size)
 | 
			
		||||
                 );
 | 
			
		||||
 | 
			
		||||
        if(VitaMTP_SendPartOfObject(device, eventId, (unsigned char *)data.data(), data.size()) != PTP_RC_OK) {
 | 
			
		||||
        if(VitaMTP_SendPartOfObject(m_device, eventId, (unsigned char *)data.data(), data.size()) != PTP_RC_OK) {
 | 
			
		||||
            qWarning("Failed to send part of object OHFI %d", part_init.ohfi);
 | 
			
		||||
        } else {
 | 
			
		||||
            VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
            VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventOperateObject(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventOperateObject(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    operate_object_t operateobject;
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_OperateObject(device, eventId, &operateobject) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_OperateObject(m_device, eventId, &operateobject) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Cannot get information on object to operate");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -809,7 +808,7 @@ void CmaEvent::vitaEventOperateObject(vita_event_t *event, int eventId)
 | 
			
		||||
 | 
			
		||||
    // end for renaming only
 | 
			
		||||
    if(fullpath.isNull()) {
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Not_Exist_Object);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Not_Exist_Object);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -820,11 +819,11 @@ void CmaEvent::vitaEventOperateObject(vita_event_t *event, int eventId)
 | 
			
		||||
        QDir dir(fullpath);
 | 
			
		||||
        if(!dir.mkdir(operateobject.title)) {
 | 
			
		||||
            qWarning("Unable to create temporary folder: %s", operateobject.title);
 | 
			
		||||
            VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Failed_Operate_Object);
 | 
			
		||||
            VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Failed_Operate_Object);
 | 
			
		||||
        } else {
 | 
			
		||||
            int new_ohfi = m_db->insertObjectEntry(fullpath, operateobject.title, operateobject.ohfi);
 | 
			
		||||
            qDebug("Created folder %s with OHFI %d", operateobject.title, new_ohfi);
 | 
			
		||||
            VitaMTP_ReportResultWithParam(device, eventId, PTP_RC_OK, new_ohfi);
 | 
			
		||||
            VitaMTP_ReportResultWithParam(m_device, eventId, PTP_RC_OK, new_ohfi);
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
@@ -834,11 +833,11 @@ void CmaEvent::vitaEventOperateObject(vita_event_t *event, int eventId)
 | 
			
		||||
        QFile file(fullpath + QDir::separator() + operateobject.title);
 | 
			
		||||
        if(!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
 | 
			
		||||
            qWarning("Unable to create temporary file: %s", operateobject.title);
 | 
			
		||||
            VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Failed_Operate_Object);
 | 
			
		||||
            VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Failed_Operate_Object);
 | 
			
		||||
        } else {
 | 
			
		||||
            int new_ohfi = m_db->insertObjectEntry(fullpath, operateobject.title, operateobject.ohfi);
 | 
			
		||||
            //qDebug("Created file %s with OHFI %d under parent %s", newobj->metadata.path, new_ohfi, root->metadata.path);
 | 
			
		||||
            VitaMTP_ReportResultWithParam(device, eventId, PTP_RC_OK, new_ohfi);
 | 
			
		||||
            VitaMTP_ReportResultWithParam(m_device, eventId, PTP_RC_OK, new_ohfi);
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
@@ -851,32 +850,32 @@ void CmaEvent::vitaEventOperateObject(vita_event_t *event, int eventId)
 | 
			
		||||
        // rename in filesystem
 | 
			
		||||
        if(!QFile(fullpath).rename(newpath)) {
 | 
			
		||||
            qWarning("Unable to rename %s to %s", fullpath.toLocal8Bit().constData(), operateobject.title);
 | 
			
		||||
            VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Failed_Operate_Object);
 | 
			
		||||
            VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Failed_Operate_Object);
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        qDebug("Renamed OHFI %d from %s to %s", operateobject.ohfi, fullpath.toLocal8Bit().constData(), newpath.toLocal8Bit().constData());
 | 
			
		||||
        VitaMTP_ReportResultWithParam(device, eventId, PTP_RC_OK, operateobject.ohfi);
 | 
			
		||||
        VitaMTP_ReportResultWithParam(m_device, eventId, PTP_RC_OK, operateobject.ohfi);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
        qWarning("Operate command %d: Not implemented", operateobject.cmd);
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Failed_Operate_Object);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Failed_Operate_Object);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    free(operateobject.title);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventGetPartOfObject(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventGetPartOfObject(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    unsigned char *data;
 | 
			
		||||
    send_part_init_t part_init;
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_GetPartOfObject(device, eventId, &part_init, &data) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_GetPartOfObject(m_device, eventId, &part_init, &data) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Cannot get object from device");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -886,7 +885,7 @@ void CmaEvent::vitaEventGetPartOfObject(vita_event_t *event, int eventId)
 | 
			
		||||
 | 
			
		||||
    if(fullpath.isNull()) {
 | 
			
		||||
        qWarning("Cannot find OHFI %d", part_init.ohfi);
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        free(data);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -898,7 +897,7 @@ void CmaEvent::vitaEventGetPartOfObject(vita_event_t *event, int eventId)
 | 
			
		||||
    QFile file(fullpath);
 | 
			
		||||
    if(!file.open(QIODevice::ReadWrite)) {
 | 
			
		||||
        qWarning() << "Cannot write to file" << fullpath;
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_Permission);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_Permission);
 | 
			
		||||
    } else {
 | 
			
		||||
        file.seek(part_init.offset);
 | 
			
		||||
        file.write((const char *)data, part_init.size);
 | 
			
		||||
@@ -908,24 +907,24 @@ void CmaEvent::vitaEventGetPartOfObject(vita_event_t *event, int eventId)
 | 
			
		||||
                     QString::number(part_init.size), fullpath, QString::number(part_init.offset)
 | 
			
		||||
                 );
 | 
			
		||||
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    free(data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventSendStorageSize(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventSendStorageSize(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    QMutexLocker locker(&m_db->mutex);
 | 
			
		||||
 | 
			
		||||
    int ohfi = event->Param2;
 | 
			
		||||
    int ohfi = cma_event->Param2;
 | 
			
		||||
    QString fullpath = m_db->getAbsolutePath(ohfi);
 | 
			
		||||
 | 
			
		||||
    if(fullpath.isNull()) {
 | 
			
		||||
        qWarning("Error: Cannot find OHFI %d", ohfi);
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_OHFI);
 | 
			
		||||
        return;
 | 
			
		||||
    } else {
 | 
			
		||||
        QFile file(fullpath);
 | 
			
		||||
@@ -936,7 +935,7 @@ void CmaEvent::vitaEventSendStorageSize(vita_event_t *event, int eventId)
 | 
			
		||||
 | 
			
		||||
            if(!QDir(QDir::root()).mkpath(QDir(fullpath).absolutePath())) {
 | 
			
		||||
                qWarning("Create directory failed");
 | 
			
		||||
                VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_Permission);
 | 
			
		||||
                VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_Permission);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -947,27 +946,27 @@ void CmaEvent::vitaEventSendStorageSize(vita_event_t *event, int eventId)
 | 
			
		||||
 | 
			
		||||
    if(!getDiskSpace(fullpath, &free, &total)) {
 | 
			
		||||
        qWarning("Cannot get disk space");
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Invalid_Permission);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Invalid_Permission);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    qDebug("Storage stats for drive containing OHFI %d, free: %llu, total: %llu", ohfi, free, total);
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_SendStorageSize(device, eventId, total, free) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_SendStorageSize(m_device, eventId, total, free) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Send storage size failed");
 | 
			
		||||
    } else {
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaEvent::vitaEventCheckExistance(vita_event_t *event, int eventId)
 | 
			
		||||
void CmaEvent::vitaEventCheckExistance(vita_event_t *cma_event, int eventId)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, event->Code, eventId);
 | 
			
		||||
    qDebug("Event recieved in %s, code: 0x%x, id: %d", Q_FUNC_INFO, cma_event->Code, eventId);
 | 
			
		||||
 | 
			
		||||
    int handle = event->Param2;
 | 
			
		||||
    int handle = cma_event->Param2;
 | 
			
		||||
    existance_object_t existance;
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_CheckExistance(device, handle, &existance) != PTP_RC_OK) {
 | 
			
		||||
    if(VitaMTP_CheckExistance(m_device, handle, &existance) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Cannot read information on object to be sent");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -977,12 +976,12 @@ void CmaEvent::vitaEventCheckExistance(vita_event_t *event, int eventId)
 | 
			
		||||
    int ohfi = m_db->getPathId(existance.name, 0);
 | 
			
		||||
 | 
			
		||||
    if(ohfi == 0) {
 | 
			
		||||
        VitaMTP_ReportResult(device, eventId, PTP_RC_VITA_Different_Object);
 | 
			
		||||
        VitaMTP_ReportResult(m_device, eventId, PTP_RC_VITA_Different_Object);
 | 
			
		||||
    } else {
 | 
			
		||||
        VitaMTP_ReportResultWithParam(device, eventId, PTP_RC_VITA_Same_Object, ohfi);
 | 
			
		||||
        VitaMTP_ReportResultWithParam(m_device, eventId, PTP_RC_VITA_Same_Object, ohfi);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    VitaMTP_ReportResult(device, eventId, PTP_RC_OK);
 | 
			
		||||
    VitaMTP_ReportResult(m_device, eventId, PTP_RC_OK);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int CmaEvent::readCallback(unsigned char *data, unsigned long wantlen, unsigned long *gotlen)
 | 
			
		||||
 
 | 
			
		||||
@@ -64,10 +64,10 @@ private:
 | 
			
		||||
 | 
			
		||||
    void processEvent();
 | 
			
		||||
    bool isActive();
 | 
			
		||||
    void setDevice(vita_device_t *device);
 | 
			
		||||
    void setDevice(vita_device_t *m_device);
 | 
			
		||||
 | 
			
		||||
    vita_device_t *device;
 | 
			
		||||
    vita_event_t t_event;
 | 
			
		||||
    vita_device_t *m_device;
 | 
			
		||||
    vita_event_t m_event;
 | 
			
		||||
 | 
			
		||||
    Database *m_db;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -109,7 +109,7 @@ void CMAObject::loadSfoMetadata(const QString &path)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CMAObject::initObject(const QFileInfo &file, int file_type)
 | 
			
		||||
void CMAObject::initObject(const QFileInfo &file, int obj_file_type)
 | 
			
		||||
{
 | 
			
		||||
    metadata.name = strdup(file.fileName().toUtf8().data());
 | 
			
		||||
    metadata.ohfiParent = parent->metadata.ohfi;
 | 
			
		||||
@@ -128,18 +128,18 @@ void CMAObject::initObject(const QFileInfo &file, int file_type)
 | 
			
		||||
        loadSfoMetadata(file.absoluteFilePath());
 | 
			
		||||
    } else if(MASK_SET(metadata.dataType, Music | File)) {
 | 
			
		||||
 | 
			
		||||
        if(file_type < 0) {
 | 
			
		||||
            qWarning("Invalid file type for music: %i, setting it to zero", file_type);
 | 
			
		||||
            file_type = 0;
 | 
			
		||||
        if(obj_file_type < 0) {
 | 
			
		||||
            qWarning("Invalid file type for music: %i, setting it to zero", obj_file_type);
 | 
			
		||||
            obj_file_type = 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        metadata.data.music.fileName = strdup(metadata.name);
 | 
			
		||||
        metadata.data.music.fileFormatType = audio_list[file_type].file_format;
 | 
			
		||||
        metadata.data.music.fileFormatType = audio_list[obj_file_type].file_format;
 | 
			
		||||
        metadata.data.music.statusType = 1;
 | 
			
		||||
        metadata.data.music.numTracks = 1;
 | 
			
		||||
        metadata.data.music.tracks = new media_track();
 | 
			
		||||
        metadata.data.music.tracks->type = VITA_TRACK_TYPE_AUDIO;
 | 
			
		||||
        metadata.data.music.tracks->data.track_photo.codecType = audio_list[file_type].file_codec;
 | 
			
		||||
        metadata.data.music.tracks->data.track_photo.codecType = audio_list[obj_file_type].file_codec;
 | 
			
		||||
        Database::loadMusicMetadata(file.absoluteFilePath(), metadata);
 | 
			
		||||
    } else if(MASK_SET(metadata.dataType, Video | File)) {
 | 
			
		||||
        metadata.data.video.fileName = strdup(metadata.name);
 | 
			
		||||
@@ -153,23 +153,23 @@ void CMAObject::initObject(const QFileInfo &file, int file_type)
 | 
			
		||||
        Database::loadVideoMetadata(file.absoluteFilePath(), metadata);
 | 
			
		||||
    } else if(MASK_SET(metadata.dataType, Photo | File)) {
 | 
			
		||||
 | 
			
		||||
        if(file_type < 0) {
 | 
			
		||||
            qWarning("Invalid file type for photos: %i, setting it to zero", file_type);
 | 
			
		||||
            file_type = 0;
 | 
			
		||||
        if(obj_file_type < 0) {
 | 
			
		||||
            qWarning("Invalid file type for photos: %i, setting it to zero", obj_file_type);
 | 
			
		||||
            obj_file_type = 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        metadata.data.photo.fileName = strdup(metadata.name);
 | 
			
		||||
        metadata.data.photo.fileFormatType = photo_list[file_type].file_format;
 | 
			
		||||
        metadata.data.photo.fileFormatType = photo_list[obj_file_type].file_format;
 | 
			
		||||
        metadata.data.photo.statusType = 1;
 | 
			
		||||
        metadata.data.photo.dateTimeOriginal = file.created().toUTC().toTime_t();
 | 
			
		||||
        metadata.data.photo.numTracks = 1;
 | 
			
		||||
        metadata.data.photo.tracks = new media_track();
 | 
			
		||||
        metadata.data.photo.tracks->type = VITA_TRACK_TYPE_PHOTO;
 | 
			
		||||
        metadata.data.photo.tracks->data.track_photo.codecType = photo_list[file_type].file_codec;
 | 
			
		||||
        metadata.data.photo.tracks->data.track_photo.codecType = photo_list[obj_file_type].file_codec;
 | 
			
		||||
        Database::loadPhotoMetadata(file.absoluteFilePath(), metadata);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    path = file.absoluteFilePath();
 | 
			
		||||
    m_path = file.absoluteFilePath();
 | 
			
		||||
 | 
			
		||||
    if(parent->metadata.path == NULL) {
 | 
			
		||||
        metadata.path = strdup(metadata.name);
 | 
			
		||||
@@ -201,7 +201,7 @@ void CMAObject::rename(const QString &newname)
 | 
			
		||||
        metadata.path = strdup(metadata_path.join("/").toUtf8().data());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    path = QFileInfo(path).absoluteDir().path() + "/" + newname;
 | 
			
		||||
    m_path = QFileInfo(m_path).absoluteDir().path() + "/" + newname;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CMAObject::refreshPath()
 | 
			
		||||
@@ -210,7 +210,7 @@ void CMAObject::refreshPath()
 | 
			
		||||
        free(metadata.path);
 | 
			
		||||
        QString newpath(QString(parent->metadata.path) + "/" + metadata.name);
 | 
			
		||||
        metadata.path = strdup(newpath.toUtf8().data());
 | 
			
		||||
        path = parent->path + "/" + metadata.name;
 | 
			
		||||
        m_path = parent->m_path + "/" + metadata.name;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@ public:
 | 
			
		||||
        ohfi_count = OHFI_OFFSET;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QString path;
 | 
			
		||||
    QString m_path;
 | 
			
		||||
    CMAObject *parent;
 | 
			
		||||
    metadata_t metadata;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@ void CMARootObject::initObject(const QString &path)
 | 
			
		||||
    switch(root_ohfi) {
 | 
			
		||||
    case VITA_OHFI_MUSIC:
 | 
			
		||||
        metadata.dataType = Music;
 | 
			
		||||
        this->path = path;
 | 
			
		||||
        m_path = path;
 | 
			
		||||
        num_filters = 5;
 | 
			
		||||
        filters = new metadata_t[5];
 | 
			
		||||
        createFilter(&filters[0], "Artists", VITA_DIR_TYPE_MASK_MUSIC | VITA_DIR_TYPE_MASK_ROOT | VITA_DIR_TYPE_MASK_ARTISTS);
 | 
			
		||||
@@ -48,7 +48,7 @@ void CMARootObject::initObject(const QString &path)
 | 
			
		||||
 | 
			
		||||
    case VITA_OHFI_PHOTO:
 | 
			
		||||
        metadata.dataType = Photo;
 | 
			
		||||
        this->path = path;
 | 
			
		||||
        m_path = path;
 | 
			
		||||
        num_filters = 3;
 | 
			
		||||
        filters = new metadata_t[3];
 | 
			
		||||
        createFilter(&filters[0], "All", VITA_DIR_TYPE_MASK_PHOTO | VITA_DIR_TYPE_MASK_ROOT | VITA_DIR_TYPE_MASK_ALL);
 | 
			
		||||
@@ -58,7 +58,7 @@ void CMARootObject::initObject(const QString &path)
 | 
			
		||||
 | 
			
		||||
    case VITA_OHFI_VIDEO:
 | 
			
		||||
        metadata.dataType = Video;
 | 
			
		||||
        this->path = path;
 | 
			
		||||
        m_path = path;
 | 
			
		||||
        num_filters = 2;
 | 
			
		||||
        filters = new metadata_t[2];
 | 
			
		||||
        createFilter(&filters[0], "All", VITA_DIR_TYPE_MASK_VIDEO | VITA_DIR_TYPE_MASK_ROOT | VITA_DIR_TYPE_MASK_ALL);
 | 
			
		||||
@@ -67,48 +67,48 @@ void CMARootObject::initObject(const QString &path)
 | 
			
		||||
 | 
			
		||||
    case VITA_OHFI_VITAAPP:
 | 
			
		||||
        metadata.dataType = App;
 | 
			
		||||
        this->path = QDir(QDir(path).absoluteFilePath("APP")).absoluteFilePath(uuid);
 | 
			
		||||
        m_path = QDir(QDir(path).absoluteFilePath("APP")).absoluteFilePath(uuid);
 | 
			
		||||
        num_filters = 0;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VITA_OHFI_PSPAPP:
 | 
			
		||||
        metadata.dataType = App;
 | 
			
		||||
        this->path = QDir(QDir(path).absoluteFilePath("PGAME")).absoluteFilePath(uuid);
 | 
			
		||||
        m_path = QDir(QDir(path).absoluteFilePath("PGAME")).absoluteFilePath(uuid);
 | 
			
		||||
        num_filters = 0;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VITA_OHFI_PSPSAVE:
 | 
			
		||||
        metadata.dataType = SaveData;
 | 
			
		||||
        this->path = QDir(QDir(path).absoluteFilePath("PSAVEDATA")).absoluteFilePath(uuid);
 | 
			
		||||
        m_path = QDir(QDir(path).absoluteFilePath("PSAVEDATA")).absoluteFilePath(uuid);
 | 
			
		||||
        num_filters = 0;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VITA_OHFI_PSXAPP:
 | 
			
		||||
        metadata.dataType = App;
 | 
			
		||||
        this->path = QDir(QDir(path).absoluteFilePath("PSGAME")).absoluteFilePath(uuid);
 | 
			
		||||
        m_path = QDir(QDir(path).absoluteFilePath("PSGAME")).absoluteFilePath(uuid);
 | 
			
		||||
        num_filters = 0;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VITA_OHFI_PSMAPP:
 | 
			
		||||
        metadata.dataType = App;
 | 
			
		||||
        this->path = QDir(QDir(path).absoluteFilePath("PSM")).absoluteFilePath(uuid);
 | 
			
		||||
        m_path = QDir(QDir(path).absoluteFilePath("PSM")).absoluteFilePath(uuid);
 | 
			
		||||
        num_filters = 0;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VITA_OHFI_BACKUP:
 | 
			
		||||
        metadata.dataType = App;
 | 
			
		||||
        this->path = QDir(QDir(path).absoluteFilePath("SYSTEM")).absoluteFilePath(uuid);
 | 
			
		||||
        m_path = QDir(QDir(path).absoluteFilePath("SYSTEM")).absoluteFilePath(uuid);
 | 
			
		||||
        num_filters = 0;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VITA_OHFI_PACKAGE:
 | 
			
		||||
        metadata.dataType = Package;
 | 
			
		||||
        this->path = path;
 | 
			
		||||
        m_path = path;
 | 
			
		||||
        num_filters = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // create the backup directories
 | 
			
		||||
    QDir dir(this->path);
 | 
			
		||||
    QDir dir(m_path);
 | 
			
		||||
    dir.mkpath(dir.absolutePath());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -89,7 +89,7 @@ bool removeRecursively(const QString &path)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QByteArray findFolderAlbumArt(const QString path, metadata_t *metadata)
 | 
			
		||||
static QByteArray findFolderAlbumArt(const QString path, metadata_t *metadata)
 | 
			
		||||
{
 | 
			
		||||
    QByteArray data;
 | 
			
		||||
    QDir folder(path);
 | 
			
		||||
 
 | 
			
		||||
@@ -45,8 +45,8 @@ const file_type video_list[] = {
 | 
			
		||||
    {"mp4", FILE_FORMAT_MP4, 0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Database::Database(QObject *parent) :
 | 
			
		||||
    QObject(parent),
 | 
			
		||||
Database::Database(QObject *obj_parent) :
 | 
			
		||||
    QObject(obj_parent),
 | 
			
		||||
    mutex(QMutex::Recursive)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -947,10 +947,7 @@ static bool LoadCubeMap( QDataStream & s, const DDSHeader & header, QImage & img
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
bool canReadDDS(QIODevice *device)
 | 
			
		||||
static bool canReadDDS(QIODevice *device)
 | 
			
		||||
{
 | 
			
		||||
    if (!device) {
 | 
			
		||||
        qWarning("DDSHandler::canRead() called with no device");
 | 
			
		||||
 
 | 
			
		||||
@@ -37,8 +37,8 @@ const QString BackupItem::infoTemplate = "<html><head/><body>"
 | 
			
		||||
        "<p><span style=\" font-size:10pt;\"> %1</span></p>"
 | 
			
		||||
        "</body></html>";
 | 
			
		||||
 | 
			
		||||
BackupItem::BackupItem(QWidget *parent) :
 | 
			
		||||
    QWidget(parent),
 | 
			
		||||
BackupItem::BackupItem(QWidget *obj_parent) :
 | 
			
		||||
    QWidget(obj_parent),
 | 
			
		||||
    ui(new Ui::BackupItem)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
@@ -54,7 +54,7 @@ BackupItem::~BackupItem()
 | 
			
		||||
 | 
			
		||||
void BackupItem::openDirectory()
 | 
			
		||||
{
 | 
			
		||||
    QDesktopServices::openUrl(QUrl("file:///" + path));
 | 
			
		||||
    QDesktopServices::openUrl(QUrl("file:///" + m_path));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BackupItem::removeEntry()
 | 
			
		||||
@@ -69,13 +69,13 @@ const QPixmap *BackupItem::getIconPixmap()
 | 
			
		||||
 | 
			
		||||
void BackupItem::setDirectory(const QString &path)
 | 
			
		||||
{
 | 
			
		||||
    this->path = path;
 | 
			
		||||
    m_path = path;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BackupItem::setItemInfo(const QString &name, const QString &size, const QString &extra)
 | 
			
		||||
void BackupItem::setItemInfo(const QString &name, const QString &item_size, const QString &extra)
 | 
			
		||||
{
 | 
			
		||||
    ui->gameLabel->setText(gameTemplate.arg(name));
 | 
			
		||||
    ui->sizeLabel->setText(sizeTemplate.arg(size));
 | 
			
		||||
    ui->sizeLabel->setText(sizeTemplate.arg(item_size));
 | 
			
		||||
    ui->infoLabel->setText(infoTemplate.arg(extra));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -84,9 +84,9 @@ int BackupItem::getIconWidth()
 | 
			
		||||
    return ui->itemPicture->width();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BackupItem::setItemIcon(const QString &path, int width, bool try_dds)
 | 
			
		||||
void BackupItem::setItemIcon(const QString &path, int item_width, bool try_dds)
 | 
			
		||||
{
 | 
			
		||||
    ui->itemPicture->setMinimumWidth(width);
 | 
			
		||||
    ui->itemPicture->setMinimumWidth(item_width);
 | 
			
		||||
    QPixmap pixmap(path);
 | 
			
		||||
    if((pixmap.width() <= 0 || pixmap.height() <= 0) && try_dds) {
 | 
			
		||||
        QImage image;
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@ public:
 | 
			
		||||
    ~BackupItem();
 | 
			
		||||
 | 
			
		||||
    void setItemInfo(const QString &name, const QString &size, const QString &extra);
 | 
			
		||||
    void setItemIcon(const QString &path, int width = 48, bool try_dds = false);
 | 
			
		||||
    void setDirectory(const QString &path);
 | 
			
		||||
    void setItemIcon(const QString &m_path, int width = 48, bool try_dds = false);
 | 
			
		||||
    void setDirectory(const QString &m_path);
 | 
			
		||||
    const QPixmap *getIconPixmap();
 | 
			
		||||
    int getIconWidth();
 | 
			
		||||
 | 
			
		||||
@@ -46,7 +46,7 @@ public:
 | 
			
		||||
    QString title;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    QString path;
 | 
			
		||||
    QString m_path;
 | 
			
		||||
    Ui::BackupItem *ui;
 | 
			
		||||
    static const QString gameTemplate;
 | 
			
		||||
    static const QString sizeTemplate;
 | 
			
		||||
 
 | 
			
		||||
@@ -32,8 +32,8 @@
 | 
			
		||||
 | 
			
		||||
#include <vitamtp.h>
 | 
			
		||||
 | 
			
		||||
BackupManagerForm::BackupManagerForm(Database *db, QWidget *parent) :
 | 
			
		||||
    QDialog(parent), m_db(db),
 | 
			
		||||
BackupManagerForm::BackupManagerForm(Database *db, QWidget *obj_parent) :
 | 
			
		||||
    QDialog(obj_parent), m_db(db),
 | 
			
		||||
    ui(new Ui::BackupManagerForm)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
@@ -83,9 +83,9 @@ void BackupManagerForm::removeEntry(BackupItem *item)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BackupManagerForm::setBackupUsage(qint64 size)
 | 
			
		||||
void BackupManagerForm::setBackupUsage(qint64 usage_size)
 | 
			
		||||
{
 | 
			
		||||
    ui->usageLabel->setText(tr("Backup disk usage: %1").arg(readable_size(size, true)));
 | 
			
		||||
    ui->usageLabel->setText(tr("Backup disk usage: %1").arg(readable_size(usage_size, true)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BackupManagerForm::loadBackupListing(int index)
 | 
			
		||||
@@ -191,7 +191,7 @@ void BackupManagerForm::loadBackupListing(int index)
 | 
			
		||||
 | 
			
		||||
        // show better size info for multi GiB backups
 | 
			
		||||
        bool use_gb = ohfi == VITA_OHFI_BACKUP && meta->size > 1024*1024*1024;
 | 
			
		||||
        QString size = readable_size(meta->size, use_gb);
 | 
			
		||||
        QString read_size = readable_size(meta->size, use_gb);
 | 
			
		||||
 | 
			
		||||
        QString info;
 | 
			
		||||
 | 
			
		||||
@@ -211,7 +211,7 @@ void BackupManagerForm::loadBackupListing(int index)
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        item->setItemInfo(game_name, size, info);
 | 
			
		||||
        item->setItemInfo(game_name, read_size, info);
 | 
			
		||||
        item->setItemIcon(QDir(parent_path).absoluteFilePath(sys_dir ? "icon0.png" : "ICON0.PNG"), img_width, ohfi == VITA_OHFI_PSMAPP);
 | 
			
		||||
        item->setDirectory(path + QDir::separator() + meta->name);
 | 
			
		||||
        item->resize(646, 68);
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,8 @@ extern "C" {
 | 
			
		||||
#define writableLocation storageLocation
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
ConfigWidget::ConfigWidget(QWidget *parent) :
 | 
			
		||||
    QDialog(parent),
 | 
			
		||||
ConfigWidget::ConfigWidget(QWidget *obj_parent) :
 | 
			
		||||
    QDialog(obj_parent),
 | 
			
		||||
    ui(new Ui::ConfigWidget)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
 
 | 
			
		||||
@@ -25,8 +25,8 @@ const QString ConfirmDialog::messageTemplate = "<html><head/><body>"
 | 
			
		||||
        "<p><span style=\"font-size:12pt; font-weight:600;\">%2</span></p>"
 | 
			
		||||
        "</body></html>";
 | 
			
		||||
 | 
			
		||||
ConfirmDialog::ConfirmDialog(QWidget *parent) :
 | 
			
		||||
    QDialog(parent),
 | 
			
		||||
ConfirmDialog::ConfirmDialog(QWidget *obj_parent) :
 | 
			
		||||
    QDialog(obj_parent),
 | 
			
		||||
    ui(new Ui::ConfirmDialog)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
@@ -38,10 +38,10 @@ void ConfirmDialog::setMessageText(const QString message, const QString game_tit
 | 
			
		||||
    ui->confirmText->setText(messageTemplate.arg(message, game_title));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ConfirmDialog::setMessagePixmap(const QPixmap &pixmap, int width)
 | 
			
		||||
void ConfirmDialog::setMessagePixmap(const QPixmap &pixmap, int dialog_width)
 | 
			
		||||
{
 | 
			
		||||
    ui->itemPicture->setPixmap(pixmap);
 | 
			
		||||
    ui->itemPicture->setMinimumWidth(width);
 | 
			
		||||
    ui->itemPicture->setMinimumWidth(dialog_width);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ConfirmDialog::~ConfirmDialog()
 | 
			
		||||
 
 | 
			
		||||
@@ -28,8 +28,8 @@ const QString PinForm::pinFormat =
 | 
			
		||||
    "<p><span style=\"font-size:24pt; font-weight:600;\">%1</span></p>"
 | 
			
		||||
    "</body></html>";
 | 
			
		||||
 | 
			
		||||
PinForm::PinForm(QWidget *parent) :
 | 
			
		||||
    QWidget(parent),
 | 
			
		||||
PinForm::PinForm(QWidget *obj_parent) :
 | 
			
		||||
    QWidget(obj_parent),
 | 
			
		||||
    ui(new Ui::PinForm)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
 
 | 
			
		||||
@@ -23,8 +23,8 @@
 | 
			
		||||
#include <QDesktopWidget>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
 | 
			
		||||
ProgressForm::ProgressForm(QWidget *parent) :
 | 
			
		||||
    QWidget(parent),
 | 
			
		||||
ProgressForm::ProgressForm(QWidget *obj_parent) :
 | 
			
		||||
    QWidget(obj_parent),
 | 
			
		||||
    ui(new Ui::ProgressForm)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
 
 | 
			
		||||
@@ -26,8 +26,8 @@
 | 
			
		||||
 | 
			
		||||
#include <vitamtp.h>
 | 
			
		||||
 | 
			
		||||
ClientManager::ClientManager(Database *db, QObject *parent) :
 | 
			
		||||
    QObject(parent), m_db(db)
 | 
			
		||||
ClientManager::ClientManager(Database *db, QObject *obj_parent) :
 | 
			
		||||
    QObject(obj_parent), m_db(db)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,8 @@
 | 
			
		||||
#include <QIcon>
 | 
			
		||||
#include <QStyle>
 | 
			
		||||
 | 
			
		||||
FilterLineEdit::FilterLineEdit(QWidget *parent) :
 | 
			
		||||
    QLineEdit(parent)
 | 
			
		||||
FilterLineEdit::FilterLineEdit(QWidget *obj_parent) :
 | 
			
		||||
    QLineEdit(obj_parent)
 | 
			
		||||
{
 | 
			
		||||
    int frame_width = frameWidth();
 | 
			
		||||
    clearButton = new QToolButton(this);
 | 
			
		||||
@@ -45,9 +45,9 @@ FilterLineEdit::FilterLineEdit(QWidget *parent) :
 | 
			
		||||
                   qMax(min_size_hint.height(), clearButton->sizeHint().height() + frame_width));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void FilterLineEdit::updateCloseButton(const QString& text)
 | 
			
		||||
void FilterLineEdit::updateCloseButton(const QString& filter_text)
 | 
			
		||||
{
 | 
			
		||||
    if(text.isEmpty() || text == tr("Filter")) {
 | 
			
		||||
    if(filter_text.isEmpty() || filter_text == tr("Filter")) {
 | 
			
		||||
        clearButton->setVisible(false);
 | 
			
		||||
    } else {
 | 
			
		||||
        clearButton->setVisible(true);
 | 
			
		||||
 
 | 
			
		||||
@@ -34,11 +34,11 @@
 | 
			
		||||
#include "mainwidget.h"
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
void noMessageOutput(QtMsgType type, const QMessageLogContext &, const QString & str)
 | 
			
		||||
static void noMessageOutput(QtMsgType type, const QMessageLogContext &, const QString & str)
 | 
			
		||||
{
 | 
			
		||||
    const char * msg = str.toStdString().c_str();
 | 
			
		||||
#else
 | 
			
		||||
void noMessageOutput(QtMsgType type, const char *msg)
 | 
			
		||||
static void noMessageOutput(QtMsgType type, const char *msg)
 | 
			
		||||
{
 | 
			
		||||
#endif
 | 
			
		||||
    Q_UNUSED(type);
 | 
			
		||||
 
 | 
			
		||||
@@ -45,8 +45,8 @@ const QStringList MainWidget::path_list = QStringList() << "photoPath" << "music
 | 
			
		||||
bool sleptOnce = false;
 | 
			
		||||
 | 
			
		||||
#ifdef Q_OS_LINUX
 | 
			
		||||
MainWidget::MainWidget(QWidget *parent) :
 | 
			
		||||
    QWidget(parent), db(NULL), configForm(NULL), managerForm(NULL), backupForm(NULL), dbus_conn(QDBusConnection::sessionBus())
 | 
			
		||||
MainWidget::MainWidget(QWidget *obj_parent) :
 | 
			
		||||
    QWidget(obj_parent), db(NULL), configForm(NULL), managerForm(NULL), backupForm(NULL), dbus_conn(QDBusConnection::sessionBus())
 | 
			
		||||
{
 | 
			
		||||
    new ClientManagerAdaptor(this);
 | 
			
		||||
    QDBusConnection dbus = QDBusConnection::sessionBus();
 | 
			
		||||
@@ -184,8 +184,8 @@ void MainWidget::showAboutDialog()
 | 
			
		||||
 | 
			
		||||
    // hack to expand the messagebox minimum size
 | 
			
		||||
    QSpacerItem* horizontalSpacer = new QSpacerItem(300, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
 | 
			
		||||
    QGridLayout* layout = (QGridLayout*)about.layout();
 | 
			
		||||
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
 | 
			
		||||
    QGridLayout* widget_layout = (QGridLayout*)about.layout();
 | 
			
		||||
    widget_layout->addItem(horizontalSpacer, widget_layout->rowCount(), 0, 1, widget_layout->columnCount());
 | 
			
		||||
 | 
			
		||||
    about.show();
 | 
			
		||||
    about.exec();
 | 
			
		||||
@@ -206,7 +206,7 @@ void MainWidget::refreshDatabase()
 | 
			
		||||
    managerForm->refreshDatabase();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TrayIndicator *MainWidget::createTrayObject(QWidget *parent)
 | 
			
		||||
TrayIndicator *MainWidget::createTrayObject(QWidget *obj_parent)
 | 
			
		||||
{
 | 
			
		||||
    TrayFunctionPointer create_tray = NULL;
 | 
			
		||||
 | 
			
		||||
@@ -242,7 +242,7 @@ TrayIndicator *MainWidget::createTrayObject(QWidget *parent)
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    // else QSystemTrayIcon
 | 
			
		||||
    return (create_tray != NULL) ? create_tray(parent) : createTrayIndicator(parent);
 | 
			
		||||
    return (create_tray != NULL) ? create_tray(obj_parent) : createTrayIndicator(obj_parent);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWidget::createTrayIcon()
 | 
			
		||||
 
 | 
			
		||||
@@ -34,8 +34,8 @@ QByteArray HTTPDownloader::buffer;
 | 
			
		||||
bool HTTPDownloader::bufferReady = false;
 | 
			
		||||
qint64 HTTPDownloader::downloadLeft = 0;
 | 
			
		||||
 | 
			
		||||
HTTPDownloader::HTTPDownloader(const QString &url, QObject *parent) :
 | 
			
		||||
    QObject(parent), remote_url(url), firstRead(true)
 | 
			
		||||
HTTPDownloader::HTTPDownloader(const QString &url, QObject *obj_parent) :
 | 
			
		||||
    QObject(obj_parent), remote_url(url), firstRead(true)
 | 
			
		||||
{
 | 
			
		||||
    lengthMutex.lock();
 | 
			
		||||
}
 | 
			
		||||
@@ -123,10 +123,10 @@ int HTTPDownloader::readCallback(unsigned char *data, unsigned long wantlen, uns
 | 
			
		||||
void HTTPDownloader::error(QNetworkReply::NetworkError errorCode)
 | 
			
		||||
{
 | 
			
		||||
    Q_UNUSED(errorCode);
 | 
			
		||||
    QString error = reply->errorString();
 | 
			
		||||
    QString str_error = reply->errorString();
 | 
			
		||||
 | 
			
		||||
    qWarning() << "Network error:" << error;
 | 
			
		||||
    emit messageSent(tr("Network error: %1").arg(error));
 | 
			
		||||
    qWarning() << "Network error:" << str_error;
 | 
			
		||||
    emit messageSent(tr("Network error: %1").arg(str_error));
 | 
			
		||||
 | 
			
		||||
    lengthMutex.unlock();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
 | 
			
		||||
#include "kdenotifier.h"
 | 
			
		||||
 | 
			
		||||
KDENotifier::KDENotifier(const QString &id, QObject *parent) :
 | 
			
		||||
    KStatusNotifierItem(id, parent)
 | 
			
		||||
KDENotifier::KDENotifier(const QString ¬ifier_id, QObject *obj_parent) :
 | 
			
		||||
    KStatusNotifierItem(notifier_id, obj_parent)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -24,8 +24,8 @@
 | 
			
		||||
#include <QMenu>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
KDENotifierTray::KDENotifierTray(QWidget *parent)
 | 
			
		||||
    : TrayIndicator(parent)
 | 
			
		||||
KDENotifierTray::KDENotifierTray(QWidget *obj_parent)
 | 
			
		||||
    : TrayIndicator(obj_parent)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -31,8 +31,8 @@ extern "C" {
 | 
			
		||||
#define signals public
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
QTrayIcon::QTrayIcon(QWidget *parent)
 | 
			
		||||
    : TrayIndicator(parent)
 | 
			
		||||
QTrayIcon::QTrayIcon(QWidget *obj_parent)
 | 
			
		||||
    : TrayIndicator(obj_parent)
 | 
			
		||||
{
 | 
			
		||||
#ifdef Q_OS_LINUX
 | 
			
		||||
    notify_init("qcma");
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ public:
 | 
			
		||||
    virtual void hide() = 0;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    TrayIndicator(QWidget *parent = 0) : QWidget(parent) {}
 | 
			
		||||
    TrayIndicator(QWidget *obj_parent = 0) : QWidget(obj_parent) {}
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
    void openConfig();
 | 
			
		||||
 
 | 
			
		||||
@@ -47,8 +47,8 @@ void quitIndicator(GtkMenu *menu, gpointer data);
 | 
			
		||||
 | 
			
		||||
#define signals public
 | 
			
		||||
 | 
			
		||||
UnityIndicator::UnityIndicator(QWidget *parent) :
 | 
			
		||||
    TrayIndicator(parent)
 | 
			
		||||
UnityIndicator::UnityIndicator(QWidget *obj_parent) :
 | 
			
		||||
    TrayIndicator(obj_parent)
 | 
			
		||||
{
 | 
			
		||||
    notify_init("qcma");
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -28,8 +28,8 @@
 | 
			
		||||
#include <QThread>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
QListDB::QListDB(QObject *parent) :
 | 
			
		||||
    Database(parent)
 | 
			
		||||
QListDB::QListDB(QObject *obj_parent) :
 | 
			
		||||
    Database(obj_parent)
 | 
			
		||||
{
 | 
			
		||||
    QString uuid = QSettings().value("lastAccountId", "ffffffffffffffff").toString();
 | 
			
		||||
    CMARootObject::uuid  = uuid;
 | 
			
		||||
@@ -138,7 +138,7 @@ int QListDB::create()
 | 
			
		||||
 | 
			
		||||
        root_list list;
 | 
			
		||||
        list << obj;
 | 
			
		||||
        emit directoryAdded(obj->path);
 | 
			
		||||
        emit directoryAdded(obj->m_path);
 | 
			
		||||
 | 
			
		||||
        if(!skipCurrent) {
 | 
			
		||||
            dir_count = recursiveScanRootDirectory(list, obj, ohfi_array[i]);
 | 
			
		||||
@@ -160,7 +160,7 @@ int QListDB::create()
 | 
			
		||||
 | 
			
		||||
CMAObject *QListDB::getParent(CMAObject *last_dir, const QString ¤t_path)
 | 
			
		||||
{
 | 
			
		||||
    while(last_dir && current_path != last_dir->path) {
 | 
			
		||||
    while(last_dir && current_path != last_dir->m_path) {
 | 
			
		||||
        last_dir = last_dir->parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -169,10 +169,10 @@ CMAObject *QListDB::getParent(CMAObject *last_dir, const QString ¤t_path)
 | 
			
		||||
 | 
			
		||||
int QListDB::scanRootDirectory(root_list &list, int ohfi_type)
 | 
			
		||||
{
 | 
			
		||||
    int file_type = -1;
 | 
			
		||||
    int obj_file_type = -1;
 | 
			
		||||
    int total_objects = 0;
 | 
			
		||||
    CMAObject *last_dir = list.first();
 | 
			
		||||
    QDir dir(last_dir->path);
 | 
			
		||||
    QDir dir(last_dir->m_path);
 | 
			
		||||
    dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot);
 | 
			
		||||
    QDirIterator it(dir, QDirIterator::Subdirectories);
 | 
			
		||||
 | 
			
		||||
@@ -186,14 +186,14 @@ int QListDB::scanRootDirectory(root_list &list, int ohfi_type)
 | 
			
		||||
        QFileInfo info = it.fileInfo();
 | 
			
		||||
 | 
			
		||||
        if(info.isFile()) {
 | 
			
		||||
            if((file_type = checkFileType(info.absoluteFilePath(), ohfi_type)) < 0) {
 | 
			
		||||
            if((obj_file_type = checkFileType(info.absoluteFilePath(), ohfi_type)) < 0) {
 | 
			
		||||
                //qDebug("Excluding %s from database", info.absoluteFilePath().toStdString().c_str());
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        CMAObject *obj = new CMAObject(getParent(last_dir, info.path()));
 | 
			
		||||
        obj->initObject(info, file_type);
 | 
			
		||||
        obj->initObject(info, obj_file_type);
 | 
			
		||||
        //qDebug("Added %s to database with OHFI %d", obj->metadata.name, obj->metadata.ohfi);
 | 
			
		||||
        list << obj;
 | 
			
		||||
 | 
			
		||||
@@ -206,12 +206,12 @@ int QListDB::scanRootDirectory(root_list &list, int ohfi_type)
 | 
			
		||||
    return total_objects;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int QListDB::recursiveScanRootDirectory(root_list &list, CMAObject *parent, int ohfi_type)
 | 
			
		||||
int QListDB::recursiveScanRootDirectory(root_list &list, CMAObject *obj_parent, int ohfi_type)
 | 
			
		||||
{
 | 
			
		||||
    int file_type = -1;
 | 
			
		||||
    int obj_file_type = -1;
 | 
			
		||||
    int total_objects = 0;
 | 
			
		||||
 | 
			
		||||
    QDir dir(parent->path);
 | 
			
		||||
    QDir dir(obj_parent->m_path);
 | 
			
		||||
    dir.setSorting(QDir::Name | QDir::DirsFirst);
 | 
			
		||||
    QFileInfoList qsl = dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot, QDir::Time);
 | 
			
		||||
 | 
			
		||||
@@ -221,16 +221,16 @@ int QListDB::recursiveScanRootDirectory(root_list &list, CMAObject *parent, int
 | 
			
		||||
            return -1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if(info.isFile() && (file_type = checkFileType(info.absoluteFilePath(), ohfi_type)) < 0) {
 | 
			
		||||
        if(info.isFile() && (obj_file_type = checkFileType(info.absoluteFilePath(), ohfi_type)) < 0) {
 | 
			
		||||
            //qDebug("Excluding %s from database", info.absoluteFilePath().toStdString().c_str());>
 | 
			
		||||
        } else {
 | 
			
		||||
            CMAObject *obj = new CMAObject(parent);
 | 
			
		||||
            obj->initObject(info, file_type);
 | 
			
		||||
            CMAObject *obj = new CMAObject(obj_parent);
 | 
			
		||||
            obj->initObject(info, obj_file_type);
 | 
			
		||||
            emit fileAdded(obj->metadata.name);
 | 
			
		||||
            //qDebug("Added %s to database with OHFI %d", obj->metadata.name, obj->metadata.ohfi);
 | 
			
		||||
            list << obj;
 | 
			
		||||
            if(info.isDir()) {
 | 
			
		||||
                emit directoryAdded(obj->path);
 | 
			
		||||
                emit directoryAdded(obj->m_path);
 | 
			
		||||
                total_objects += recursiveScanRootDirectory(list, obj, ohfi_type);
 | 
			
		||||
            } else {
 | 
			
		||||
                total_objects++;
 | 
			
		||||
@@ -319,7 +319,7 @@ CMAObject *QListDB::pathToObjectInternal(const root_list &list, const char *path
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int QListDB::acceptFilteredObject(const CMAObject *parent, const CMAObject *current, int type)
 | 
			
		||||
int QListDB::acceptFilteredObject(const CMAObject *obj_parent, const CMAObject *current, int type)
 | 
			
		||||
{
 | 
			
		||||
    QMutexLocker locker(&mutex);
 | 
			
		||||
    int result = 0;
 | 
			
		||||
@@ -347,7 +347,7 @@ int QListDB::acceptFilteredObject(const CMAObject *parent, const CMAObject *curr
 | 
			
		||||
    } else if(type & (VITA_DIR_TYPE_MASK_ALL | VITA_DIR_TYPE_MASK_SONGS)) {
 | 
			
		||||
        result = result && (current->metadata.dataType & File);
 | 
			
		||||
    } else if(type & (VITA_DIR_TYPE_MASK_REGULAR)) {
 | 
			
		||||
        result = (parent->metadata.ohfi == current->metadata.ohfiParent);
 | 
			
		||||
        result = (obj_parent->metadata.ohfi == current->metadata.ohfiParent);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // TODO: Support other filter types
 | 
			
		||||
@@ -420,26 +420,26 @@ int QListDB::getObjectMetadatas(int parent_ohfi, metadata_t **metadata, int inde
 | 
			
		||||
{
 | 
			
		||||
    QMutexLocker locker(&mutex);
 | 
			
		||||
 | 
			
		||||
    CMARootObject *parent = static_cast<CMARootObject *>(ohfiToObject(parent_ohfi));
 | 
			
		||||
    CMARootObject *obj_parent = static_cast<CMARootObject *>(ohfiToObject(parent_ohfi));
 | 
			
		||||
 | 
			
		||||
    if(parent == NULL) {
 | 
			
		||||
    if(obj_parent == NULL) {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(parent->metadata.dataType & File) {
 | 
			
		||||
        *metadata = &parent->metadata;
 | 
			
		||||
    if(obj_parent->metadata.dataType & File) {
 | 
			
		||||
        *metadata = &obj_parent->metadata;
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int type = parent->metadata.type;
 | 
			
		||||
    int type = obj_parent->metadata.type;
 | 
			
		||||
 | 
			
		||||
    if(parent->metadata.ohfi < OHFI_OFFSET && parent->filters) { // if we have filters
 | 
			
		||||
        if(parent_ohfi == parent->metadata.ohfi) { // if we are looking at root
 | 
			
		||||
            return parent->getFilters(metadata);
 | 
			
		||||
    if(obj_parent->metadata.ohfi < OHFI_OFFSET && obj_parent->filters) { // if we have filters
 | 
			
		||||
        if(parent_ohfi == obj_parent->metadata.ohfi) { // if we are looking at root
 | 
			
		||||
            return obj_parent->getFilters(metadata);
 | 
			
		||||
        } else { // we are looking at a filter
 | 
			
		||||
            for(int j = 0; j < parent->num_filters; j++) {
 | 
			
		||||
                if(parent->filters[j].ohfi == parent_ohfi) {
 | 
			
		||||
                    type = parent->filters[j].type;
 | 
			
		||||
            for(int j = 0; j < obj_parent->num_filters; j++) {
 | 
			
		||||
                if(obj_parent->filters[j].ohfi == parent_ohfi) {
 | 
			
		||||
                    type = obj_parent->filters[j].type;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -453,7 +453,7 @@ int QListDB::getObjectMetadatas(int parent_ohfi, metadata_t **metadata, int inde
 | 
			
		||||
 | 
			
		||||
    for(map_list::iterator root = object_list.begin(); root != object_list.end(); ++root) {
 | 
			
		||||
        for(root_list::iterator object = (*root).begin(); object != (*root).end(); ++object) {
 | 
			
		||||
            if(acceptFilteredObject(parent, *object, type)) {
 | 
			
		||||
            if(acceptFilteredObject(obj_parent, *object, type)) {
 | 
			
		||||
                if(offset++ >= index) {
 | 
			
		||||
                    tail->next_metadata = &(*object)->metadata;
 | 
			
		||||
                    tail = tail->next_metadata;
 | 
			
		||||
@@ -538,7 +538,7 @@ QString QListDB::getAbsolutePath(int ohfi)
 | 
			
		||||
{
 | 
			
		||||
    QMutexLocker locker(&mutex);
 | 
			
		||||
    CMAObject *obj = ohfiToObject(ohfi);
 | 
			
		||||
    return obj ? obj->path : NULL;
 | 
			
		||||
    return obj ? obj->m_path : NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString QListDB::getRelativePath(int ohfi)
 | 
			
		||||
 
 | 
			
		||||
@@ -145,10 +145,10 @@ static const int ohfi_array[] = { VITA_OHFI_MUSIC, VITA_OHFI_PHOTO, VITA_OHFI_VI
 | 
			
		||||
                                  VITA_OHFI_PSPSAVE, VITA_OHFI_PSXAPP, VITA_OHFI_PSMAPP
 | 
			
		||||
                                };
 | 
			
		||||
 | 
			
		||||
SQLiteDB::SQLiteDB(QObject *parent) :
 | 
			
		||||
    Database(parent)
 | 
			
		||||
SQLiteDB::SQLiteDB(QObject *obj_parent) :
 | 
			
		||||
    Database(obj_parent)
 | 
			
		||||
{
 | 
			
		||||
    uuid = QSettings().value("lastAccountId", "ffffffffffffffff").toString();
 | 
			
		||||
    m_uuid = QSettings().value("lastAccountId", "ffffffffffffffff").toString();
 | 
			
		||||
    thread = new QThread();
 | 
			
		||||
    moveToThread(thread);
 | 
			
		||||
    timer = new QTimer();
 | 
			
		||||
@@ -179,7 +179,7 @@ SQLiteDB::~SQLiteDB()
 | 
			
		||||
 | 
			
		||||
void SQLiteDB::setUUID(const QString &uuid)
 | 
			
		||||
{
 | 
			
		||||
    this->uuid = uuid;
 | 
			
		||||
    m_uuid = uuid;
 | 
			
		||||
    QSettings().setValue("lastAccountId", uuid);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -209,7 +209,7 @@ bool SQLiteDB::load()
 | 
			
		||||
bool SQLiteDB::rescan()
 | 
			
		||||
{
 | 
			
		||||
    if(mutex.tryLock(1000)) {
 | 
			
		||||
        if(uuid != "ffffffffffffffff") {
 | 
			
		||||
        if(m_uuid != "ffffffffffffffff") {
 | 
			
		||||
            timer->start();
 | 
			
		||||
            return true;
 | 
			
		||||
        } else {
 | 
			
		||||
@@ -304,22 +304,22 @@ QString SQLiteDB::getBasePath(int root_ohfi)
 | 
			
		||||
        base_path = settings.value("photoPath").toString();
 | 
			
		||||
        break;
 | 
			
		||||
    case VITA_OHFI_BACKUP:
 | 
			
		||||
        base_path = settings.value("appsPath").toString() + "/SYSTEM/" + uuid;
 | 
			
		||||
        base_path = settings.value("appsPath").toString() + "/SYSTEM/" + m_uuid;
 | 
			
		||||
        break;
 | 
			
		||||
    case VITA_OHFI_VITAAPP:
 | 
			
		||||
        base_path = settings.value("appsPath").toString() + "/APP/" + uuid;
 | 
			
		||||
        base_path = settings.value("appsPath").toString() + "/APP/" + m_uuid;
 | 
			
		||||
        break;
 | 
			
		||||
    case VITA_OHFI_PSPAPP:
 | 
			
		||||
        base_path = settings.value("appsPath").toString() + "/PGAME/" + uuid;
 | 
			
		||||
        base_path = settings.value("appsPath").toString() + "/PGAME/" + m_uuid;
 | 
			
		||||
        break;
 | 
			
		||||
    case VITA_OHFI_PSPSAVE:
 | 
			
		||||
        base_path = settings.value("appsPath").toString() + "/PSAVEDATA/" + uuid;
 | 
			
		||||
        base_path = settings.value("appsPath").toString() + "/PSAVEDATA/" + m_uuid;
 | 
			
		||||
        break;
 | 
			
		||||
    case VITA_OHFI_PSXAPP:
 | 
			
		||||
        base_path = settings.value("appsPath").toString() + "/PSGAME/" + uuid;
 | 
			
		||||
        base_path = settings.value("appsPath").toString() + "/PSGAME/" + m_uuid;
 | 
			
		||||
        break;
 | 
			
		||||
    case VITA_OHFI_PSMAPP:
 | 
			
		||||
        base_path = settings.value("appsPath").toString() + "/PSM/" + uuid;
 | 
			
		||||
        base_path = settings.value("appsPath").toString() + "/PSM/" + m_uuid;
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
    return base_path;
 | 
			
		||||
@@ -463,11 +463,11 @@ bool SQLiteDB::deleteEntry(int ohfi)
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool SQLiteDB::updateAdjacencyList(int ohfi, int parent)
 | 
			
		||||
bool SQLiteDB::updateAdjacencyList(int ohfi, int id_parent)
 | 
			
		||||
{
 | 
			
		||||
    QSqlQuery query;
 | 
			
		||||
    query.prepare("SELECT * FROM adjacent_objects WHERE parent_id == :parent_id AND child_id == :child_id");
 | 
			
		||||
    query.bindValue(0, parent);
 | 
			
		||||
    query.bindValue(0, id_parent);
 | 
			
		||||
    query.bindValue(1, ohfi);
 | 
			
		||||
 | 
			
		||||
    if(query.exec() && query.next()) {
 | 
			
		||||
@@ -476,7 +476,7 @@ bool SQLiteDB::updateAdjacencyList(int ohfi, int parent)
 | 
			
		||||
 | 
			
		||||
    query.prepare("INSERT INTO adjacent_objects (parent_id, child_id)"
 | 
			
		||||
                  "VALUES (:parentid, :child_id)");
 | 
			
		||||
    query.bindValue(0, parent);
 | 
			
		||||
    query.bindValue(0, id_parent);
 | 
			
		||||
    query.bindValue(1, ohfi);
 | 
			
		||||
    bool ret = query.exec();
 | 
			
		||||
    if(!ret) {
 | 
			
		||||
@@ -485,7 +485,7 @@ bool SQLiteDB::updateAdjacencyList(int ohfi, int parent)
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SQLiteDB::insertDefaultEntry(const QString &path, const QString &name, const QString &title, int parent, int type)
 | 
			
		||||
int SQLiteDB::insertDefaultEntry(const QString &path, const QString &name, const QString &title, int id_parent, int type)
 | 
			
		||||
{
 | 
			
		||||
    int ohfi = 0;
 | 
			
		||||
 | 
			
		||||
@@ -493,7 +493,7 @@ int SQLiteDB::insertDefaultEntry(const QString &path, const QString &name, const
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(parent >= OHFI_BASE_VALUE && !updateAdjacencyList(ohfi, parent)) {
 | 
			
		||||
    if(id_parent >= OHFI_BASE_VALUE && !updateAdjacencyList(ohfi, id_parent)) {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -550,7 +550,7 @@ bool SQLiteDB::insertSourceEntry(uint object_id, const QString &path, const QStr
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint SQLiteDB::insertMusicEntry(const QString &path, const QString &name, int parent, int type)
 | 
			
		||||
uint SQLiteDB::insertMusicEntry(const QString &path, const QString &name, int id_parent, int type)
 | 
			
		||||
{
 | 
			
		||||
    bool ok;
 | 
			
		||||
    int ohfi;
 | 
			
		||||
@@ -559,8 +559,8 @@ uint SQLiteDB::insertMusicEntry(const QString &path, const QString &name, int pa
 | 
			
		||||
    const char *artist, *album, *albumartist, *genre, *track, *title;
 | 
			
		||||
    int file_format, audio_codec, audio_bitrate, genre_id, artist_id, track_id, album_id, track_number;
 | 
			
		||||
 | 
			
		||||
    int file_type = checkFileType(name, VITA_OHFI_MUSIC);
 | 
			
		||||
    if(file_type < 0) {
 | 
			
		||||
    int cma_file_type = checkFileType(name, VITA_OHFI_MUSIC);
 | 
			
		||||
    if(cma_file_type < 0) {
 | 
			
		||||
        //qDebug() << "Excluding from database:" << path;
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
@@ -589,13 +589,13 @@ uint SQLiteDB::insertMusicEntry(const QString &path, const QString &name, int pa
 | 
			
		||||
 | 
			
		||||
    duration = decoder.getDuration();
 | 
			
		||||
 | 
			
		||||
    file_format = audio_list[file_type].file_format;
 | 
			
		||||
    audio_codec = audio_list[file_type].file_codec;
 | 
			
		||||
    file_format = audio_list[cma_file_type].file_format;
 | 
			
		||||
    audio_codec = audio_list[cma_file_type].file_codec;
 | 
			
		||||
 | 
			
		||||
    QByteArray basename = QFileInfo(name).baseName().toUtf8();
 | 
			
		||||
    title = decoder.getMetadataEntry("title", basename.constData());
 | 
			
		||||
 | 
			
		||||
    if((ohfi = insertDefaultEntry(path, name, title, parent, type)) == 0) {
 | 
			
		||||
    if((ohfi = insertDefaultEntry(path, name, title, id_parent, type)) == 0) {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -667,7 +667,7 @@ uint SQLiteDB::insertMusicEntry(const QString &path, const QString &name, int pa
 | 
			
		||||
    return ohfi;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint SQLiteDB::insertVideoEntry(const QString &path, const QString &name, int parent, int type)
 | 
			
		||||
uint SQLiteDB::insertVideoEntry(const QString &path, const QString &name, int id_parent, int type)
 | 
			
		||||
{
 | 
			
		||||
    int ohfi;
 | 
			
		||||
    AVDecoder decoder;
 | 
			
		||||
@@ -679,8 +679,8 @@ uint SQLiteDB::insertVideoEntry(const QString &path, const QString &name, int pa
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int file_type = checkFileType(name, VITA_OHFI_VIDEO);
 | 
			
		||||
    if(file_type < 0) {
 | 
			
		||||
    int cma_file_type = checkFileType(name, VITA_OHFI_VIDEO);
 | 
			
		||||
    if(cma_file_type < 0) {
 | 
			
		||||
        //qDebug() << "Excluding from database:" << path;
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
@@ -693,7 +693,7 @@ uint SQLiteDB::insertVideoEntry(const QString &path, const QString &name, int pa
 | 
			
		||||
    duration = decoder.getDuration();
 | 
			
		||||
    video_codec = CODEC_TYPE_AVC;
 | 
			
		||||
    video_bitrate = decoder.getBitrate();
 | 
			
		||||
    file_format = video_list[file_type].file_format;
 | 
			
		||||
    file_format = video_list[cma_file_type].file_format;
 | 
			
		||||
 | 
			
		||||
    if(decoder.loadCodec(AVDecoder::CODEC_AUDIO)) {
 | 
			
		||||
        audio_codec = CODEC_TYPE_AAC;
 | 
			
		||||
@@ -708,7 +708,7 @@ uint SQLiteDB::insertVideoEntry(const QString &path, const QString &name, int pa
 | 
			
		||||
    title = basename.constData();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if((ohfi = insertDefaultEntry(path, name, title, parent, type)) == 0) {
 | 
			
		||||
    if((ohfi = insertDefaultEntry(path, name, title, id_parent, type)) == 0) {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -738,15 +738,15 @@ uint SQLiteDB::insertVideoEntry(const QString &path, const QString &name, int pa
 | 
			
		||||
    return ohfi;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint SQLiteDB::insertPhotoEntry(const QString &path, const QString &name, int parent, int type)
 | 
			
		||||
uint SQLiteDB::insertPhotoEntry(const QString &path, const QString &name, int id_parent, int type)
 | 
			
		||||
{
 | 
			
		||||
    int ohfi;
 | 
			
		||||
    QImage img;
 | 
			
		||||
    uint date_created;
 | 
			
		||||
    int width, height, file_format, photo_codec;
 | 
			
		||||
 | 
			
		||||
    int file_type = checkFileType(name, VITA_OHFI_PHOTO);
 | 
			
		||||
    if(file_type < 0) {
 | 
			
		||||
    int cma_file_type = checkFileType(name, VITA_OHFI_PHOTO);
 | 
			
		||||
    if(cma_file_type < 0) {
 | 
			
		||||
        //qDebug() << "Excluding from database:" << path;
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
@@ -761,12 +761,12 @@ uint SQLiteDB::insertPhotoEntry(const QString &path, const QString &name, int pa
 | 
			
		||||
 | 
			
		||||
    width = img.width();
 | 
			
		||||
    height = img.height();
 | 
			
		||||
    file_format = photo_list[file_type].file_format;
 | 
			
		||||
    photo_codec = photo_list[file_type].file_codec;
 | 
			
		||||
    file_format = photo_list[cma_file_type].file_format;
 | 
			
		||||
    photo_codec = photo_list[cma_file_type].file_codec;
 | 
			
		||||
 | 
			
		||||
    QByteArray basename = QFileInfo(name).baseName().toUtf8();
 | 
			
		||||
 | 
			
		||||
    if((ohfi = insertDefaultEntry(path, name, basename, parent, type)) == 0) {
 | 
			
		||||
    if((ohfi = insertDefaultEntry(path, name, basename, id_parent, type)) == 0) {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -790,7 +790,7 @@ uint SQLiteDB::insertPhotoEntry(const QString &path, const QString &name, int pa
 | 
			
		||||
    return ohfi;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint SQLiteDB::insertSavedataEntry(const QString &path, const QString &name, int parent, int type)
 | 
			
		||||
uint SQLiteDB::insertSavedataEntry(const QString &path, const QString &name, int id_parent, int type)
 | 
			
		||||
{
 | 
			
		||||
    int ohfi;
 | 
			
		||||
    SfoReader reader;
 | 
			
		||||
@@ -809,7 +809,7 @@ uint SQLiteDB::insertSavedataEntry(const QString &path, const QString &name, int
 | 
			
		||||
        date_updated = QFileInfo(path + "/" + name).lastModified().toUTC().toTime_t();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if((ohfi = insertDefaultEntry(path, name, title, parent, type)) == 0) {
 | 
			
		||||
    if((ohfi = insertDefaultEntry(path, name, title, id_parent, type)) == 0) {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -822,7 +822,7 @@ uint SQLiteDB::insertSavedataEntry(const QString &path, const QString &name, int
 | 
			
		||||
                  "(object_id, detail, dir_name, title, date_updated)"
 | 
			
		||||
                  "VALUES (:object_id, :detail, :dir_name, :title, :updated)");
 | 
			
		||||
 | 
			
		||||
    query.bindValue(0, parent);
 | 
			
		||||
    query.bindValue(0, id_parent);
 | 
			
		||||
    query.bindValue(1, savedata_detail);
 | 
			
		||||
    query.bindValue(2, savedata_directory);
 | 
			
		||||
    query.bindValue(3, title);
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ public:
 | 
			
		||||
    void close();
 | 
			
		||||
 | 
			
		||||
    bool reload(bool &prepared);
 | 
			
		||||
    void setUUID(const QString &uuid);
 | 
			
		||||
    void setUUID(const QString &m_uuid);
 | 
			
		||||
 | 
			
		||||
    bool open();
 | 
			
		||||
    int create();
 | 
			
		||||
@@ -95,7 +95,7 @@ private:
 | 
			
		||||
    QTimer *timer;
 | 
			
		||||
    QThread *thread;
 | 
			
		||||
 | 
			
		||||
    QString uuid;
 | 
			
		||||
    QString m_uuid;
 | 
			
		||||
    QSqlDatabase db;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user