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
|
*.bundle
|
||||||
org.qcma.*.xml
|
org.qcma.*.xml
|
||||||
buildscripts/windows/driver/QcmaDriver_*.exe
|
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).
|
* Easy wireless pairing (show PIN to the user when a Vita is detected).
|
||||||
* Ability to restart the connection if the Vita is reconnected.
|
* 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
|
## Headless version
|
||||||
|
|
||||||
There is a qcma_cli binary that doesn't need a X session running (useful for servers).
|
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)
|
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
|
## 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)
|
* [VitaMTP fork](https://github.com/codestation/vitamtp)
|
||||||
|
|
||||||
@@ -52,10 +53,6 @@ kill $(pgrep qcma_cli)
|
|||||||
|
|
||||||
* [libnotify](http://library.gnome.org/devel/notification-spec/)
|
* [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?
|
#### Where do I get the source code?
|
||||||
Check the GitHub repo here: https://github.com/codestation/qcma
|
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:
|
case QtFatalMsg:
|
||||||
__android_log_print(ANDROID_LOG_FATAL, "qcma", "%s", message);
|
__android_log_print(ANDROID_LOG_FATAL, "qcma", "%s", message);
|
||||||
abort();
|
abort();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
|
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
__android_log_print(ANDROID_LOG_INFO, "qcma", "%s", message);
|
__android_log_print(ANDROID_LOG_INFO, "qcma", "%s", message);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# qcma spec file
|
# qcma spec file
|
||||||
#
|
#
|
||||||
|
|
||||||
%define _version 0.4.1
|
%define _version 0.4.2
|
||||||
|
|
||||||
%if "%{_version}" == "testing" || "%{_version}" == "master"
|
%if "%{_version}" == "testing" || "%{_version}" == "master"
|
||||||
%define _verprefix %{_version}
|
%define _verprefix %{_version}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
!define PRODUCT_EXE_NAME "qcma.exe"
|
!define PRODUCT_EXE_NAME "qcma.exe"
|
||||||
!define PRODUCT_VERSION_MAJOR 0
|
!define PRODUCT_VERSION_MAJOR 0
|
||||||
!define PRODUCT_VERSION_MINOR 4
|
!define PRODUCT_VERSION_MINOR 4
|
||||||
!define PRODUCT_VERSION_BUILD 1
|
!define PRODUCT_VERSION_BUILD 2
|
||||||
!define PRODUCT_PUBLISHER "codestation"
|
!define PRODUCT_PUBLISHER "codestation"
|
||||||
!define PRODUCT_WEB_SITE "https://github.com/codestation/qcma"
|
!define PRODUCT_WEB_SITE "https://github.com/codestation/qcma"
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ void HeadlessManager::refreshDatabase()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream(stdout) << "Database scan has started" << endl;
|
QTextStream(stdout) << "Database scan has started" << Qt::endl;
|
||||||
|
|
||||||
if(!m_db->rescan()) {
|
if(!m_db->rescan()) {
|
||||||
qWarning("No PS Vita system has been registered");
|
qWarning("No PS Vita system has been registered");
|
||||||
@@ -136,7 +136,7 @@ void HeadlessManager::start()
|
|||||||
|
|
||||||
void HeadlessManager::receiveMessage(QString message)
|
void HeadlessManager::receiveMessage(QString message)
|
||||||
{
|
{
|
||||||
QTextStream(stdout) << message << endl;
|
QTextStream(stdout) << message << Qt::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeadlessManager::stop()
|
void HeadlessManager::stop()
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QTextCodec>
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
@@ -35,15 +34,10 @@
|
|||||||
#include "singlecoreapplication.h"
|
#include "singlecoreapplication.h"
|
||||||
#include "headlessmanager.h"
|
#include "headlessmanager.h"
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
static void noDebugOutput(QtMsgType type, const QMessageLogContext &, const QString & msg)
|
static void noDebugOutput(QtMsgType type, const QMessageLogContext &, const QString & msg)
|
||||||
{
|
{
|
||||||
QByteArray localMsg = msg.toLocal8Bit();
|
QByteArray localMsg = msg.toLocal8Bit();
|
||||||
const char *message = localMsg.constData();
|
const char *message = localMsg.constData();
|
||||||
#else
|
|
||||||
static void noDebugOutput(QtMsgType type, const char *message)
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
break;
|
break;
|
||||||
@@ -57,11 +51,9 @@ static void noDebugOutput(QtMsgType type, const char *message)
|
|||||||
fprintf(stderr, "Fatal: %s\n", message);
|
fprintf(stderr, "Fatal: %s\n", message);
|
||||||
abort();
|
abort();
|
||||||
break;
|
break;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
|
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
fprintf(stderr, "Info: %s\n", message);
|
fprintf(stderr, "Info: %s\n", message);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +97,7 @@ int main(int argc, char *argv[])
|
|||||||
Q_INIT_RESOURCE(translations);
|
Q_INIT_RESOURCE(translations);
|
||||||
|
|
||||||
if(SingleCoreApplication::sendMessage("Another instance of Qcma tried to start")) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,18 +117,10 @@ int main(int argc, char *argv[])
|
|||||||
VitaMTP_Set_Logging(VitaMTP_VERBOSE);
|
VitaMTP_Set_Logging(VitaMTP_VERBOSE);
|
||||||
} else {
|
} else {
|
||||||
VitaMTP_Set_Logging(VitaMTP_NONE);
|
VitaMTP_Set_Logging(VitaMTP_NONE);
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
qInstallMessageHandler(noDebugOutput);
|
qInstallMessageHandler(noDebugOutput);
|
||||||
#else
|
|
||||||
qInstallMsgHandler(noDebugOutput);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
QTextStream(stdout) << "Starting Qcma " << QCMA_VER << Qt::endl;
|
||||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QTextStream(stdout) << "Starting Qcma " << QCMA_VER << endl;
|
|
||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
QString locale = QLocale().system().name();
|
QString locale = QLocale().system().name();
|
||||||
@@ -157,8 +141,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
QTranslator system_translator;
|
QTranslator system_translator;
|
||||||
system_translator.load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
if(!system_translator.load("qt_" + locale, QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
|
||||||
app.installTranslator(&system_translator);
|
qWarning() << "Cannot load system translation for locale:" << locale;
|
||||||
|
} else {
|
||||||
|
app.installTranslator(&system_translator);
|
||||||
|
}
|
||||||
|
|
||||||
qDebug("Starting main thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
|
qDebug("Starting main thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ AVDecoder::AVDecoder() :
|
|||||||
AVDecoder::~AVDecoder()
|
AVDecoder::~AVDecoder()
|
||||||
{
|
{
|
||||||
if(pCodecCtx) {
|
if(pCodecCtx) {
|
||||||
avcodec_close(pCodecCtx);
|
avcodec_free_context(&pCodecCtx);
|
||||||
}
|
}
|
||||||
if(pFormatCtx) {
|
if(pFormatCtx) {
|
||||||
avformat_close_input(&pFormatCtx);
|
avformat_close_input(&pFormatCtx);
|
||||||
@@ -70,9 +70,17 @@ bool AVDecoder::loadCodec(codec_type codec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
av_stream = pFormatCtx->streams[stream_index];
|
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) {
|
if(avcodec_open2(pCodecCtx, av_codec, &opts) < 0) {
|
||||||
|
avcodec_free_context(&pCodecCtx);
|
||||||
codec_loaded = false;
|
codec_loaded = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -128,36 +136,35 @@ void AVDecoder::getVideoMetadata(metadata_t &metadata)
|
|||||||
|
|
||||||
AVFrame *AVDecoder::getDecodedFrame(AVCodecContext *codec_ctx, int frame_stream_index)
|
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();
|
AVFrame *pFrame = av_frame_alloc();
|
||||||
#else
|
|
||||||
AVFrame *pFrame = avcodec_alloc_frame();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
AVPacket packet;
|
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) {
|
if (packet.stream_index == frame_stream_index) {
|
||||||
avcodec_decode_video2(codec_ctx, pFrame, &frame_finished, &packet);
|
ret = avcodec_send_packet(codec_ctx, &packet);
|
||||||
|
av_packet_unref(&packet);
|
||||||
|
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 LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,7,0)
|
|
||||||
av_packet_unref(&packet);
|
|
||||||
#else
|
|
||||||
av_free_packet(&packet);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(frame_finished) {
|
av_frame_free(&pFrame);
|
||||||
return pFrame;
|
return NULL;
|
||||||
} else {
|
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
|
|
||||||
av_frame_free(&pFrame);
|
|
||||||
#else
|
|
||||||
avcodec_free_frame(&pFrame);
|
|
||||||
#endif
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -215,11 +222,7 @@ QByteArray AVDecoder::getThumbnail(int &width, int &height)
|
|||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
data = WriteJPEG(pCodecCtx, pFrame, width, height);
|
data = WriteJPEG(pCodecCtx, pFrame, width, height);
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
|
|
||||||
av_frame_free(&pFrame);
|
av_frame_free(&pFrame);
|
||||||
#else
|
|
||||||
avcodec_free_frame(&pFrame);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
@@ -227,8 +230,8 @@ QByteArray AVDecoder::getThumbnail(int &width, int &height)
|
|||||||
|
|
||||||
QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int width, int height)
|
QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int width, int height)
|
||||||
{
|
{
|
||||||
AVCodecContext *pOCodecCtx;
|
AVCodecContext *pOCodecCtx = nullptr;
|
||||||
AVCodec *pOCodec;
|
const AVCodec *pOCodec;
|
||||||
|
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
|
|
||||||
@@ -249,44 +252,24 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
|
|
||||||
AVFrame *pFrameRGB = av_frame_alloc();
|
AVFrame *pFrameRGB = av_frame_alloc();
|
||||||
#else
|
|
||||||
AVFrame *pFrameRGB = avcodec_alloc_frame();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(pFrameRGB == NULL) {
|
if(pFrameRGB == NULL) {
|
||||||
sws_freeContext(sws_ctx);
|
sws_freeContext(sws_ctx);
|
||||||
return data;
|
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);
|
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);
|
uint8_t *buffer = (uint8_t *)av_malloc(numBytes);
|
||||||
|
|
||||||
if(!buffer) {
|
if(!buffer) {
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
|
|
||||||
av_frame_free(&pFrameRGB);
|
av_frame_free(&pFrameRGB);
|
||||||
#else
|
|
||||||
avcodec_free_frame(&pFrameRGB);
|
|
||||||
#endif
|
|
||||||
sws_freeContext(sws_ctx);
|
sws_freeContext(sws_ctx);
|
||||||
return data;
|
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);
|
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_scale(
|
||||||
sws_ctx,
|
sws_ctx,
|
||||||
@@ -301,20 +284,10 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int
|
|||||||
pOCodecCtx = avcodec_alloc_context3(pOCodec);
|
pOCodecCtx = avcodec_alloc_context3(pOCodec);
|
||||||
|
|
||||||
if(pOCodecCtx == NULL) {
|
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);
|
av_free(buffer);
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
|
|
||||||
av_frame_free(&pFrameRGB);
|
av_frame_free(&pFrameRGB);
|
||||||
#else
|
|
||||||
avcodec_free_frame(&pFrameRGB);
|
|
||||||
#endif
|
|
||||||
sws_freeContext(sws_ctx);
|
sws_freeContext(sws_ctx);
|
||||||
return 0;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
pOCodecCtx->bit_rate = pCodecCtx->bit_rate;
|
pOCodecCtx->bit_rate = pCodecCtx->bit_rate;
|
||||||
@@ -329,20 +302,11 @@ QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int
|
|||||||
|
|
||||||
AVDictionary *opts = NULL;
|
AVDictionary *opts = NULL;
|
||||||
if(avcodec_open2(pOCodecCtx, pOCodec, &opts) < 0) {
|
if(avcodec_open2(pOCodecCtx, pOCodec, &opts) < 0) {
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,52,0)
|
|
||||||
avcodec_free_context(&pOCodecCtx);
|
avcodec_free_context(&pOCodecCtx);
|
||||||
#else
|
|
||||||
avcodec_close(pOCodecCtx);
|
|
||||||
av_free(pOCodecCtx);
|
|
||||||
#endif
|
|
||||||
av_free(buffer);
|
av_free(buffer);
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
|
|
||||||
av_frame_free(&pFrameRGB);
|
av_frame_free(&pFrameRGB);
|
||||||
#else
|
|
||||||
avcodec_free_frame(&pFrameRGB);
|
|
||||||
#endif
|
|
||||||
sws_freeContext(sws_ctx);
|
sws_freeContext(sws_ctx);
|
||||||
return 0;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
av_opt_set_int(pOCodecCtx, "lmin", pOCodecCtx->qmin * FF_QP2LAMBDA, 0);
|
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->flags = AV_CODEC_FLAG_QSCALE;
|
||||||
pOCodecCtx->global_quality = pOCodecCtx->qmin * FF_QP2LAMBDA;
|
pOCodecCtx->global_quality = pOCodecCtx->qmin * FF_QP2LAMBDA;
|
||||||
|
|
||||||
pFrame->pts = 1;
|
pFrameRGB->pts = 1;
|
||||||
pFrame->quality = pOCodecCtx->global_quality;
|
pFrameRGB->quality = pOCodecCtx->global_quality;
|
||||||
|
|
||||||
AVPacket pkt;
|
AVPacket* pkt = av_packet_alloc();
|
||||||
av_init_packet(&pkt);
|
if (!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)
|
|
||||||
avcodec_free_context(&pOCodecCtx);
|
avcodec_free_context(&pOCodecCtx);
|
||||||
#else
|
av_free(buffer);
|
||||||
avcodec_close(pOCodecCtx);
|
av_frame_free(&pFrameRGB);
|
||||||
av_free(pOCodecCtx);
|
sws_freeContext(sws_ctx);
|
||||||
#endif
|
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);
|
||||||
av_free(buffer);
|
av_free(buffer);
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
|
|
||||||
av_frame_free(&pFrameRGB);
|
av_frame_free(&pFrameRGB);
|
||||||
#else
|
|
||||||
avcodec_free_frame(&pFrameRGB);
|
|
||||||
#endif
|
|
||||||
avcodec_close(pOCodecCtx);
|
|
||||||
sws_freeContext(sws_ctx);
|
sws_freeContext(sws_ctx);
|
||||||
|
|
||||||
return buffer2;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AVDecoder::close()
|
void AVDecoder::close()
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ public:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AvInit() {
|
AvInit() {
|
||||||
av_register_all();
|
|
||||||
// hide warning logs
|
// hide warning logs
|
||||||
av_log_set_level(AV_LOG_ERROR);
|
av_log_set_level(AV_LOG_ERROR);
|
||||||
}
|
}
|
||||||
@@ -87,7 +86,7 @@ private:
|
|||||||
AVFormatContext *pFormatCtx;
|
AVFormatContext *pFormatCtx;
|
||||||
AVCodecContext *pCodecCtx;
|
AVCodecContext *pCodecCtx;
|
||||||
AVStream *av_stream;
|
AVStream *av_stream;
|
||||||
AVCodec *av_codec;
|
const AVCodec *av_codec;
|
||||||
int stream_index;
|
int stream_index;
|
||||||
bool codec_loaded;
|
bool codec_loaded;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -62,11 +62,7 @@ CmaBroadcast::CmaBroadcast(QObject *obj_parent) :
|
|||||||
socket = new QUdpSocket(this);
|
socket = new QUdpSocket(this);
|
||||||
connect(socket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));
|
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);
|
QHostAddress host_address(QHostAddress::AnyIPv4);
|
||||||
#endif
|
|
||||||
|
|
||||||
if(!socket->bind(host_address, QCMA_REQUEST_PORT, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint)) {
|
if(!socket->bind(host_address, QCMA_REQUEST_PORT, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint)) {
|
||||||
qCritical() << "Failed to bind address for UDP broadcast";
|
qCritical() << "Failed to bind address for UDP broadcast";
|
||||||
@@ -88,7 +84,7 @@ void CmaBroadcast::readPendingDatagrams()
|
|||||||
QMutexLocker locker(&mutex);
|
QMutexLocker locker(&mutex);
|
||||||
socket->writeDatagram(reply, cma_sender, senderPort);
|
socket->writeDatagram(reply, cma_sender, senderPort);
|
||||||
} else {
|
} 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(broadcast_ok, uuid, "win", hostname)
|
||||||
.arg(protocol_version, 8, 10, QChar('0'))
|
.arg(protocol_version, 8, 10, QChar('0'))
|
||||||
.arg(QCMA_REQUEST_PORT)
|
.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');
|
reply.append('\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,6 +113,6 @@ void CmaBroadcast::setUnavailable()
|
|||||||
.arg(broadcast_unavailable, uuid, "win", hostname)
|
.arg(broadcast_unavailable, uuid, "win", hostname)
|
||||||
.arg(protocol_version, 8, 10, QChar('0'))
|
.arg(protocol_version, 8, 10, QChar('0'))
|
||||||
.arg(QCMA_REQUEST_PORT)
|
.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');
|
reply.append('\0');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
#include <random>
|
||||||
|
|
||||||
QMutex CmaClient::mutex;
|
QMutex CmaClient::mutex;
|
||||||
QMutex CmaClient::runner;
|
QMutex CmaClient::runner;
|
||||||
QWaitCondition CmaClient::usbcondition;
|
QWaitCondition CmaClient::usbcondition;
|
||||||
@@ -92,9 +94,6 @@ void CmaClient::connectWireless()
|
|||||||
wireless_host_info_t host = {NULL, NULL, NULL, QCMA_REQUEST_PORT};
|
wireless_host_info_t host = {NULL, NULL, NULL, QCMA_REQUEST_PORT};
|
||||||
typedef CmaClient CC;
|
typedef CmaClient CC;
|
||||||
|
|
||||||
QTime now = QTime::currentTime();
|
|
||||||
qsrand(now.msec());
|
|
||||||
|
|
||||||
qDebug("Starting wireless_thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
|
qDebug("Starting wireless_thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
|
||||||
|
|
||||||
setActive(true);
|
setActive(true);
|
||||||
@@ -132,7 +131,7 @@ void CmaClient::processNewConnection(vita_device_t *device)
|
|||||||
QMutexLocker locker(&mutex);
|
QMutexLocker locker(&mutex);
|
||||||
in_progress = true;
|
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;
|
DeviceCapability vita_info;
|
||||||
|
|
||||||
if(!vita_info.exchangeInfo(device)) {
|
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();
|
QString staticPin = QSettings().value("staticPin").toString();
|
||||||
|
|
||||||
|
static std::mt19937 rng(std::random_device{}());
|
||||||
|
|
||||||
|
std::uniform_int_distribution<int> dist(0, 99999999);
|
||||||
|
|
||||||
int pin;
|
int pin;
|
||||||
|
|
||||||
if(!staticPin.isNull() && staticPin.length() == 8) {
|
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);
|
pin = staticPin.toInt(&ok);
|
||||||
|
|
||||||
if(!ok) {
|
if(!ok) {
|
||||||
pin = rand() % 10000 * 10000 | rand() % 10000;
|
pin = dist(rng);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pin = rand() % 10000 * 10000 | rand() % 10000;
|
pin = dist(rng);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream out(stdout);
|
QTextStream out(stdout);
|
||||||
out << "Your registration PIN for " << info->name << " is: ";
|
out << "Your registration PIN for " << info->name << " is: ";
|
||||||
out.setFieldWidth(8);
|
out.setFieldWidth(8);
|
||||||
out.setPadChar('0');
|
out.setPadChar('0');
|
||||||
out << pin << endl;
|
out << pin << Qt::endl;
|
||||||
|
|
||||||
qDebug("PIN: %08i", pin);
|
qDebug("PIN: %08i", pin);
|
||||||
|
|
||||||
@@ -262,7 +265,7 @@ void CmaClient::enterEventLoop(vita_device_t *device)
|
|||||||
|
|
||||||
int CmaClient::stop()
|
int CmaClient::stop()
|
||||||
{
|
{
|
||||||
QTextStream(stdout) << "Stopping Qcma" << endl;
|
QTextStream(stdout) << "Stopping Qcma" << Qt::endl;
|
||||||
|
|
||||||
if(!isActive()) {
|
if(!isActive()) {
|
||||||
return -1;
|
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) {
|
if(VitaMTP_SendHttpObjectFromURL(m_device, eventId, data.data(), data.size()) != PTP_RC_OK) {
|
||||||
qWarning("Failed to send HTTP object");
|
qWarning("Failed to send HTTP object");
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ void CMAObject::loadSfoMetadata(const QString &path)
|
|||||||
title.chop(1);
|
title.chop(1);
|
||||||
}
|
}
|
||||||
metadata.data.saveData.savedataTitle = strdup(title.toStdString().c_str());
|
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 {
|
} else {
|
||||||
metadata.data.saveData.title = strdup(metadata.name);
|
metadata.data.saveData.title = strdup(metadata.name);
|
||||||
metadata.data.saveData.detail = strdup("");
|
metadata.data.saveData.detail = strdup("");
|
||||||
@@ -115,7 +115,7 @@ void CMAObject::initObject(const QFileInfo &file, int obj_file_type)
|
|||||||
metadata.ohfi = ohfi_count++;
|
metadata.ohfi = ohfi_count++;
|
||||||
|
|
||||||
metadata.type = VITA_DIR_TYPE_MASK_REGULAR; // ignored for files
|
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;
|
metadata.size = 0;
|
||||||
DataType type = file.isFile() ? File : Folder;
|
DataType type = file.isFile() ? File : Folder;
|
||||||
metadata.dataType = (DataType)(type | (parent->metadata.dataType & ~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);
|
Database::loadMusicMetadata(file.absoluteFilePath(), metadata);
|
||||||
} else if(MASK_SET(metadata.dataType, Video | File)) {
|
} else if(MASK_SET(metadata.dataType, Video | File)) {
|
||||||
metadata.data.video.fileName = strdup(metadata.name);
|
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.statusType = 1;
|
||||||
metadata.data.video.fileFormatType = FILE_FORMAT_MP4;
|
metadata.data.video.fileFormatType = FILE_FORMAT_MP4;
|
||||||
metadata.data.video.parentalLevel = 0;
|
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.fileName = strdup(metadata.name);
|
||||||
metadata.data.photo.fileFormatType = photo_list[obj_file_type].file_format;
|
metadata.data.photo.fileFormatType = photo_list[obj_file_type].file_format;
|
||||||
metadata.data.photo.statusType = 1;
|
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.numTracks = 1;
|
||||||
metadata.data.photo.tracks = new media_track();
|
metadata.data.photo.tracks = new media_track();
|
||||||
metadata.data.photo.tracks->type = VITA_TRACK_TYPE_PHOTO;
|
metadata.data.photo.tracks->type = VITA_TRACK_TYPE_PHOTO;
|
||||||
|
|||||||
@@ -70,31 +70,7 @@ bool removeRecursively(const QString &path)
|
|||||||
QFileInfo file_info(path);
|
QFileInfo file_info(path);
|
||||||
|
|
||||||
if(file_info.isDir()) {
|
if(file_info.isDir()) {
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
return QDir(path).removeRecursively();
|
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 {
|
} else {
|
||||||
return QFile::remove(path);
|
return QFile::remove(path);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,24 +26,7 @@
|
|||||||
|
|
||||||
#include <vitamtp.h>
|
#include <vitamtp.h>
|
||||||
|
|
||||||
// Qt4 doesn't have public methods for Thread::*sleep
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
typedef QThread Sleeper;
|
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);
|
bool removeRecursively(const QString &path);
|
||||||
QString readable_size(qint64 size, bool use_gib = false);
|
QString readable_size(qint64 size, bool use_gib = false);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ const file_type video_list[] = {
|
|||||||
|
|
||||||
Database::Database(QObject *obj_parent) :
|
Database::Database(QObject *obj_parent) :
|
||||||
QObject(obj_parent),
|
QObject(obj_parent),
|
||||||
mutex(QMutex::Recursive)
|
mutex()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ void Database::process()
|
|||||||
cancel_operation = false;
|
cancel_operation = false;
|
||||||
int count = create();
|
int count = create();
|
||||||
cancel_operation = false;
|
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) {
|
if(count < 0) {
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public:
|
|||||||
static void loadPhotoMetadata(const QString &path, metadata_t &metadata);
|
static void loadPhotoMetadata(const QString &path, metadata_t &metadata);
|
||||||
static void loadVideoMetadata(const QString &path, metadata_t &metadata);
|
static void loadVideoMetadata(const QString &path, metadata_t &metadata);
|
||||||
|
|
||||||
QMutex mutex;
|
QRecursiveMutex mutex;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool continueOperation();
|
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);
|
QFileInfoList qsl = dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot, QDir::Time);
|
||||||
|
|
||||||
if(obj_parent && !obj_parent->parent) {
|
if(obj_parent && !obj_parent->parent) {
|
||||||
qSort(qsl.begin(), qsl.end(), nameLessThan);
|
std::sort(qsl.begin(), qsl.end(), nameLessThan);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(const QFileInfo &info, qsl) {
|
foreach(const QFileInfo &info, qsl) {
|
||||||
@@ -325,7 +325,7 @@ bool QListDB::findInternal(const root_list &list, int ohfi, find_data &data)
|
|||||||
} else {
|
} else {
|
||||||
CMAObject obj;
|
CMAObject obj;
|
||||||
obj.setOhfi(ohfi);
|
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();
|
data.end = list.end();
|
||||||
return data.it != data.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) {
|
for(map_list::iterator root = object_list.begin(); root != object_list.end(); ++root) {
|
||||||
root_list *cat_list = &(*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()) {
|
if(it != cat_list->end()) {
|
||||||
CMAObject *newobj = new CMAObject(parent_obj);
|
CMAObject *newobj = new CMAObject(parent_obj);
|
||||||
|
|||||||
@@ -272,7 +272,7 @@
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../../../gui/forms/configwidget.ui" line="273"/>
|
<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>
|
<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>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../../gui/forms/configwidget.ui" line="280"/>
|
<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="50"/>
|
||||||
<location filename="../../../gui/filterlineedit.cpp" line="71"/>
|
<location filename="../../../gui/filterlineedit.cpp" line="71"/>
|
||||||
<source>Filter</source>
|
<source>Filter</source>
|
||||||
<translation>分类</translation>
|
<translation>过滤</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
@@ -489,8 +489,8 @@ build hash: %1
|
|||||||
build branch: %2</source>
|
build branch: %2</source>
|
||||||
<translation>Copyright (C) 2016 Codestation
|
<translation>Copyright (C) 2016 Codestation
|
||||||
|
|
||||||
编译 hash: %1
|
build hash: %1
|
||||||
编译分支: %2</translation>
|
build branch: %2</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../../gui/mainwidget.cpp" line="272"/>
|
<location filename="../../../gui/mainwidget.cpp" line="272"/>
|
||||||
@@ -551,7 +551,7 @@ build branch: %2</source>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../../../gui/forms/progressform.ui" line="25"/>
|
<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>
|
<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>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../../gui/forms/progressform.ui" line="32"/>
|
<location filename="../../../gui/forms/progressform.ui" line="32"/>
|
||||||
@@ -561,7 +561,7 @@ build branch: %2</source>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../../../gui/forms/progressform.ui" line="39"/>
|
<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>
|
<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>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../../gui/forms/progressform.ui" line="46"/>
|
<location filename="../../../gui/forms/progressform.ui" line="46"/>
|
||||||
|
|||||||
@@ -29,15 +29,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#else
|
|
||||||
#include <QDesktopServices>
|
|
||||||
#define QStandardPaths QDesktopServices
|
|
||||||
#define writableLocation storageLocation
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
|
|
||||||
@@ -160,7 +152,7 @@ SQLiteDB::SQLiteDB(QObject *obj_parent) :
|
|||||||
connect(timer, SIGNAL(timeout()), this, SLOT(process()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(process()));
|
||||||
|
|
||||||
// fetch a configured database path if it exists
|
// 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();
|
db_path = QSettings().value("databasePath", db_path).toString();
|
||||||
QDir(QDir::root()).mkpath(db_path);
|
QDir(QDir::root()).mkpath(db_path);
|
||||||
|
|
||||||
@@ -226,7 +218,7 @@ void SQLiteDB::clear()
|
|||||||
{
|
{
|
||||||
db.close();
|
db.close();
|
||||||
//QSqlDatabase::removeDatabase("QSQLITE");
|
//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();
|
db_path = QSettings().value("databasePath", db_path).toString();
|
||||||
QFile(db_path + QDir::separator() + "qcma.sqlite").remove();
|
QFile(db_path + QDir::separator() + "qcma.sqlite").remove();
|
||||||
load();
|
load();
|
||||||
@@ -529,13 +521,13 @@ bool SQLiteDB::insertSourceEntry(uint object_id, const QString &path, const QStr
|
|||||||
QFileInfo info(path, name);
|
QFileInfo info(path, name);
|
||||||
if(info.isFile()) {
|
if(info.isFile()) {
|
||||||
size = QVariant(info.size());
|
size = QVariant(info.size());
|
||||||
date_created = QVariant(info.created().toUTC().toTime_t());
|
date_created = QVariant(info.birthTime().toUTC().toSecsSinceEpoch());
|
||||||
} else {
|
} else {
|
||||||
size = QVariant(QVariant::LongLong);
|
size = QVariant(static_cast<qint64>(0));
|
||||||
date_created = QVariant(QVariant::UInt);
|
date_created = QVariant(static_cast<qint64>(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
date_modified = QVariant(info.lastModified().toUTC().toTime_t());
|
date_modified = QVariant(info.lastModified().toUTC().toSecsSinceEpoch());
|
||||||
|
|
||||||
QSqlQuery query;
|
QSqlQuery query;
|
||||||
query.prepare("REPLACE INTO sources (object_id, path, size, date_created, date_modified)"
|
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(2, audio_codec);
|
||||||
query.bindValue(3, audio_bitrate);
|
query.bindValue(3, audio_bitrate);
|
||||||
query.bindValue(4, duration);
|
query.bindValue(4, duration);
|
||||||
query.bindValue(5, genre_id ? genre_id : QVariant(QVariant::Int));
|
query.bindValue(5, genre_id ? genre_id : QVariant(static_cast<int>(0)));
|
||||||
query.bindValue(6, artist_id ? artist_id : QVariant(QVariant::Int));
|
query.bindValue(6, artist_id ? artist_id : QVariant(static_cast<int>(0)));
|
||||||
query.bindValue(7, album_id ? album_id : QVariant(QVariant::Int));
|
query.bindValue(7, album_id ? album_id : QVariant(static_cast<int>(0)));
|
||||||
query.bindValue(8, track_id ? track_id : QVariant(QVariant::Int));
|
query.bindValue(8, track_id ? track_id : QVariant(static_cast<int>(0)));
|
||||||
query.bindValue(9, artist);
|
query.bindValue(9, artist);
|
||||||
query.bindValue(10, album);
|
query.bindValue(10, album);
|
||||||
query.bindValue(11, track_number);
|
query.bindValue(11, track_number);
|
||||||
@@ -775,8 +767,8 @@ uint SQLiteDB::insertPhotoEntry(const QString &path, const QString &name, int id
|
|||||||
// return 0;
|
// return 0;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
QDateTime date = QFileInfo(path + "/" + name).created();
|
QDateTime date = QFileInfo(path + "/" + name).birthTime();
|
||||||
date_created = date.toUTC().toTime_t();
|
date_created = date.toUTC().toSecsSinceEpoch();
|
||||||
QString month_created = date.toString("yyyy/MM");
|
QString month_created = date.toString("yyyy/MM");
|
||||||
|
|
||||||
width = 0; //img.width();
|
width = 0; //img.width();
|
||||||
@@ -826,7 +818,7 @@ uint SQLiteDB::insertSavedataEntry(const QString &path, const QString &name, int
|
|||||||
title = reader.value("TITLE", utf8name.constData());
|
title = reader.value("TITLE", utf8name.constData());
|
||||||
savedata_detail = reader.value("SAVEDATA_DETAIL", "");
|
savedata_detail = reader.value("SAVEDATA_DETAIL", "");
|
||||||
savedata_directory = reader.value("SAVEDATA_DIRECTORY", utf8name.constData());
|
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) {
|
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
|
# enable pkg-config on osx/windows
|
||||||
QT_CONFIG -= no-pkg-config
|
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
|
qcma (0.4.1) unstable; urgency=low
|
||||||
|
|
||||||
* Do not reescan database automatically while transferring files.
|
* Do not reescan database automatically while transferring files.
|
||||||
|
|||||||
4
debian/control
vendored
4
debian/control
vendored
@@ -9,8 +9,8 @@ Build-Depends:
|
|||||||
debhelper (>= 9),
|
debhelper (>= 9),
|
||||||
libavformat-dev,
|
libavformat-dev,
|
||||||
libswscale-dev,
|
libswscale-dev,
|
||||||
qtbase5-dev,
|
qt6-base-dev,
|
||||||
qttools5-dev-tools,
|
qt6-tools-dev-tools,
|
||||||
libnotify-dev,
|
libnotify-dev,
|
||||||
libgtk2.0-dev,
|
libgtk2.0-dev,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
|
|||||||
2
debian/rules
vendored
2
debian/rules
vendored
@@ -4,7 +4,7 @@
|
|||||||
#export DH_VERBOSE=1
|
#export DH_VERBOSE=1
|
||||||
|
|
||||||
# see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773686
|
# see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773686
|
||||||
export QT_SELECT=qt5
|
export QT_SELECT=qt6
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@ --buildsystem=qmake
|
dh $@ --buildsystem=qmake
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ void BackupItem::removeEntry()
|
|||||||
emit deleteEntry(this);
|
emit deleteEntry(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QPixmap *BackupItem::getIconPixmap()
|
const QPixmap BackupItem::getIconPixmap()
|
||||||
{
|
{
|
||||||
return ui->itemPicture->pixmap();
|
return ui->itemPicture->pixmap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
void setItemInfo(const QString &name, const QString &size, const QString &extra);
|
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 setItemIcon(const QString &m_path, int width = 48, bool try_dds = false);
|
||||||
void setDirectory(const QString &m_path);
|
void setDirectory(const QString &m_path);
|
||||||
const QPixmap *getIconPixmap();
|
const QPixmap getIconPixmap();
|
||||||
int getIconWidth();
|
int getIconWidth();
|
||||||
QString getPath();
|
QString getPath();
|
||||||
QString getSize();
|
QString getSize();
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "backupmanagerform.h"
|
#include "backupmanagerform.h"
|
||||||
#include "ui_backupmanagerform.h"
|
#include "ui_backupmanagerform.h"
|
||||||
#include "cmaobject.h"
|
|
||||||
#include "sforeader.h"
|
#include "sforeader.h"
|
||||||
#include "confirmdialog.h"
|
#include "confirmdialog.h"
|
||||||
#include "cmautils.h"
|
#include "cmautils.h"
|
||||||
@@ -90,7 +89,7 @@ void BackupManagerForm::removeEntry(BackupItem *item)
|
|||||||
ConfirmDialog msgBox;
|
ConfirmDialog msgBox;
|
||||||
|
|
||||||
msgBox.setMessageText(tr("Are you sure to remove the backup of the following entry?"), item->title);
|
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) {
|
if(msgBox.exec() == 0) {
|
||||||
return;
|
return;
|
||||||
@@ -190,11 +189,7 @@ void BackupManagerForm::loadBackupListing(int index)
|
|||||||
// adjust the table item width to fill all the widget
|
// adjust the table item width to fill all the widget
|
||||||
QHeaderView *vert_header = ui->tableWidget->verticalHeader();
|
QHeaderView *vert_header = ui->tableWidget->verticalHeader();
|
||||||
QHeaderView *horiz_header = ui->tableWidget->horizontalHeader();
|
QHeaderView *horiz_header = ui->tableWidget->horizontalHeader();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
horiz_header->setSectionResizeMode(QHeaderView::Stretch);
|
horiz_header->setSectionResizeMode(QHeaderView::Stretch);
|
||||||
#else
|
|
||||||
horiz_header->setResizeMode(QHeaderView::Stretch);
|
|
||||||
#endif
|
|
||||||
qint64 backup_size = m_db->getObjectSize(ohfi);
|
qint64 backup_size = m_db->getObjectSize(ohfi);
|
||||||
setBackupUsage(backup_size);
|
setBackupUsage(backup_size);
|
||||||
QString path = m_db->getAbsolutePath(ohfi);
|
QString path = m_db->getAbsolutePath(ohfi);
|
||||||
@@ -254,7 +249,7 @@ void BackupManagerForm::loadBackupListing(int index)
|
|||||||
|
|
||||||
m_db->freeMetadata(first);
|
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;
|
int row;
|
||||||
QList<BackupItem *>::iterator it;
|
QList<BackupItem *>::iterator it;
|
||||||
|
|||||||
@@ -26,14 +26,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#else
|
|
||||||
#include <QDesktopServices>
|
|
||||||
#define QStandardPaths QDesktopServices
|
|
||||||
#define writableLocation storageLocation
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ConfigWidget::ConfigWidget(QWidget *obj_parent) :
|
ConfigWidget::ConfigWidget(QWidget *obj_parent) :
|
||||||
QDialog(obj_parent),
|
QDialog(obj_parent),
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "ui_pinform.h"
|
#include "ui_pinform.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDesktopWidget>
|
#include <QScreen>
|
||||||
|
|
||||||
const QString PinForm::pinFormat =
|
const QString PinForm::pinFormat =
|
||||||
"<html><head/><body>"
|
"<html><head/><body>"
|
||||||
@@ -33,7 +33,10 @@ PinForm::PinForm(QWidget *obj_parent) :
|
|||||||
ui(new Ui::PinForm)
|
ui(new Ui::PinForm)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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());
|
setFixedSize(size());
|
||||||
setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
|
setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
|
||||||
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(hide()));
|
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(hide()));
|
||||||
|
|||||||
@@ -20,15 +20,18 @@
|
|||||||
#include "progressform.h"
|
#include "progressform.h"
|
||||||
#include "ui_progressform.h"
|
#include "ui_progressform.h"
|
||||||
|
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QScreen>
|
||||||
|
|
||||||
ProgressForm::ProgressForm(QWidget *obj_parent) :
|
ProgressForm::ProgressForm(QWidget *obj_parent) :
|
||||||
QWidget(obj_parent),
|
QWidget(obj_parent),
|
||||||
ui(new Ui::ProgressForm)
|
ui(new Ui::ProgressForm)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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());
|
setFixedSize(size());
|
||||||
setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
|
setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
|
||||||
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(cancelConfirm()));
|
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(cancelConfirm()));
|
||||||
|
|||||||
23
gui/main.cpp
23
gui/main.cpp
@@ -24,7 +24,6 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QTextCodec>
|
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
@@ -34,14 +33,9 @@
|
|||||||
#include "singleapplication.h"
|
#include "singleapplication.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
static 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();
|
const char * msg = str.toStdString().c_str();
|
||||||
#else
|
|
||||||
static void noMessageOutput(QtMsgType type, const char *msg)
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
Q_UNUSED(type);
|
Q_UNUSED(type);
|
||||||
Q_UNUSED(msg);
|
Q_UNUSED(msg);
|
||||||
}
|
}
|
||||||
@@ -102,18 +96,10 @@ int main(int argc, char *argv[])
|
|||||||
VitaMTP_Set_Logging(VitaMTP_VERBOSE);
|
VitaMTP_Set_Logging(VitaMTP_VERBOSE);
|
||||||
} else {
|
} else {
|
||||||
VitaMTP_Set_Logging(VitaMTP_NONE);
|
VitaMTP_Set_Logging(VitaMTP_NONE);
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
qInstallMessageHandler(noMessageOutput);
|
qInstallMessageHandler(noMessageOutput);
|
||||||
#else
|
|
||||||
qInstallMsgHandler(noMessageOutput);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
QTextStream(stdout) << "Starting Qcma " << QCMA_VER << Qt::endl;
|
||||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QTextStream(stdout) << "Starting Qcma " << QCMA_VER << endl;
|
|
||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
QString locale = QLocale().system().name();
|
QString locale = QLocale().system().name();
|
||||||
@@ -134,8 +120,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
QTranslator system_translator;
|
QTranslator system_translator;
|
||||||
system_translator.load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
if(!system_translator.load("qt_" + locale, QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
|
||||||
app.installTranslator(&system_translator);
|
qWarning() << "Cannot load system translation for locale:" << locale;
|
||||||
|
} else {
|
||||||
|
app.installTranslator(&system_translator);
|
||||||
|
}
|
||||||
|
|
||||||
qDebug("Starting main thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
|
qDebug("Starting main thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
|
||||||
|
|
||||||
|
|||||||
@@ -25,12 +25,6 @@
|
|||||||
|
|
||||||
#include "trayindicator_global.h"
|
#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
|
class TrayIndicator : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
Reference in New Issue
Block a user