Compare commits
	
		
			10 Commits
		
	
	
		
			f8ec8041dc
			...
			72e903c1d5
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 72e903c1d5 | |||
| 7d01a00dec | |||
| 
						 | 
					590236e810 | ||
| 
						 | 
					364dd34ced | ||
| 
						 | 
					65f0eab8ca | ||
| 
						 | 
					718e31ece8 | ||
| 
						 | 
					3f43fff573 | ||
| 
						 | 
					e5ade2626d | ||
| 
						 | 
					70729b4d26 | ||
| 
						 | 
					3448dddf35 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -4,3 +4,4 @@ qcma.pro.user*
 | 
			
		||||
*.bundle
 | 
			
		||||
org.qcma.*.xml
 | 
			
		||||
buildscripts/windows/driver/QcmaDriver_*.exe
 | 
			
		||||
build/
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										21
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								README.md
									
									
									
									
									
								
							@@ -19,13 +19,6 @@ official CMA and also offer some features missing in the original one.
 | 
			
		||||
* Easy wireless pairing (show PIN to the user when a Vita is detected).
 | 
			
		||||
* Ability to restart the connection if the Vita is reconnected.
 | 
			
		||||
 | 
			
		||||
#### TODO:
 | 
			
		||||
* Complete categories for music.
 | 
			
		||||
* SQLite backend for database.
 | 
			
		||||
 | 
			
		||||
#### Planned features
 | 
			
		||||
* **Android version**: port of Qcma to Android.
 | 
			
		||||
 | 
			
		||||
## Headless version
 | 
			
		||||
 | 
			
		||||
There is a qcma_cli binary that doesn't need a X session running (useful for servers).
 | 
			
		||||
@@ -43,8 +36,16 @@ kill -HUP $(pgrep qcma_cli)
 | 
			
		||||
kill $(pgrep qcma_cli)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Downloads (Linux)
 | 
			
		||||
 | 
			
		||||
