diff --git a/resources/translations/qcma.es.ts b/resources/translations/qcma.es.ts
index 995bbdd..0601fc0 100644
--- a/resources/translations/qcma.es.ts
+++ b/resources/translations/qcma.es.ts
@@ -105,27 +105,27 @@
Agregadas %1 entradas a la base de datos
-
+
Added %1 items to the database
Agregadas %1 entradas a la base de datos
-
+
Database indexing aborted by user
Actualización de la base de datos cancelada por el usuario
-
+
Cannot initialize VitaMTP library
No se pudo inicializar VitaMTP
-
+
Cannot refresh the database while is in use
No se puede actualizar la base de datos mientras se encuentre en uso
-
+
No PS Vita system has been registered
Nigún sistema PS Vita ha sido registrado
@@ -137,8 +137,8 @@
Conectado a
-
+
Connected to %1 (PS Vita)
Conectado a %1 (PS Vita)
@@ -236,7 +236,7 @@
<html><head/><body><p align="center"><span style=" font-size:14pt; font-weight:600;">Advanced settings</span></p></body></html>
-
+ <html><head/><body><p align="center"><span style=" font-size:14pt; font-weight:600;">Ajustes Avanzados</span></p></body></html>
@@ -244,57 +244,57 @@
Modo desconectado
-
+
Skip metadata extraction
-
+ Saltar la extracción de metadatos
-
+
Update database automatically when files on the PC are changed
-
+ Actualizar la base de datos automaticamente
-
+
Disable USB monitoring
-
+ Deshabilitar monitoreo USB
+
+
+
+ Disable Wi-Fi monitoring
+ Deshabilitar monitoreo WiFi
- Disable Wi-Fi monitoring
-
-
-
-
Database backend
-
+ Almacenaje de base de datos
-
+
In Memory
-
+ En memoria
-
+
Select the folder to be used as a photo source
Seleccione el directorio a ser utilizado como origen de fotos
-
+
Select the folder to be used as a music source
Seleccione el directorio a ser utilizado como origen de música
-
+
Select the folder to be used as a video source
Seleccione el directorio a ser utilizado como origen de videos
-
+
Select the folder to be used to save PS Vita games and backups
Seleccione el directorio a ser utilizado para guardar juegos y respaldos
-
+
Select the folder to be used to fetch software updates
Seleccione el directorio a ser utilizado para extraer actualizaciones de software
@@ -325,7 +325,7 @@
HTTPDownloader
-
+
Network error: %1
Error de red: %1
diff --git a/resources/translations/qcma.ja.ts b/resources/translations/qcma.ja.ts
index 90490b2..9c9e8c7 100644
--- a/resources/translations/qcma.ja.ts
+++ b/resources/translations/qcma.ja.ts
@@ -105,27 +105,27 @@
%1個の項目をデータベースに追加しました
-
+
Added %1 items to the database
%1個の項目をデータベースに追加しました
-
+
Database indexing aborted by user
データベース構築がユーザーにより中止されました
-
+
Cannot initialize VitaMTP library
-
+
Cannot refresh the database while is in use
使用中にはデータベースを更新できません
-
+
No PS Vita system has been registered
@@ -137,8 +137,8 @@
次のデバイスに接続しました
-
+
Connected to %1 (PS Vita)
@@ -244,57 +244,57 @@
オフラインモード
-
+
Skip metadata extraction
メタデータの展開をスキップする
-
+
Update database automatically when files on the PC are changed
PCのファイルが変更された際にデータベースを自動的に更新する
-
+
Disable USB monitoring
USBの監視を無効にする
-
+
Disable Wi-Fi monitoring
Wi-Fiの監視を無効にする
-
+
Database backend
データベース保存
-
+
In Memory
メモリ内
-
+
Select the folder to be used as a photo source
フォトの参照先として使用されるフォルダを選択してください
-
+
Select the folder to be used as a music source
ミュージックの参照先として使用されるフォルダを選択してください
-
+
Select the folder to be used as a video source
ビデオの参照先として使用されるフォルダを選択してください
-
+
Select the folder to be used to save PS Vita games and backups
PS Vitaのゲームとバックアップの保存に使用されるフォルダを選択してください
-
+
Select the folder to be used to fetch software updates
ソフトウェアアップデートの取得に使用されるフォルダを選択してください
@@ -326,7 +326,7 @@
HTTPDownloader
-
+
Network error: %1
diff --git a/src/clientmanager.cpp b/src/clientmanager.cpp
index d46976a..2e42396 100644
--- a/src/clientmanager.cpp
+++ b/src/clientmanager.cpp
@@ -22,6 +22,8 @@
#include "utils.h"
#include "forms/progressform.h"
+#include
+
#include
ClientManager::ClientManager(QObject *parent) :
@@ -59,6 +61,7 @@ void ClientManager::start()
// initializing database for the first use
refreshDatabase();
+
CmaEvent::db = &db;
connect(&db, SIGNAL(fileAdded(QString)), &progress, SLOT(setFileName(QString)));
connect(&db, SIGNAL(directoryAdded(QString)), &progress, SLOT(setDirectoryName(QString)));
@@ -68,44 +71,53 @@ void ClientManager::start()
thread_count = 0;
qDebug("Starting cma threads");
CmaClient *client;
+ QSettings settings;
- usb_thread = new QThread();
- client = new CmaClient();
- usb_thread->setObjectName("usb_thread");
- connect(usb_thread, SIGNAL(started()), client, SLOT(connectUsb()));
- connect(client, SIGNAL(messageSent(QString)), this, SIGNAL(messageSent(QString)));
- connect(client, SIGNAL(finished()), usb_thread, SLOT(quit()), Qt::DirectConnection);
- connect(usb_thread, SIGNAL(finished()), usb_thread, SLOT(deleteLater()));
- connect(usb_thread, SIGNAL(finished()), this, SLOT(threadStopped()));
- connect(usb_thread, SIGNAL(finished()), client, SLOT(deleteLater()));
+ if(!settings.value("disableUSB", false).toBool()) {
+ usb_thread = new QThread();
+ client = new CmaClient();
+ usb_thread->setObjectName("usb_thread");
+ connect(usb_thread, SIGNAL(started()), client, SLOT(connectUsb()));
+ connect(client, SIGNAL(messageSent(QString)), this, SIGNAL(messageSent(QString)));
+ connect(client, SIGNAL(finished()), usb_thread, SLOT(quit()), Qt::DirectConnection);
+ connect(usb_thread, SIGNAL(finished()), usb_thread, SLOT(deleteLater()));
+ connect(usb_thread, SIGNAL(finished()), this, SLOT(threadStopped()));
+ connect(usb_thread, SIGNAL(finished()), client, SLOT(deleteLater()));
- connect(client, SIGNAL(deviceConnected(QString)), this, SIGNAL(deviceConnected(QString)));
- connect(client, SIGNAL(deviceDisconnected()), this, SIGNAL(deviceDisconnected()));
- connect(client, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase()));
+ connect(client, SIGNAL(deviceConnected(QString)), this, SIGNAL(deviceConnected(QString)));
+ connect(client, SIGNAL(deviceDisconnected()), this, SIGNAL(deviceDisconnected()));
+ connect(client, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase()));
- client->moveToThread(usb_thread);
- usb_thread->start();
- thread_count++;
+ client->moveToThread(usb_thread);
+ usb_thread->start();
+ thread_count++;
+ }
- wireless_thread = new QThread();
- client = new CmaClient();
- wireless_thread->setObjectName("wireless_thread");
- connect(wireless_thread, SIGNAL(started()), client, SLOT(connectWireless()));
- connect(client, SIGNAL(messageSent(QString)), this, SIGNAL(messageSent(QString)));
- connect(client, SIGNAL(receivedPin(QString,int)), this, SLOT(showPinDialog(QString,int)));
- connect(client, SIGNAL(finished()), wireless_thread, SLOT(quit()), Qt::DirectConnection);
- connect(wireless_thread, SIGNAL(finished()), wireless_thread, SLOT(deleteLater()));
- connect(wireless_thread, SIGNAL(finished()), this, SLOT(threadStopped()));
- connect(wireless_thread, SIGNAL(finished()), client, SLOT(deleteLater()));
+ if(!settings.value("disableWireless", false).toBool()) {
+ wireless_thread = new QThread();
+ client = new CmaClient();
+ wireless_thread->setObjectName("wireless_thread");
+ connect(wireless_thread, SIGNAL(started()), client, SLOT(connectWireless()));
+ connect(client, SIGNAL(messageSent(QString)), this, SIGNAL(messageSent(QString)));
+ connect(client, SIGNAL(receivedPin(QString,int)), this, SLOT(showPinDialog(QString,int)));
+ connect(client, SIGNAL(finished()), wireless_thread, SLOT(quit()), Qt::DirectConnection);
+ connect(wireless_thread, SIGNAL(finished()), wireless_thread, SLOT(deleteLater()));
+ connect(wireless_thread, SIGNAL(finished()), this, SLOT(threadStopped()));
+ connect(wireless_thread, SIGNAL(finished()), client, SLOT(deleteLater()));
- connect(client, SIGNAL(pinComplete()), &pinForm, SLOT(hide()));
- connect(client, SIGNAL(deviceConnected(QString)), this, SIGNAL(deviceConnected(QString)));
- connect(client, SIGNAL(deviceDisconnected()), this, SIGNAL(deviceDisconnected()));
- connect(client, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase()));
+ connect(client, SIGNAL(pinComplete()), &pinForm, SLOT(hide()));
+ connect(client, SIGNAL(deviceConnected(QString)), this, SIGNAL(deviceConnected(QString)));
+ connect(client, SIGNAL(deviceDisconnected()), this, SIGNAL(deviceDisconnected()));
+ connect(client, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase()));
- client->moveToThread(wireless_thread);
- wireless_thread->start();
- thread_count++;
+ client->moveToThread(wireless_thread);
+ wireless_thread->start();
+ thread_count++;
+ }
+
+ if(thread_count == 0) {
+ emit messageSent(tr("You must enable at least USB or Wireless monitoring"));
+ }
}
void ClientManager::refreshDatabase()
diff --git a/src/cmaclient.cpp b/src/cmaclient.cpp
index 3d4725a..2f966a2 100644
--- a/src/cmaclient.cpp
+++ b/src/cmaclient.cpp
@@ -75,6 +75,7 @@ void CmaClient::connectUsb()
}
} while(isActive());
+ usbwait.unlock();
qDebug("Finishing usb_thread");
emit finished();
}
diff --git a/src/cmaevent.cpp b/src/cmaevent.cpp
index b643246..add1f2d 100644
--- a/src/cmaevent.cpp
+++ b/src/cmaevent.cpp
@@ -154,7 +154,7 @@ quint16 CmaEvent::processAllObjects(CMAObject *parent, quint32 handle)
qDebug("Called %s, handle: %d, parent name: %s", Q_FUNC_INFO, handle, parent->metadata.name);
char *name;
- uint64_t size;
+ int fileType = -1;
int dataType;
uint32_t *p_handles;
@@ -199,15 +199,26 @@ quint16 CmaEvent::processAllObjects(CMAObject *parent, quint32 handle)
delete m_file;
return PTP_RC_VITA_Invalid_Permission;
} else {
+ // the size gets ignored because we can also get it via info.size()
+ uint64_t size;
+
VitaMTP_GetObject_Callback(device, handle, &size, CmaEvent::writeCallback);
m_file->close();
delete m_file;
+
+ // get the root ohfi type
+ CMAObject *root_obj = parent;
+ while(root_obj->parent) {
+ root_obj = root_obj->parent;
+ }
+
+ fileType = Database::checkFileType(dir.absoluteFilePath(name), root_obj->metadata.ohfi);
}
}
QFileInfo info(dir, name);
object = new CMAObject(parent);
- object->initObject(info);
+ object->initObject(info, fileType);
object->metadata.handle = handle;
db->append(parent->metadata.ohfi, object);
free(name);
diff --git a/src/cmaobject.cpp b/src/cmaobject.cpp
index 260aeba..6ab36de 100644
--- a/src/cmaobject.cpp
+++ b/src/cmaobject.cpp
@@ -25,6 +25,7 @@
#include
#include
#include
+#include
int CMAObject::ohfi_count = OHFI_OFFSET;
@@ -83,9 +84,10 @@ CMAObject::~CMAObject()
void CMAObject::loadSfoMetadata(const QString &path)
{
QString sfo = QDir(path).absoluteFilePath("PARAM.SFO");
+ bool skipMetadata = QSettings().value("skipMetadata", false).toBool();
SfoReader reader;
- if(reader.load(sfo)) {
+ if(!skipMetadata && reader.load(sfo)) {
metadata.data.saveData.title = strdup(reader.value("TITLE", ""));
//FIXME: disable savedata detail for now
//QString detail(reader.value("SAVEDATA_DETAIL", ""));
@@ -127,7 +129,9 @@ void CMAObject::loadSfoMetadata(const QString &path)
void CMAObject::loadMusicMetadata(const QString &path)
{
AVDecoder decoder;
- if(decoder.open(path)) {
+ bool skipMetadata = QSettings().value("skipMetadata", false).toBool();
+
+ if(!skipMetadata && decoder.open(path)) {
decoder.getAudioMetadata(metadata);
} else {
metadata.data.music.album = strdup(parent->metadata.name ? parent->metadata.name : "");
@@ -139,7 +143,9 @@ void CMAObject::loadMusicMetadata(const QString &path)
void CMAObject::loadVideoMetadata(const QString &path)
{
AVDecoder decoder;
- if(decoder.open(path)) {
+ bool skipMetadata = QSettings().value("skipMetadata", false).toBool();
+
+ if(!skipMetadata && decoder.open(path)) {
decoder.getVideoMetadata(metadata);
} else {
metadata.data.video.title = strdup(metadata.name);
@@ -151,7 +157,9 @@ void CMAObject::loadVideoMetadata(const QString &path)
void CMAObject::loadPhotoMetadata(const QString &path)
{
QImage img;
- if(img.load(path)) {
+ bool skipMetadata = QSettings().value("skipMetadata", false).toBool();
+
+ if(!skipMetadata && img.load(path)) {
metadata.data.photo.tracks->data.track_photo.width = img.width();
metadata.data.photo.tracks->data.track_photo.height = img.height();
}
@@ -176,6 +184,12 @@ void CMAObject::initObject(const QFileInfo &file, int file_type)
metadata.data.saveData.statusType = 1;
loadSfoMetadata(file.absoluteFilePath());
} else if(MASK_SET(metadata.dataType, Music | File)) {
+
+ if(file_type < 0) {
+ qWarning("Invalid file type for music: %i, setting it to zero", file_type);
+ file_type = 0;
+ }
+
metadata.data.music.fileName = strdup(metadata.name);
metadata.data.music.fileFormatType = audio_list[file_type].file_format;
metadata.data.music.statusType = 1;
@@ -195,6 +209,12 @@ void CMAObject::initObject(const QFileInfo &file, int file_type)
metadata.data.video.tracks->type = VITA_TRACK_TYPE_VIDEO;
loadVideoMetadata(file.absoluteFilePath());
} else if(MASK_SET(metadata.dataType, Photo | File)) {
+
+ if(file_type < 0) {
+ qWarning("Invalid file type for photos: %i, setting it to zero", file_type);
+ file_type = 0;
+ }
+
metadata.data.photo.fileName = strdup(metadata.name);
metadata.data.photo.fileFormatType = photo_list[file_type].file_format;
metadata.data.photo.statusType = 1;
diff --git a/src/database.h b/src/database.h
index 4c66f34..0f5a184 100644
--- a/src/database.h
+++ b/src/database.h
@@ -53,6 +53,8 @@ public:
CMAObject *pathToObject(const char *path, int ohfiRoot);
int acceptFilteredObject(const CMAObject *parent, const CMAObject *current, int type);
+ static int checkFileType(const QString path, int ohfi_root);
+
QMutex mutex;
private:
@@ -74,7 +76,6 @@ private:
CMAObject *getParent(CMAObject *last_dir, const QString ¤t_path);
CMAObject *pathToObjectInternal(const root_list &list, const char *path);
static bool lessThanComparator(const CMAObject *a, const CMAObject *b);
- int checkFileType(const QString path, int ohfi_root);
void dumpMetadataList(const metadata_t *p_head);
bool continueOperation();
diff --git a/src/forms/configwidget.cpp b/src/forms/configwidget.cpp
index aedd3db..ed8dc3e 100644
--- a/src/forms/configwidget.cpp
+++ b/src/forms/configwidget.cpp
@@ -41,7 +41,7 @@ ConfigWidget::ConfigWidget(QWidget *parent) :
{
ui->setupUi(this);
connectSignals();
- setDefaultDirs();
+ setDefaultData();
}
void ConfigWidget::connectSignals()
@@ -62,7 +62,7 @@ void ConfigWidget::connectSignals()
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
-void ConfigWidget::setDefaultDirs()
+void ConfigWidget::setDefaultData()
{
QString defaultdir;
QSettings settings;
@@ -78,6 +78,11 @@ void ConfigWidget::setDefaultDirs()
defaultdir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
defaultdir.append(QDir::separator()).append("PSV Updates");
ui->urlPath->setText(settings.value("urlPath", defaultdir).toString());
+
+ ui->offlineCheck->setChecked(settings.value("offlineMode", true).toBool());
+ ui->metadataCheck->setChecked(settings.value("skipMetadata", false).toBool());
+ ui->usbCheck->setChecked(settings.value("disableUSB", false).toBool());
+ ui->wifiCheck->setChecked(settings.value("disableWireless", false).toBool());
}
ConfigWidget::~ConfigWidget()
@@ -146,6 +151,10 @@ void ConfigWidget::accept()
savePath(settings, ui->appPath, "appsPath");
savePath(settings, ui->urlPath, "urlPath");
settings.setValue("offlineMode", ui->offlineCheck->isChecked());
+ settings.setValue("skipMetadata", ui->metadataCheck->isChecked());
+ settings.setValue("disableUSB", ui->usbCheck->isChecked());
+ settings.setValue("disableWireless", ui->wifiCheck->isChecked());
settings.sync();
+
done(Accepted);
}
diff --git a/src/forms/configwidget.h b/src/forms/configwidget.h
index b7b90d5..a1a8d45 100644
--- a/src/forms/configwidget.h
+++ b/src/forms/configwidget.h
@@ -41,7 +41,7 @@ private:
enum browse_buttons {BTN_PHOTO, BTN_MUSIC, BTN_VIDEO, BTN_APPS, BTN_URL};
void connectSignals();
- void setDefaultDirs();
+ void setDefaultData();
void savePath(QSettings &settings, const QLineEdit *edit, const QString &key);
Ui::ConfigWidget *ui;
diff --git a/src/forms/configwidget.ui b/src/forms/configwidget.ui
index 90acb7e..9fe7cc7 100644
--- a/src/forms/configwidget.ui
+++ b/src/forms/configwidget.ui
@@ -242,15 +242,26 @@
-
-
-
- false
-
+
Skip metadata extraction
+ -
+
+
+ Disable USB monitoring
+
+
+
+ -
+
+
+ Disable Wi-Fi monitoring
+
+
+
-
@@ -261,26 +272,6 @@
- -
-
-
- false
-
-
- Disable USB monitoring
-
-
-
- -
-
-
- false
-
-
- Disable Wi-Fi monitoring
-
-
-
-
-
diff --git a/src/main.cpp b/src/main.cpp
index e21741e..2e5aaad 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -22,6 +22,7 @@
#endif
#include
+#include
#include
#include
#include
@@ -89,6 +90,10 @@ int main(int argc, char *argv[])
app.installTranslator(&translator);
}
+ QTranslator system_translator;
+ system_translator.load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+ app.installTranslator(&system_translator);
+
qDebug("Starting main thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
// set the organization/application for QSettings to work properly