Packages for Ubuntu, Fedora, Debian and openSUSE are available [here](https://software.opensuse.org/download/package?project=home:codestation&package=qcma).
 | 
			
		||||
 | 
			
		||||
## Downloads (Windows and macOS)
 | 
			
		||||
 | 
			
		||||
Installers for Windows and macOS are available [here](https://github.com/codestation/qcma/releases/latest).
 | 
			
		||||
 | 
			
		||||
## Dependencies
 | 
			
		||||
* [Qt 4.x or 5.x](http://www.qt.io/)
 | 
			
		||||
* [Qt 5.x](http://www.qt.io/)
 | 
			
		||||
 | 
			
		||||
* [VitaMTP fork](https://github.com/codestation/vitamtp)
 | 
			
		||||
 | 
			
		||||
@@ -52,10 +53,6 @@ kill $(pgrep qcma_cli)
 | 
			
		||||
 | 
			
		||||
* [libnotify](http://library.gnome.org/devel/notification-spec/)
 | 
			
		||||
 | 
			
		||||
* [libappindicator (optional)](https://launchpad.net/libappindicator)
 | 
			
		||||
 | 
			
		||||
* [KNotifications (optional)](https://projects.kde.org/projects/frameworks/knotifications)
 | 
			
		||||
 | 
			
		||||
#### Where do I get the source code?
 | 
			
		||||
Check the GitHub repo here: https://github.com/codestation/qcma
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -67,11 +67,9 @@ static void cleanOutput(QtMsgType type, const QMessageLogContext &, const QStrin
 | 
			
		||||
    case QtFatalMsg:
 | 
			
		||||
        __android_log_print(ANDROID_LOG_FATAL, "qcma", "%s", message);
 | 
			
		||||
        abort();
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
 | 
			
		||||
    case QtInfoMsg:
 | 
			
		||||
        __android_log_print(ANDROID_LOG_INFO, "qcma", "%s", message);
 | 
			
		||||
        break;
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
# qcma spec file
 | 
			
		||||
# 
 | 
			
		||||
 | 
			
		||||
%define _version 0.4.1
 | 
			
		||||
%define _version 0.4.2
 | 
			
		||||
 | 
			
		||||
%if "%{_version}" == "testing" || "%{_version}" == "master"
 | 
			
		||||
%define _verprefix %{_version}
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@
 | 
			
		||||
!define PRODUCT_EXE_NAME "qcma.exe"
 | 
			
		||||
!define PRODUCT_VERSION_MAJOR 0
 | 
			
		||||
!define PRODUCT_VERSION_MINOR 4
 | 
			
		||||
!define PRODUCT_VERSION_BUILD 1
 | 
			
		||||
!define PRODUCT_VERSION_BUILD 2
 | 
			
		||||
!define PRODUCT_PUBLISHER "codestation"
 | 
			
		||||
!define PRODUCT_WEB_SITE "https://github.com/codestation/qcma"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,7 @@ void HeadlessManager::refreshDatabase()
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QTextStream(stdout) << "Database scan has started" << endl;
 | 
			
		||||
    QTextStream(stdout) << "Database scan has started" << Qt::endl;
 | 
			
		||||
 | 
			
		||||
    if(!m_db->rescan()) {
 | 
			
		||||
        qWarning("No PS Vita system has been registered");
 | 
			
		||||
@@ -136,7 +136,7 @@ void HeadlessManager::start()
 | 
			
		||||
 | 
			
		||||
void HeadlessManager::receiveMessage(QString message)
 | 
			
		||||
{
 | 
			
		||||
    QTextStream(stdout) << message << endl;
 | 
			
		||||
    QTextStream(stdout) << message << Qt::endl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void HeadlessManager::stop()
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,6 @@
 | 
			
		||||
#include <QLibraryInfo>
 | 
			
		||||
#include <QLocale>
 | 
			
		||||
#include <QStringList>
 | 
			
		||||
#include <QTextCodec>
 | 
			
		||||
#include <QThread>
 | 
			
		||||
#include <QTranslator>
 | 
			
		||||
 | 
			
		||||
@@ -35,15 +34,10 @@
 | 
			
		||||
#include "singlecoreapplication.h"
 | 
			
		||||
#include "headlessmanager.h"
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
static void noDebugOutput(QtMsgType type, const QMessageLogContext &, const QString & msg)
 | 
			
		||||
{
 | 
			
		||||
    QByteArray localMsg = msg.toLocal8Bit();
 | 
			
		||||
    const char *message = localMsg.constData();
 | 
			
		||||
#else
 | 
			
		||||
static void noDebugOutput(QtMsgType type, const char *message)
 | 
			
		||||
{
 | 
			
		||||
#endif
 | 
			
		||||
    switch (type) {
 | 
			
		||||
    case QtDebugMsg:
 | 
			
		||||
        break;
 | 
			
		||||
@@ -57,11 +51,9 @@ static void noDebugOutput(QtMsgType type, const char *message)
 | 
			
		||||
        fprintf(stderr, "Fatal: %s\n", message);
 | 
			
		||||
        abort();
 | 
			
		||||
        break;
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
 | 
			
		||||
    case QtInfoMsg:
 | 
			
		||||
        fprintf(stderr, "Info: %s\n", message);
 | 
			
		||||
        break;
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -105,7 +97,7 @@ int main(int argc, char *argv[])
 | 
			
		||||
    Q_INIT_RESOURCE(translations);
 | 
			
		||||
 | 
			
		||||
    if(SingleCoreApplication::sendMessage("Another instance of Qcma tried to start")) {
 | 
			
		||||
        QTextStream(stdout) << "An instance of Qcma is already running" << endl;
 | 
			
		||||
        QTextStream(stdout) << "An instance of Qcma is already running" << Qt::endl;
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -125,18 +117,10 @@ int main(int argc, char *argv[])
 | 
			
		||||
        VitaMTP_Set_Logging(VitaMTP_VERBOSE);
 | 
			
		||||
    } else {
 | 
			
		||||
        VitaMTP_Set_Logging(VitaMTP_NONE);
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
        qInstallMessageHandler(noDebugOutput);
 | 
			
		||||
#else
 | 
			
		||||
        qInstallMsgHandler(noDebugOutput);
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    QTextStream(stdout) << "Starting Qcma " << QCMA_VER << endl;
 | 
			
		||||
    QTextStream(stdout) << "Starting Qcma " << QCMA_VER << Qt::endl;
 | 
			
		||||
 | 
			
		||||
    QTranslator translator;
 | 
			
		||||
    QString locale = QLocale().system().name();
 | 
			
		||||
@@ -157,8 +141,11 @@ int main(int argc, char *argv[])
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QTranslator system_translator;
 | 
			
		||||
    system_translator.load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
 | 
			
		||||
    if(!system_translator.load("qt_" + locale, QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
 | 
			
		||||
        qWarning() << "Cannot load system translation for locale:" << locale;
 | 
			
		||||
    } else {
 | 
			
		||||
        app.installTranslator(&system_translator);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    qDebug("Starting main thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@ AVDecoder::AVDecoder() :
 | 
			
		||||
AVDecoder::~AVDecoder()
 | 
			
		||||
{
 | 
			
		||||
    if(pCodecCtx) {
 | 
			
		||||
        avcodec_close(pCodecCtx);
 | 
			
		||||
        avcodec_free_context(&pCodecCtx);
 | 
			
		||||
    }
 | 
			
		||||
    if(pFormatCtx) {
 | 
			
		||||
        avformat_close_input(&pFormatCtx);
 | 
			
		||||
@@ -70,9 +70,17 @@ bool AVDecoder::loadCodec(codec_type codec)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    av_stream = pFormatCtx->streams[stream_index];
 | 
			
		||||
    pCodecCtx = av_stream->codec;
 | 
			
		||||
    pCodecCtx = avcodec_alloc_context3(av_codec);
 | 
			
		||||
    if (!pCodecCtx) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    if (avcodec_parameters_to_context(pCodecCtx, av_stream->codecpar) < 0) {
 | 
			
		||||
        avcodec_free_context(&pCodecCtx);
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(avcodec_open2(pCodecCtx, av_codec, &opts) < 0) {
 | 
			
		||||
        avcodec_free_context(&pCodecCtx);
 | 
			
		||||
        codec_loaded = false;
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
@@ -128,37 +136,36 @@ void AVDecoder::getVideoMetadata(metadata_t &metadata)
 | 
			
		||||
 | 
			
		||||
AVFrame *AVDecoder::getDecodedFrame(AVCodecContext *codec_ctx, int frame_stream_index)
 | 
			
		||||
{
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
 | 
			
		||||
    AVFrame *pFrame = av_frame_alloc();
 | 
			
		||||
#else
 | 
			
		||||
    AVFrame *pFrame = avcodec_alloc_frame();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    AVPacket packet;
 | 
			
		||||
    int frame_finished = 0;
 | 
			
		||||
    int ret = 0;
 | 
			
		||||
 | 
			
		||||
    while(!frame_finished && av_read_frame(pFormatCtx, &packet)>=0) {
 | 
			
		||||
    while (av_read_frame(pFormatCtx, &packet) >= 0) {
 | 
			
		||||
        if (packet.stream_index == frame_stream_index) {
 | 
			
		||||
            avcodec_decode_video2(codec_ctx, pFrame, &frame_finished, &packet);
 | 
			
		||||
        }
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,7,0)
 | 
			
		||||
            ret = avcodec_send_packet(codec_ctx, &packet);
 | 
			
		||||
            av_packet_unref(&packet);
 | 
			
		||||
#else
 | 
			
		||||
        av_free_packet(&packet);
 | 
			
		||||
#endif
 | 
			
		||||
            if (ret < 0) {
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
            ret = avcodec_receive_frame(codec_ctx, pFrame);
 | 
			
		||||
            if (ret == 0) {
 | 
			
		||||
                // Frame successfully decoded
 | 
			
		||||
                return pFrame;
 | 
			
		||||
            } else if (ret == AVERROR(EAGAIN)) {
 | 
			
		||||
                // Need more packets
 | 
			
		||||
                continue;
 | 
			
		||||
            } else {
 | 
			
		||||
                // Error or end of stream
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            av_packet_unref(&packet);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(frame_finished) {
 | 
			
		||||
        return pFrame;
 | 
			
		||||
    } else {
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
 | 
			
		||||
    av_frame_free(&pFrame);
 | 
			
		||||
#else
 | 
			
		||||
        avcodec_free_frame(&pFrame);
 | 
			
		||||
#endif
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
bool AVDecoder::seekVideo(int percentage)
 | 
			
		||||
@@ -215,11 +222,7 @@ QByteArray AVDecoder::getThumbnail(int &width, int &height)
 | 
			
		||||
                                       width, height);
 | 
			
		||||
 | 
			
		||||
        data = WriteJPEG(pCodecCtx, pFrame, width, height);
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
 | 
			
		||||
        av_frame_free(&pFrame);
 | 
			
		||||
#else
 | 
			
		||||
        avcodec_free_frame(&pFrame);
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return data;
 | 
			
		||||
@@ -227,8 +230,8 @@ QByteArray AVDecoder::getThumbnail(int &width, int &height)
 | 
			
		||||
 | 
			
		||||
QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int width, int height)
 | 
			
		||||
{
 | 
			
		||||
    AVCodecContext *pOCodecCtx;
 | 
			
		||||
    AVCodec        *pOCodec;
 | 
			
		||||
    AVCodecContext *pOCodecCtx = nullptr;
 | 
			
		||||
    const AVCodec  *pOCodec;
 | 
			
		||||
 | 
			
		||||
    QByteArray data;
 | 
			
		||||
 | 
			
		||||
@@ -249,44 +252,24 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int
 | 
			
		||||
        return data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
 | 
			
		||||
    AVFrame *pFrameRGB = av_frame_alloc();
 | 
			
		||||
#else
 | 
			
		||||
    AVFrame *pFrameRGB = avcodec_alloc_frame();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    if(pFrameRGB == NULL) {
 | 
			
		||||
        sws_freeContext(sws_ctx);
 | 
			
		||||
        return data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // detect ffmpeg (>= 100) or libav (< 100)
 | 
			
		||||
#if (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,63,100)) || \
 | 
			
		||||
    (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(54,6,0))
 | 
			
		||||
    int numBytes = av_image_get_buffer_size(AV_PIX_FMT_YUV420P, width, height, 16);
 | 
			
		||||
#else
 | 
			
		||||
    int numBytes = avpicture_get_size(PIX_FMT_YUVJ420P, width, height);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    uint8_t *buffer = (uint8_t *)av_malloc(numBytes);
 | 
			
		||||
 | 
			
		||||
    if(!buffer) {
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
 | 
			
		||||
        av_frame_free(&pFrameRGB);
 | 
			
		||||
#else
 | 
			
		||||
        avcodec_free_frame(&pFrameRGB);
 | 
			
		||||
#endif
 | 
			
		||||
        sws_freeContext(sws_ctx);
 | 
			
		||||
        return data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // detect ffmpeg (>= 100) or libav (< 100)
 | 
			
		||||
#if (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,63,100)) || \
 | 
			
		||||
    (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(54,6,0))
 | 
			
		||||
    av_image_fill_arrays(pFrameRGB->data, pFrameRGB->linesize, buffer, AV_PIX_FMT_YUV420P, width, height, 1);
 | 
			
		||||
#else
 | 
			
		||||
    avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_YUVJ420P, width, height);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    sws_scale(
 | 
			
		||||
        sws_ctx,
 | 
			
		||||
@@ -301,20 +284,10 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int
 | 
			
		||||
    pOCodecCtx = avcodec_alloc_context3(pOCodec);
 | 
			
		||||
 | 
			
		||||
    if(pOCodecCtx == NULL) {
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,52,0)
 | 
			
		||||
        avcodec_free_context(&pOCodecCtx);
 | 
			
		||||
#else
 | 
			
		||||
        avcodec_close(pOCodecCtx);
 | 
			
		||||
        av_free(pOCodecCtx);
 | 
			
		||||
#endif
 | 
			
		||||
        av_free(buffer);
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
 | 
			
		||||
        av_frame_free(&pFrameRGB);
 | 
			
		||||
#else
 | 
			
		||||
        avcodec_free_frame(&pFrameRGB);
 | 
			
		||||
#endif
 | 
			
		||||
        sws_freeContext(sws_ctx);
 | 
			
		||||
        return  0;
 | 
			
		||||
        return data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pOCodecCtx->bit_rate      = pCodecCtx->bit_rate;
 | 
			
		||||
@@ -329,20 +302,11 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int
 | 
			
		||||
 | 
			
		||||
    AVDictionary *opts = NULL;
 | 
			
		||||
    if(avcodec_open2(pOCodecCtx, pOCodec, &opts) < 0) {
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,52,0)
 | 
			
		||||
        avcodec_free_context(&pOCodecCtx);
 | 
			
		||||
#else
 | 
			
		||||
        avcodec_close(pOCodecCtx);
 | 
			
		||||
        av_free(pOCodecCtx);
 | 
			
		||||
#endif
 | 
			
		||||
        av_free(buffer);
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
 | 
			
		||||
        av_frame_free(&pFrameRGB);
 | 
			
		||||
#else
 | 
			
		||||
        avcodec_free_frame(&pFrameRGB);
 | 
			
		||||
#endif
 | 
			
		||||
        sws_freeContext(sws_ctx);
 | 
			
		||||
         return  0;
 | 
			
		||||
        return data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    av_opt_set_int(pOCodecCtx, "lmin", pOCodecCtx->qmin * FF_QP2LAMBDA, 0);
 | 
			
		||||
@@ -353,36 +317,40 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int
 | 
			
		||||
    pOCodecCtx->flags          = AV_CODEC_FLAG_QSCALE;
 | 
			
		||||
    pOCodecCtx->global_quality = pOCodecCtx->qmin * FF_QP2LAMBDA;
 | 
			
		||||
 | 
			
		||||
    pFrame->pts     = 1;
 | 
			
		||||
    pFrame->quality = pOCodecCtx->global_quality;
 | 
			
		||||
    pFrameRGB->pts     = 1;
 | 
			
		||||
    pFrameRGB->quality = pOCodecCtx->global_quality;
 | 
			
		||||
 | 
			
		||||
    AVPacket pkt;
 | 
			
		||||
    av_init_packet(&pkt);
 | 
			
		||||
    pkt.data = NULL;
 | 
			
		||||
    pkt.size = 0;
 | 
			
		||||
 | 
			
		||||
    int gotPacket;
 | 
			
		||||
 | 
			
		||||
    avcodec_encode_video2(pOCodecCtx, &pkt, pFrameRGB, &gotPacket);
 | 
			
		||||
 | 
			
		||||
    QByteArray buffer2(reinterpret_cast<char *>(pkt.data), pkt.size);
 | 
			
		||||
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,52,0)
 | 
			
		||||
    AVPacket* pkt = av_packet_alloc();
 | 
			
		||||
    if (!pkt) {
 | 
			
		||||
        avcodec_free_context(&pOCodecCtx);
 | 
			
		||||
        av_free(buffer);
 | 
			
		||||
        av_frame_free(&pFrameRGB);
 | 
			
		||||
        sws_freeContext(sws_ctx);
 | 
			
		||||
        return data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int ret = avcodec_send_frame(pOCodecCtx, pFrameRGB);
 | 
			
		||||
    if (ret < 0) {
 | 
			
		||||
        av_packet_free(&pkt);
 | 
			
		||||
        avcodec_free_context(&pOCodecCtx);
 | 
			
		||||
        av_free(buffer);
 | 
			
		||||
        av_frame_free(&pFrameRGB);
 | 
			
		||||
        sws_freeContext(sws_ctx);
 | 
			
		||||
        return data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ret = avcodec_receive_packet(pOCodecCtx, pkt);
 | 
			
		||||
    if (ret == 0) {
 | 
			
		||||
        data = QByteArray(reinterpret_cast<char *>(pkt->data), pkt->size);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    av_packet_free(&pkt);
 | 
			
		||||
    avcodec_free_context(&pOCodecCtx);
 | 
			
		||||
#else
 | 
			
		||||
        avcodec_close(pOCodecCtx);
 | 
			
		||||
        av_free(pOCodecCtx);
 | 
			
		||||
#endif
 | 
			
		||||
    av_free(buffer);
 | 
			
		||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
 | 
			
		||||
    av_frame_free(&pFrameRGB);
 | 
			
		||||
#else
 | 
			
		||||
    avcodec_free_frame(&pFrameRGB);
 | 
			
		||||
#endif
 | 
			
		||||
    avcodec_close(pOCodecCtx);
 | 
			
		||||
    sws_freeContext(sws_ctx);
 | 
			
		||||
 | 
			
		||||
    return buffer2;
 | 
			
		||||
    return data;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AVDecoder::close()
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,6 @@ public:
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        AvInit() {
 | 
			
		||||
            av_register_all();
 | 
			
		||||
            // hide warning logs
 | 
			
		||||
            av_log_set_level(AV_LOG_ERROR);
 | 
			
		||||
        }
 | 
			
		||||
@@ -87,7 +86,7 @@ private:
 | 
			
		||||
    AVFormatContext *pFormatCtx;
 | 
			
		||||
    AVCodecContext *pCodecCtx;
 | 
			
		||||
    AVStream *av_stream;
 | 
			
		||||
    AVCodec *av_codec;
 | 
			
		||||
    const AVCodec *av_codec;
 | 
			
		||||
    int stream_index;
 | 
			
		||||
    bool codec_loaded;
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -62,11 +62,7 @@ CmaBroadcast::CmaBroadcast(QObject *obj_parent) :
 | 
			
		||||
    socket = new QUdpSocket(this);
 | 
			
		||||
    connect(socket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
    QHostAddress host_address(QHostAddress::Any);
 | 
			
		||||
#else
 | 
			
		||||
    QHostAddress host_address(QHostAddress::AnyIPv4);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    if(!socket->bind(host_address, QCMA_REQUEST_PORT, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint)) {
 | 
			
		||||
        qCritical() << "Failed to bind address for UDP broadcast";
 | 
			
		||||
@@ -88,7 +84,7 @@ void CmaBroadcast::readPendingDatagrams()
 | 
			
		||||
            QMutexLocker locker(&mutex);
 | 
			
		||||
            socket->writeDatagram(reply, cma_sender, senderPort);
 | 
			
		||||
        } else {
 | 
			
		||||
            qWarning("Unknown request: %.*s\n", datagram.length(), datagram.constData());
 | 
			
		||||
            qWarning() << "Unknown request, length: " << datagram.length() << "data: " << datagram.constData();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -103,7 +99,7 @@ void CmaBroadcast::setAvailable()
 | 
			
		||||
                 .arg(broadcast_ok, uuid, "win", hostname)
 | 
			
		||||
                 .arg(protocol_version, 8, 10, QChar('0'))
 | 
			
		||||
                 .arg(QCMA_REQUEST_PORT)
 | 
			
		||||
                 .arg(VITAMTP_WIRELESS_MAX_VERSION, 8, 10, QChar('0')));
 | 
			
		||||
                 .arg(VITAMTP_WIRELESS_MAX_VERSION, 8, 10, QChar('0')).toStdString());
 | 
			
		||||
    reply.append('\0');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -117,6 +113,6 @@ void CmaBroadcast::setUnavailable()
 | 
			
		||||
                 .arg(broadcast_unavailable, uuid, "win", hostname)
 | 
			
		||||
                 .arg(protocol_version, 8, 10, QChar('0'))
 | 
			
		||||
                 .arg(QCMA_REQUEST_PORT)
 | 
			
		||||
                 .arg(VITAMTP_WIRELESS_MAX_VERSION, 8, 10, QChar('0')));
 | 
			
		||||
                 .arg(VITAMTP_WIRELESS_MAX_VERSION, 8, 10, QChar('0')).toStdString());
 | 
			
		||||
    reply.append('\0');
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,8 @@
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
#include <QUrl>
 | 
			
		||||
 | 
			
		||||
#include <random>
 | 
			
		||||
 | 
			
		||||
QMutex CmaClient::mutex;
 | 
			
		||||
QMutex CmaClient::runner;
 | 
			
		||||
QWaitCondition CmaClient::usbcondition;
 | 
			
		||||
@@ -92,9 +94,6 @@ void CmaClient::connectWireless()
 | 
			
		||||
    wireless_host_info_t host = {NULL, NULL, NULL, QCMA_REQUEST_PORT};
 | 
			
		||||
    typedef CmaClient CC;
 | 
			
		||||
 | 
			
		||||
    QTime now = QTime::currentTime();
 | 
			
		||||
    qsrand(now.msec());
 | 
			
		||||
 | 
			
		||||
    qDebug("Starting wireless_thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
 | 
			
		||||
 | 
			
		||||
    setActive(true);
 | 
			
		||||
@@ -132,7 +131,7 @@ void CmaClient::processNewConnection(vita_device_t *device)
 | 
			
		||||
    QMutexLocker locker(&mutex);
 | 
			
		||||
    in_progress = true;
 | 
			
		||||
 | 
			
		||||
    QTextStream(stdout) << "Vita connected, id: " << VitaMTP_Get_Identification(device) << endl;
 | 
			
		||||
    QTextStream(stdout) << "Vita connected, id: " << VitaMTP_Get_Identification(device) << Qt::endl;
 | 
			
		||||
    DeviceCapability vita_info;
 | 
			
		||||
 | 
			
		||||
    if(!vita_info.exchangeInfo(device)) {
 | 
			
		||||
@@ -189,6 +188,10 @@ int CmaClient::generatePin(wireless_vita_info_t *info, int *p_err)
 | 
			
		||||
 | 
			
		||||
    QString staticPin = QSettings().value("staticPin").toString();
 | 
			
		||||
 | 
			
		||||
    static std::mt19937 rng(std::random_device{}());
 | 
			
		||||
 | 
			
		||||
    std::uniform_int_distribution<int> dist(0, 99999999);
 | 
			
		||||
 | 
			
		||||
    int pin;
 | 
			
		||||
 | 
			
		||||
    if(!staticPin.isNull() && staticPin.length() == 8) {
 | 
			
		||||
@@ -196,17 +199,17 @@ int CmaClient::generatePin(wireless_vita_info_t *info, int *p_err)
 | 
			
		||||
        pin = staticPin.toInt(&ok);
 | 
			
		||||
 | 
			
		||||
        if(!ok) {
 | 
			
		||||
            pin = rand() % 10000 * 10000 | rand() % 10000;
 | 
			
		||||
            pin = dist(rng);
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        pin = rand() % 10000 * 10000 | rand() % 10000;
 | 
			
		||||
        pin = dist(rng);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QTextStream out(stdout);
 | 
			
		||||
    out << "Your registration PIN for " << info->name << " is: ";
 | 
			
		||||
    out.setFieldWidth(8);
 | 
			
		||||
    out.setPadChar('0');
 | 
			
		||||
    out << pin << endl;
 | 
			
		||||
    out << pin << Qt::endl;
 | 
			
		||||
 | 
			
		||||
    qDebug("PIN: %08i", pin);
 | 
			
		||||
 | 
			
		||||
@@ -262,7 +265,7 @@ void CmaClient::enterEventLoop(vita_device_t *device)
 | 
			
		||||
 | 
			
		||||
int CmaClient::stop()
 | 
			
		||||
{
 | 
			
		||||
    QTextStream(stdout) << "Stopping Qcma" << endl;
 | 
			
		||||
    QTextStream(stdout) << "Stopping Qcma" << Qt::endl;
 | 
			
		||||
 | 
			
		||||
    if(!isActive()) {
 | 
			
		||||
        return -1;
 | 
			
		||||
 
 | 
			
		||||
@@ -649,7 +649,7 @@ void CmaEvent::vitaEventSendHttpObjectFromURL(vita_event_t *cma_event, int event
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    qDebug("Sending %i bytes of data for HTTP request %s", data.size(), url);
 | 
			
		||||
    qDebug() << "Sending " << data.size() << " bytes of data for HTTP request" << url;
 | 
			
		||||
 | 
			
		||||
    if(VitaMTP_SendHttpObjectFromURL(m_device, eventId, data.data(), data.size()) != PTP_RC_OK) {
 | 
			
		||||
        qWarning("Failed to send HTTP object");
 | 
			
		||||
 
 | 
			
		||||
@@ -99,7 +99,7 @@ void CMAObject::loadSfoMetadata(const QString &path)
 | 
			
		||||
            title.chop(1);
 | 
			
		||||
        }
 | 
			
		||||
        metadata.data.saveData.savedataTitle = strdup(title.toStdString().c_str());
 | 
			
		||||
        metadata.data.saveData.dateTimeUpdated = QFileInfo(sfo).created().toUTC().toTime_t();
 | 
			
		||||
        metadata.data.saveData.dateTimeUpdated = QFileInfo(sfo).birthTime().toUTC().toSecsSinceEpoch();
 | 
			
		||||
    } else {
 | 
			
		||||
        metadata.data.saveData.title = strdup(metadata.name);
 | 
			
		||||
        metadata.data.saveData.detail = strdup("");
 | 
			
		||||
@@ -115,7 +115,7 @@ void CMAObject::initObject(const QFileInfo &file, int obj_file_type)
 | 
			
		||||
    metadata.ohfi = ohfi_count++;
 | 
			
		||||
 | 
			
		||||
    metadata.type = VITA_DIR_TYPE_MASK_REGULAR; // ignored for files
 | 
			
		||||
    metadata.dateTimeCreated = file.created().toUTC().toTime_t();
 | 
			
		||||
    metadata.dateTimeCreated = file.birthTime().toUTC().toSecsSinceEpoch();
 | 
			
		||||
    metadata.size = 0;
 | 
			
		||||
    DataType type = file.isFile() ? File : Folder;
 | 
			
		||||
    metadata.dataType = (DataType)(type | (parent->metadata.dataType & ~Folder));
 | 
			
		||||
@@ -142,7 +142,7 @@ void CMAObject::initObject(const QFileInfo &file, int obj_file_type)
 | 
			
		||||
        Database::loadMusicMetadata(file.absoluteFilePath(), metadata);
 | 
			
		||||
    } else if(MASK_SET(metadata.dataType, Video | File)) {
 | 
			
		||||
        metadata.data.video.fileName = strdup(metadata.name);
 | 
			
		||||
        metadata.data.video.dateTimeUpdated = file.created().toUTC().toTime_t();
 | 
			
		||||
        metadata.data.video.dateTimeUpdated = file.birthTime().toUTC().toSecsSinceEpoch();
 | 
			
		||||
        metadata.data.video.statusType = 1;
 | 
			
		||||
        metadata.data.video.fileFormatType = FILE_FORMAT_MP4;
 | 
			
		||||
        metadata.data.video.parentalLevel = 0;
 | 
			
		||||
@@ -160,7 +160,7 @@ void CMAObject::initObject(const QFileInfo &file, int obj_file_type)
 | 
			
		||||
        metadata.data.photo.fileName = strdup(metadata.name);
 | 
			
		||||
        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.dateTimeOriginal = file.birthTime().toUTC().toSecsSinceEpoch();
 | 
			
		||||
        metadata.data.photo.numTracks = 1;
 | 
			
		||||
        metadata.data.photo.tracks = new media_track();
 | 
			
		||||
        metadata.data.photo.tracks->type = VITA_TRACK_TYPE_PHOTO;
 | 
			
		||||
 
 | 
			
		||||
@@ -70,31 +70,7 @@ bool removeRecursively(const QString &path)
 | 
			
		||||
    QFileInfo file_info(path);
 | 
			
		||||
 | 
			
		||||
    if(file_info.isDir()) {
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
        return QDir(path).removeRecursively();
 | 
			
		||||
#else
 | 
			
		||||
        bool result = false;
 | 
			
		||||
        QDir dir(path);
 | 
			
		||||
 | 
			
		||||
        QDir::Filters filter = QDir::NoDotAndDotDot | QDir::System | QDir::Hidden  | QDir::AllDirs | QDir::Files;
 | 
			
		||||
 | 
			
		||||
        if(dir.exists(path)) {
 | 
			
		||||
            foreach(QFileInfo info, dir.entryInfoList(filter, QDir::DirsFirst)) {
 | 
			
		||||
                if(info.isDir()) {
 | 
			
		||||
                    result = removeRecursively(info.absoluteFilePath());
 | 
			
		||||
                } else {
 | 
			
		||||
                    result = QFile::remove(info.absoluteFilePath());
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if(!result) {
 | 
			
		||||
                    return result;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            result = dir.rmdir(path);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return result;
 | 
			
		||||
#endif
 | 
			
		||||
    } else {
 | 
			
		||||
        return QFile::remove(path);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -26,24 +26,7 @@
 | 
			
		||||
 | 
			
		||||
#include <vitamtp.h>
 | 
			
		||||
 | 
			
		||||
// Qt4 doesn't have public methods for Thread::*sleep
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
typedef QThread Sleeper;
 | 
			
		||||
#else
 | 
			
		||||
class Sleeper : QThread
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    static void sleep(unsigned long secs) {
 | 
			
		||||
        QThread::sleep(secs);
 | 
			
		||||
    }
 | 
			
		||||
    static void msleep(unsigned long msecs) {
 | 
			
		||||
        QThread::msleep(msecs);
 | 
			
		||||
    }
 | 
			
		||||
    static void usleep(unsigned long usecs) {
 | 
			
		||||
        QThread::usleep(usecs);
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
bool removeRecursively(const QString &path);
 | 
			
		||||
QString readable_size(qint64 size, bool use_gib = false);
 | 
			
		||||
 
 | 
			
		||||
@@ -52,7 +52,7 @@ const file_type video_list[] = {
 | 
			
		||||
 | 
			
		||||
Database::Database(QObject *obj_parent) :
 | 
			
		||||
    QObject(obj_parent),
 | 
			
		||||
    mutex(QMutex::Recursive)
 | 
			
		||||
    mutex()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -63,7 +63,7 @@ void Database::process()
 | 
			
		||||
    cancel_operation = false;
 | 
			
		||||
    int count = create();
 | 
			
		||||
    cancel_operation = false;
 | 
			
		||||
    QTextStream(stdout) << "Total entries added to the database: " << count << endl;
 | 
			
		||||
    QTextStream(stdout) << "Total entries added to the database: " << count << Qt::endl;
 | 
			
		||||
    if(count < 0) {
 | 
			
		||||
        clear();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,7 @@ public:
 | 
			
		||||
    static void loadPhotoMetadata(const QString &path, metadata_t &metadata);
 | 
			
		||||
    static void loadVideoMetadata(const QString &path, metadata_t &metadata);
 | 
			
		||||
 | 
			
		||||
    QMutex mutex;
 | 
			
		||||
    QRecursiveMutex mutex;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    bool continueOperation();
 | 
			
		||||
 
 | 
			
		||||
@@ -253,7 +253,7 @@ int QListDB::recursiveScanRootDirectory(root_list &list, CMAObject *obj_parent,
 | 
			
		||||
    QFileInfoList qsl = dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot, QDir::Time);
 | 
			
		||||
 | 
			
		||||
    if(obj_parent && !obj_parent->parent) {
 | 
			
		||||
        qSort(qsl.begin(), qsl.end(), nameLessThan);
 | 
			
		||||
        std::sort(qsl.begin(), qsl.end(), nameLessThan);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    foreach(const QFileInfo &info, qsl) {
 | 
			
		||||
@@ -325,7 +325,7 @@ bool QListDB::findInternal(const root_list &list, int ohfi, find_data &data)
 | 
			
		||||
    } else {
 | 
			
		||||
        CMAObject obj;
 | 
			
		||||
        obj.setOhfi(ohfi);
 | 
			
		||||
        data.it = qBinaryFind(list.begin(), list.end(), &obj, QListDB::lessThanComparator);
 | 
			
		||||
        data.it = std::lower_bound(list.begin(), list.end(), &obj, QListDB::lessThanComparator);
 | 
			
		||||
    }
 | 
			
		||||
    data.end = list.end();
 | 
			
		||||
    return data.it != data.end;
 | 
			
		||||
@@ -565,7 +565,7 @@ int QListDB::insertObjectEntry(const QString &path, const QString &name, int par
 | 
			
		||||
 | 
			
		||||
    for(map_list::iterator root = object_list.begin(); root != object_list.end(); ++root) {
 | 
			
		||||
        root_list *cat_list = &(*root);
 | 
			
		||||
        root_list::const_iterator it = qBinaryFind(cat_list->begin(), cat_list->end(), parent_obj, QListDB::lessThanComparator);
 | 
			
		||||
        root_list::iterator it = std::lower_bound(cat_list->begin(), cat_list->end(), parent_obj, QListDB::lessThanComparator);
 | 
			
		||||
 | 
			
		||||
        if(it != cat_list->end()) {
 | 
			
		||||
            CMAObject *newobj = new CMAObject(parent_obj);
 | 
			
		||||
 
 | 
			
		||||
@@ -272,7 +272,7 @@
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../../gui/forms/configwidget.ui" line="273"/>
 | 
			
		||||
        <source><html><head/><body><p align="center"><span style=" font-size:14pt; font-weight:600;">Advanced settings</span></p></body></html></source>
 | 
			
		||||
        <translation><html><head/><body><p align="center"><span style=" font-size:14pt; font-weight:600;">Ajustes Avanzados</span></p></body></html></translation>
 | 
			
		||||
        <translation><html><head/><body><p align="center"><span style=" font-size:14pt; font-weight:600;">高级设置</span></p></body></html></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../../gui/forms/configwidget.ui" line="280"/>
 | 
			
		||||
@@ -430,7 +430,7 @@
 | 
			
		||||
        <location filename="../../../gui/filterlineedit.cpp" line="50"/>
 | 
			
		||||
        <location filename="../../../gui/filterlineedit.cpp" line="71"/>
 | 
			
		||||
        <source>Filter</source>
 | 
			
		||||
        <translation>分类</translation>
 | 
			
		||||
        <translation>过滤</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
</context>
 | 
			
		||||
<context>
 | 
			
		||||
@@ -489,8 +489,8 @@ build hash: %1
 | 
			
		||||
build branch: %2</source>
 | 
			
		||||
        <translation>Copyright (C) 2016  Codestation
 | 
			
		||||
 | 
			
		||||
编译 hash: %1
 | 
			
		||||
编译分支: %2</translation>
 | 
			
		||||
build hash: %1
 | 
			
		||||
build branch: %2</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../../gui/mainwidget.cpp" line="272"/>
 | 
			
		||||
@@ -551,7 +551,7 @@ build branch: %2</source>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../../gui/forms/progressform.ui" line="25"/>
 | 
			
		||||
        <source><html><head/><body><p><span style=" font-size:11pt; font-weight:600;">Reading directory:</span></p></body></html></source>
 | 
			
		||||
        <translation><html><head/><body><p><span style=" font-size:11pt; font-weight:600;">Leyendo directorio:</span></p></body></html></translation>
 | 
			
		||||
        <translation><html><head/><body><p><span style=" font-size:11pt; font-weight:600;">正在读取目录:</span></p></body></html></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../../gui/forms/progressform.ui" line="32"/>
 | 
			
		||||
@@ -561,7 +561,7 @@ build branch: %2</source>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../../gui/forms/progressform.ui" line="39"/>
 | 
			
		||||
        <source><html><head/><body><p><span style=" font-size:11pt; font-weight:600;">Processing file:</span></p></body></html></source>
 | 
			
		||||
        <translation><html><head/><body><p><span style=" font-size:11pt; font-weight:600;">Procesando archivo:</span></p></body></html></translation>
 | 
			
		||||
        <translation><html><head/><body><p><span style=" font-size:11pt; font-weight:600;">处理文件:</span></p></body></html></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../../gui/forms/progressform.ui" line="46"/>
 | 
			
		||||
 
 | 
			
		||||
@@ -29,15 +29,7 @@
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QDir>
 | 
			
		||||
#include <QFileInfo>
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
#include <QStandardPaths>
 | 
			
		||||
#else
 | 
			
		||||
#include <QDesktopServices>
 | 
			
		||||
#define QStandardPaths QDesktopServices
 | 
			
		||||
#define writableLocation storageLocation
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
#include <QSqlQuery>
 | 
			
		||||
 | 
			
		||||
@@ -160,7 +152,7 @@ SQLiteDB::SQLiteDB(QObject *obj_parent) :
 | 
			
		||||
    connect(timer, SIGNAL(timeout()), this, SLOT(process()));
 | 
			
		||||
 | 
			
		||||
    // fetch a configured database path if it exists
 | 
			
		||||
    QString db_path = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
 | 
			
		||||
    QString db_path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
 | 
			
		||||
    db_path = QSettings().value("databasePath", db_path).toString();
 | 
			
		||||
    QDir(QDir::root()).mkpath(db_path);
 | 
			
		||||
 | 
			
		||||
@@ -226,7 +218,7 @@ void SQLiteDB::clear()
 | 
			
		||||
{
 | 
			
		||||
    db.close();
 | 
			
		||||
    //QSqlDatabase::removeDatabase("QSQLITE");
 | 
			
		||||
    QString db_path = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
 | 
			
		||||
    QString db_path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
 | 
			
		||||
    db_path = QSettings().value("databasePath", db_path).toString();
 | 
			
		||||
    QFile(db_path + QDir::separator() + "qcma.sqlite").remove();
 | 
			
		||||
    load();
 | 
			
		||||
@@ -529,13 +521,13 @@ bool SQLiteDB::insertSourceEntry(uint object_id, const QString &path, const QStr
 | 
			
		||||
    QFileInfo info(path, name);
 | 
			
		||||
    if(info.isFile()) {
 | 
			
		||||
        size = QVariant(info.size());
 | 
			
		||||
        date_created = QVariant(info.created().toUTC().toTime_t());
 | 
			
		||||
        date_created = QVariant(info.birthTime().toUTC().toSecsSinceEpoch());
 | 
			
		||||
    } else {
 | 
			
		||||
        size = QVariant(QVariant::LongLong);
 | 
			
		||||
        date_created = QVariant(QVariant::UInt);
 | 
			
		||||
        size = QVariant(static_cast<qint64>(0));
 | 
			
		||||
        date_created = QVariant(static_cast<qint64>(0));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    date_modified = QVariant(info.lastModified().toUTC().toTime_t());
 | 
			
		||||
    date_modified = QVariant(info.lastModified().toUTC().toSecsSinceEpoch());
 | 
			
		||||
 | 
			
		||||
    QSqlQuery query;
 | 
			
		||||
    query.prepare("REPLACE INTO sources (object_id, path, size, date_created, date_modified)"
 | 
			
		||||
@@ -662,10 +654,10 @@ uint SQLiteDB::insertMusicEntry(const QString &path, const QString &name, int id
 | 
			
		||||
    query.bindValue(2, audio_codec);
 | 
			
		||||
    query.bindValue(3, audio_bitrate);
 | 
			
		||||
    query.bindValue(4, duration);
 | 
			
		||||
    query.bindValue(5, genre_id ? genre_id : QVariant(QVariant::Int));
 | 
			
		||||
    query.bindValue(6, artist_id ? artist_id : QVariant(QVariant::Int));
 | 
			
		||||
    query.bindValue(7, album_id ? album_id : QVariant(QVariant::Int));
 | 
			
		||||
    query.bindValue(8, track_id ? track_id : QVariant(QVariant::Int));
 | 
			
		||||
    query.bindValue(5, genre_id ? genre_id : QVariant(static_cast<int>(0)));
 | 
			
		||||
    query.bindValue(6, artist_id ? artist_id : QVariant(static_cast<int>(0)));
 | 
			
		||||
    query.bindValue(7, album_id ? album_id : QVariant(static_cast<int>(0)));
 | 
			
		||||
    query.bindValue(8, track_id ? track_id : QVariant(static_cast<int>(0)));
 | 
			
		||||
    query.bindValue(9, artist);
 | 
			
		||||
    query.bindValue(10, album);
 | 
			
		||||
    query.bindValue(11, track_number);
 | 
			
		||||
@@ -775,8 +767,8 @@ uint SQLiteDB::insertPhotoEntry(const QString &path, const QString &name, int id
 | 
			
		||||
    //    return 0;
 | 
			
		||||
    //}
 | 
			
		||||
 | 
			
		||||
    QDateTime date = QFileInfo(path + "/" + name).created();
 | 
			
		||||
    date_created = date.toUTC().toTime_t();
 | 
			
		||||
    QDateTime date = QFileInfo(path + "/" + name).birthTime();
 | 
			
		||||
    date_created = date.toUTC().toSecsSinceEpoch();
 | 
			
		||||
    QString month_created = date.toString("yyyy/MM");
 | 
			
		||||
 | 
			
		||||
    width = 0; //img.width();
 | 
			
		||||
@@ -826,7 +818,7 @@ uint SQLiteDB::insertSavedataEntry(const QString &path, const QString &name, int
 | 
			
		||||
        title = reader.value("TITLE", utf8name.constData());
 | 
			
		||||
        savedata_detail = reader.value("SAVEDATA_DETAIL", "");
 | 
			
		||||
        savedata_directory = reader.value("SAVEDATA_DIRECTORY", utf8name.constData());
 | 
			
		||||
        date_updated = QFileInfo(path + "/" + name).lastModified().toUTC().toTime_t();
 | 
			
		||||
        date_updated = QFileInfo(path + "/" + name).lastModified().toUTC().toSecsSinceEpoch();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if((ohfi = insertDefaultEntry(path, name, title, id_parent, type)) == 0) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
VERSION = 0.4.1
 | 
			
		||||
VERSION = 0.4.2
 | 
			
		||||
 | 
			
		||||
# enable pkg-config on osx/windows
 | 
			
		||||
QT_CONFIG -= no-pkg-config
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +1,9 @@
 | 
			
		||||
qcma (0.4.2) unstable; urgency=low
 | 
			
		||||
 | 
			
		||||
  * Fix on ffmpeg compilation
 | 
			
		||||
 | 
			
		||||
 -- codestation <codestation404@gmail.com>  Wed, 26 Dec 2018 00:00:00 -0000
 | 
			
		||||
 | 
			
		||||
qcma (0.4.1) unstable; urgency=low
 | 
			
		||||
 | 
			
		||||
  * Do not reescan database automatically while transferring files.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							@@ -9,8 +9,8 @@ Build-Depends:
 | 
			
		||||
 debhelper (>= 9),
 | 
			
		||||
 libavformat-dev,
 | 
			
		||||
 libswscale-dev,
 | 
			
		||||
 qtbase5-dev,
 | 
			
		||||
 qttools5-dev-tools,
 | 
			
		||||
 qt6-base-dev,
 | 
			
		||||
 qt6-tools-dev-tools,
 | 
			
		||||
 libnotify-dev,
 | 
			
		||||
 libgtk2.0-dev,
 | 
			
		||||
 pkg-config,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								debian/rules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								debian/rules
									
									
									
									
										vendored
									
									
								
							@@ -4,7 +4,7 @@
 | 
			
		||||
#export DH_VERBOSE=1
 | 
			
		||||
 | 
			
		||||
# see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773686
 | 
			
		||||
export QT_SELECT=qt5
 | 
			
		||||
export QT_SELECT=qt6
 | 
			
		||||
 | 
			
		||||
%:
 | 
			
		||||
	dh $@ --buildsystem=qmake
 | 
			
		||||
 
 | 
			
		||||
@@ -62,7 +62,7 @@ void BackupItem::removeEntry()
 | 
			
		||||
    emit deleteEntry(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const QPixmap *BackupItem::getIconPixmap()
 | 
			
		||||
const QPixmap BackupItem::getIconPixmap()
 | 
			
		||||
{
 | 
			
		||||
    return ui->itemPicture->pixmap();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ public:
 | 
			
		||||
    void setItemInfo(const QString &name, const QString &size, const QString &extra);
 | 
			
		||||
    void setItemIcon(const QString &m_path, int width = 48, bool try_dds = false);
 | 
			
		||||
    void setDirectory(const QString &m_path);
 | 
			
		||||
    const QPixmap *getIconPixmap();
 | 
			
		||||
    const QPixmap getIconPixmap();
 | 
			
		||||
    int getIconWidth();
 | 
			
		||||
    QString getPath();
 | 
			
		||||
    QString getSize();
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,6 @@
 | 
			
		||||
 | 
			
		||||
#include "backupmanagerform.h"
 | 
			
		||||
#include "ui_backupmanagerform.h"
 | 
			
		||||
#include "cmaobject.h"
 | 
			
		||||
#include "sforeader.h"
 | 
			
		||||
#include "confirmdialog.h"
 | 
			
		||||
#include "cmautils.h"
 | 
			
		||||
@@ -90,7 +89,7 @@ void BackupManagerForm::removeEntry(BackupItem *item)
 | 
			
		||||
    ConfirmDialog msgBox;
 | 
			
		||||
 | 
			
		||||
    msgBox.setMessageText(tr("Are you sure to remove the backup of the following entry?"), item->title);
 | 
			
		||||
    msgBox.setMessagePixmap(*item->getIconPixmap(), item->getIconWidth());
 | 
			
		||||
    msgBox.setMessagePixmap(item->getIconPixmap(), item->getIconWidth());
 | 
			
		||||
 | 
			
		||||
    if(msgBox.exec() == 0) {
 | 
			
		||||
        return;
 | 
			
		||||
@@ -190,11 +189,7 @@ void BackupManagerForm::loadBackupListing(int index)
 | 
			
		||||
    // adjust the table item width to fill all the widget
 | 
			
		||||
    QHeaderView *vert_header = ui->tableWidget->verticalHeader();
 | 
			
		||||
    QHeaderView *horiz_header = ui->tableWidget->horizontalHeader();
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
    horiz_header->setSectionResizeMode(QHeaderView::Stretch);
 | 
			
		||||
#else
 | 
			
		||||
    horiz_header->setResizeMode(QHeaderView::Stretch);
 | 
			
		||||
#endif
 | 
			
		||||
    qint64 backup_size = m_db->getObjectSize(ohfi);
 | 
			
		||||
    setBackupUsage(backup_size);
 | 
			
		||||
    QString path = m_db->getAbsolutePath(ohfi);
 | 
			
		||||
@@ -254,7 +249,7 @@ void BackupManagerForm::loadBackupListing(int index)
 | 
			
		||||
 | 
			
		||||
    m_db->freeMetadata(first);
 | 
			
		||||
 | 
			
		||||
    qSort(item_list.begin(), item_list.end(), BackupItem::lessThan);
 | 
			
		||||
    std::sort(item_list.begin(), item_list.end(), BackupItem::lessThan);
 | 
			
		||||
 | 
			
		||||
    int row;
 | 
			
		||||
    QList<BackupItem *>::iterator it;
 | 
			
		||||
 
 | 
			
		||||
@@ -26,14 +26,7 @@ extern "C" {
 | 
			
		||||
 | 
			
		||||
#include <QFileDialog>
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
#include <QStandardPaths>
 | 
			
		||||
#else
 | 
			
		||||
#include <QDesktopServices>
 | 
			
		||||
#define QStandardPaths QDesktopServices
 | 
			
		||||
#define writableLocation storageLocation
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
ConfigWidget::ConfigWidget(QWidget *obj_parent) :
 | 
			
		||||
    QDialog(obj_parent),
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@
 | 
			
		||||
#include "ui_pinform.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QDesktopWidget>
 | 
			
		||||
#include <QScreen>
 | 
			
		||||
 | 
			
		||||
const QString PinForm::pinFormat =
 | 
			
		||||
    "<html><head/><body>"
 | 
			
		||||
@@ -33,7 +33,10 @@ PinForm::PinForm(QWidget *obj_parent) :
 | 
			
		||||
    ui(new Ui::PinForm)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
    move(QApplication::desktop()->screen()->rect().center() - rect().center());
 | 
			
		||||
    if (QScreen *screen = QGuiApplication::primaryScreen()) {
 | 
			
		||||
        QRect screenGeometry = screen->geometry();
 | 
			
		||||
        move(screenGeometry.center() - rect().center());
 | 
			
		||||
    }
 | 
			
		||||
    setFixedSize(size());
 | 
			
		||||
    setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
 | 
			
		||||
    connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(hide()));
 | 
			
		||||
 
 | 
			
		||||
@@ -20,15 +20,18 @@
 | 
			
		||||
#include "progressform.h"
 | 
			
		||||
#include "ui_progressform.h"
 | 
			
		||||
 | 
			
		||||
#include <QDesktopWidget>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
#include <QScreen>
 | 
			
		||||
 | 
			
		||||
ProgressForm::ProgressForm(QWidget *obj_parent) :
 | 
			
		||||
    QWidget(obj_parent),
 | 
			
		||||
    ui(new Ui::ProgressForm)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
    move(QApplication::desktop()->screen()->rect().center() - rect().center());
 | 
			
		||||
    if (QScreen *screen = QGuiApplication::primaryScreen()) {
 | 
			
		||||
        QRect screenGeometry = screen->geometry();
 | 
			
		||||
        move(screenGeometry.center() - rect().center());
 | 
			
		||||
    }
 | 
			
		||||
    setFixedSize(size());
 | 
			
		||||
    setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
 | 
			
		||||
    connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(cancelConfirm()));
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										21
									
								
								gui/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								gui/main.cpp
									
									
									
									
									
								
							@@ -24,7 +24,6 @@
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QLibraryInfo>
 | 
			
		||||
#include <QLocale>
 | 
			
		||||
#include <QTextCodec>
 | 
			
		||||
#include <QTextStream>
 | 
			
		||||
#include <QThread>
 | 
			
		||||
#include <QTranslator>
 | 
			
		||||
@@ -34,14 +33,9 @@
 | 
			
		||||
#include "singleapplication.h"
 | 
			
		||||
#include "mainwidget.h"
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
static void noMessageOutput(QtMsgType type, const QMessageLogContext &, const QString & str)
 | 
			
		||||
{
 | 
			
		||||
    const char * msg = str.toStdString().c_str();
 | 
			
		||||
#else
 | 
			
		||||
static void noMessageOutput(QtMsgType type, const char *msg)
 | 
			
		||||
{
 | 
			
		||||
#endif
 | 
			
		||||
    Q_UNUSED(type);
 | 
			
		||||
    Q_UNUSED(msg);
 | 
			
		||||
}
 | 
			
		||||
@@ -102,18 +96,10 @@ int main(int argc, char *argv[])
 | 
			
		||||
        VitaMTP_Set_Logging(VitaMTP_VERBOSE);
 | 
			
		||||
    } else {
 | 
			
		||||
        VitaMTP_Set_Logging(VitaMTP_NONE);
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
        qInstallMessageHandler(noMessageOutput);
 | 
			
		||||
#else
 | 
			
		||||
        qInstallMsgHandler(noMessageOutput);
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    QTextStream(stdout) << "Starting Qcma " << QCMA_VER << endl;
 | 
			
		||||
    QTextStream(stdout) << "Starting Qcma " << QCMA_VER << Qt::endl;
 | 
			
		||||
 | 
			
		||||
    QTranslator translator;
 | 
			
		||||
    QString locale = QLocale().system().name();
 | 
			
		||||
@@ -134,8 +120,11 @@ int main(int argc, char *argv[])
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QTranslator system_translator;
 | 
			
		||||
    system_translator.load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
 | 
			
		||||
    if(!system_translator.load("qt_" + locale, QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
 | 
			
		||||
        qWarning() << "Cannot load system translation for locale:" << locale;
 | 
			
		||||
    } else {
 | 
			
		||||
        app.installTranslator(&system_translator);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    qDebug("Starting main thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -25,12 +25,6 @@
 | 
			
		||||
 | 
			
		||||
#include "trayindicator_global.h"
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
// in Qt4 signals are protected
 | 
			
		||||
#undef signals
 | 
			
		||||
#define signals public
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
class TrayIndicator : public QWidget
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user