Remove wireless disconnect callback.
Make an interruptable sleep so the USB connection can be aborted more quickly. Updated translations.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!DOCTYPE TS>
|
<!DOCTYPE TS>
|
||||||
<TS version="2.0" language="es_ES">
|
<TS version="2.1" language="es_ES">
|
||||||
<context>
|
<context>
|
||||||
<name>BackupItem</name>
|
<name>BackupItem</name>
|
||||||
<message>
|
<message>
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/forms/backupmanagerform.ui" line="122"/>
|
<location filename="../../src/forms/backupmanagerform.ui" line="122"/>
|
||||||
<location filename="../../src/forms/backupmanagerform.cpp" line="230"/>
|
<location filename="../../src/forms/backupmanagerform.cpp" line="231"/>
|
||||||
<source>Filter</source>
|
<source>Filter</source>
|
||||||
<translation>Filtro</translation>
|
<translation>Filtro</translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
<translation>Uso de disco en respaldos: %1</translation>
|
<translation>Uso de disco en respaldos: %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/forms/backupmanagerform.cpp" line="197"/>
|
<location filename="../../src/forms/backupmanagerform.cpp" line="198"/>
|
||||||
<source> - (Launcher only)</source>
|
<source> - (Launcher only)</source>
|
||||||
<translation> - (Solo lanzador LiveArea)</translation>
|
<translation> - (Solo lanzador LiveArea)</translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -120,12 +120,12 @@
|
|||||||
<translation>No se pudo inicializar VitaMTP</translation>
|
<translation>No se pudo inicializar VitaMTP</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/clientmanager.cpp" line="112"/>
|
<location filename="../../src/clientmanager.cpp" line="114"/>
|
||||||
<source>Cannot refresh the database while is in use</source>
|
<source>Cannot refresh the database while is in use</source>
|
||||||
<translation>No se puede actualizar la base de datos mientras se encuentre en uso</translation>
|
<translation>No se puede actualizar la base de datos mientras se encuentre en uso</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/clientmanager.cpp" line="114"/>
|
<location filename="../../src/clientmanager.cpp" line="116"/>
|
||||||
<source>No PS Vita system has been registered</source>
|
<source>No PS Vita system has been registered</source>
|
||||||
<translation>Nigún sistema PS Vita ha sido registrado</translation>
|
<translation>Nigún sistema PS Vita ha sido registrado</translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -137,8 +137,8 @@
|
|||||||
<translation type="obsolete">Conectado a </translation>
|
<translation type="obsolete">Conectado a </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/cmaclient.cpp" line="127"/>
|
<location filename="../../src/cmaclient.cpp" line="135"/>
|
||||||
<location filename="../../src/cmaclient.cpp" line="130"/>
|
<location filename="../../src/cmaclient.cpp" line="138"/>
|
||||||
<source>Connected to %1 (PS Vita)</source>
|
<source>Connected to %1 (PS Vita)</source>
|
||||||
<translation>Conectado a %1 (PS Vita)</translation>
|
<translation>Conectado a %1 (PS Vita)</translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -330,9 +330,13 @@
|
|||||||
<translation>Cerrando...</translation>
|
<translation>Cerrando...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/mainwidget.cpp" line="80"/>
|
|
||||||
<source>Stopping QCMA...</source>
|
<source>Stopping QCMA...</source>
|
||||||
<translation>Deteniendo QCMA...</translation>
|
<translation type="obsolete">Deteniendo QCMA...</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/mainwidget.cpp" line="80"/>
|
||||||
|
<source>Stopping QCMA (disconnect your PS Vita)</source>
|
||||||
|
<translation>Deteniendo QCMA (desconecte su PS Vita)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/mainwidget.cpp" line="96"/>
|
<location filename="../../src/mainwidget.cpp" line="96"/>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!DOCTYPE TS>
|
<!DOCTYPE TS>
|
||||||
<TS version="2.0" language="ja_JP">
|
<TS version="2.1" language="ja_JP">
|
||||||
<context>
|
<context>
|
||||||
<name>BackupItem</name>
|
<name>BackupItem</name>
|
||||||
<message>
|
<message>
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/forms/backupmanagerform.ui" line="122"/>
|
<location filename="../../src/forms/backupmanagerform.ui" line="122"/>
|
||||||
<location filename="../../src/forms/backupmanagerform.cpp" line="230"/>
|
<location filename="../../src/forms/backupmanagerform.cpp" line="231"/>
|
||||||
<source>Filter</source>
|
<source>Filter</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
<translation>バックアップディスク使用容量: %1</translation>
|
<translation>バックアップディスク使用容量: %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/forms/backupmanagerform.cpp" line="197"/>
|
<location filename="../../src/forms/backupmanagerform.cpp" line="198"/>
|
||||||
<source> - (Launcher only)</source>
|
<source> - (Launcher only)</source>
|
||||||
<translation> - (LiveArea専用)</translation>
|
<translation> - (LiveArea専用)</translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -120,12 +120,12 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/clientmanager.cpp" line="112"/>
|
<location filename="../../src/clientmanager.cpp" line="114"/>
|
||||||
<source>Cannot refresh the database while is in use</source>
|
<source>Cannot refresh the database while is in use</source>
|
||||||
<translation>使用中にはデータベースを更新できません</translation>
|
<translation>使用中にはデータベースを更新できません</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/clientmanager.cpp" line="114"/>
|
<location filename="../../src/clientmanager.cpp" line="116"/>
|
||||||
<source>No PS Vita system has been registered</source>
|
<source>No PS Vita system has been registered</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -137,8 +137,8 @@
|
|||||||
<translation type="obsolete">次のデバイスに接続しました </translation>
|
<translation type="obsolete">次のデバイスに接続しました </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/cmaclient.cpp" line="127"/>
|
<location filename="../../src/cmaclient.cpp" line="135"/>
|
||||||
<location filename="../../src/cmaclient.cpp" line="130"/>
|
<location filename="../../src/cmaclient.cpp" line="138"/>
|
||||||
<source>Connected to %1 (PS Vita)</source>
|
<source>Connected to %1 (PS Vita)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -331,9 +331,13 @@
|
|||||||
<translation>終了しています...</translation>
|
<translation>終了しています...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/mainwidget.cpp" line="80"/>
|
|
||||||
<source>Stopping QCMA...</source>
|
<source>Stopping QCMA...</source>
|
||||||
<translation>QCMAを停止しています...</translation>
|
<translation type="obsolete">QCMAを停止しています...</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/mainwidget.cpp" line="80"/>
|
||||||
|
<source>Stopping QCMA (disconnect your PS Vita)</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/mainwidget.cpp" line="96"/>
|
<location filename="../../src/mainwidget.cpp" line="96"/>
|
||||||
|
@@ -65,7 +65,7 @@ void ClientManager::start()
|
|||||||
connect(&db, SIGNAL(updated(int)), this, SLOT(databaseUpdated(int)));
|
connect(&db, SIGNAL(updated(int)), this, SLOT(databaseUpdated(int)));
|
||||||
connect(&progress, SIGNAL(canceled()), &db, SLOT(cancelOperation()), Qt::DirectConnection);
|
connect(&progress, SIGNAL(canceled()), &db, SLOT(cancelOperation()), Qt::DirectConnection);
|
||||||
|
|
||||||
thread_count = 2;
|
thread_count = 0;
|
||||||
qDebug("Starting cma threads");
|
qDebug("Starting cma threads");
|
||||||
CmaClient *client;
|
CmaClient *client;
|
||||||
|
|
||||||
@@ -84,6 +84,7 @@ void ClientManager::start()
|
|||||||
|
|
||||||
client->moveToThread(usb_thread);
|
client->moveToThread(usb_thread);
|
||||||
usb_thread->start();
|
usb_thread->start();
|
||||||
|
thread_count++;
|
||||||
|
|
||||||
wireless_thread = new QThread();
|
wireless_thread = new QThread();
|
||||||
client = new CmaClient();
|
client = new CmaClient();
|
||||||
@@ -102,6 +103,7 @@ void ClientManager::start()
|
|||||||
|
|
||||||
client->moveToThread(wireless_thread);
|
client->moveToThread(wireless_thread);
|
||||||
wireless_thread->start();
|
wireless_thread->start();
|
||||||
|
thread_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientManager::refreshDatabase()
|
void ClientManager::refreshDatabase()
|
||||||
|
@@ -34,14 +34,14 @@
|
|||||||
|
|
||||||
QMutex CmaClient::mutex;
|
QMutex CmaClient::mutex;
|
||||||
QMutex CmaClient::runner;
|
QMutex CmaClient::runner;
|
||||||
QMutex CmaClient::cancel;
|
QWaitCondition CmaClient::usbcondition;
|
||||||
|
QMutex CmaClient::usbwait;
|
||||||
QSemaphore CmaClient::sema;
|
QSemaphore CmaClient::sema;
|
||||||
|
|
||||||
QString CmaClient::tempOnlineId = QString();
|
QString CmaClient::tempOnlineId = QString();
|
||||||
|
|
||||||
bool CmaClient::is_active = false;
|
bool CmaClient::is_active = false;
|
||||||
bool CmaClient::in_progress = false;
|
bool CmaClient::in_progress = false;
|
||||||
int CmaClient::is_cancelled = false;
|
|
||||||
|
|
||||||
CmaClient *CmaClient::this_object = NULL;
|
CmaClient *CmaClient::this_object = NULL;
|
||||||
|
|
||||||
@@ -58,13 +58,14 @@ void CmaClient::connectUsb()
|
|||||||
qDebug("Starting usb_thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
|
qDebug("Starting usb_thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
|
||||||
|
|
||||||
setActive(true);
|
setActive(true);
|
||||||
|
usbwait.lock();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if((vita = VitaMTP_Get_First_USB_Vita()) !=NULL) {
|
if((vita = VitaMTP_Get_First_USB_Vita()) !=NULL) {
|
||||||
processNewConnection(vita);
|
processNewConnection(vita);
|
||||||
} else {
|
} else {
|
||||||
//TODO: replace this with an event-driven setup
|
//TODO: replace this with an event-driven setup
|
||||||
Sleeper::msleep(2000);
|
usbcondition.wait(&usbwait, 2000);
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
if(in_progress) {
|
if(in_progress) {
|
||||||
sema.acquire();
|
sema.acquire();
|
||||||
@@ -91,15 +92,22 @@ void CmaClient::connectWireless()
|
|||||||
setActive(true);
|
setActive(true);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if((vita = VitaMTP_Get_First_Wireless_Vita(&host, 0, CC::cancelCallback, CC::deviceRegistered, CC::generatePin, CC::registrationComplete)) != NULL) {
|
if((vita = VitaMTP_Get_First_Wireless_Vita(&host, 0, CC::deviceRegistered, CC::generatePin, CC::registrationComplete)) != NULL) {
|
||||||
processNewConnection(vita);
|
processNewConnection(vita);
|
||||||
} else {
|
} else {
|
||||||
Sleeper::msleep(2000);
|
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
if(in_progress) {
|
if(in_progress) {
|
||||||
sema.acquire();
|
sema.acquire();
|
||||||
}
|
}
|
||||||
mutex.unlock();;
|
mutex.unlock();
|
||||||
|
|
||||||
|
// if is active then something happened while setting the socket, wait a little and try again
|
||||||
|
if(isActive()) {
|
||||||
|
qDebug("Error getting wireless connection");
|
||||||
|
Sleeper::sleep(2000);
|
||||||
|
} else {
|
||||||
|
qDebug("Wireless connection cancelled by the user");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while(isActive());
|
} while(isActive());
|
||||||
|
|
||||||
@@ -171,12 +179,6 @@ int CmaClient::generatePin(wireless_vita_info_t *info, int *p_err)
|
|||||||
return pin;
|
return pin;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmaClient::cancelCallback()
|
|
||||||
{
|
|
||||||
QMutexLocker locker(&cancel);
|
|
||||||
return is_cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CmaClient::enterEventLoop(vita_device_t *device)
|
void CmaClient::enterEventLoop(vita_device_t *device)
|
||||||
{
|
{
|
||||||
vita_event_t event;
|
vita_event_t event;
|
||||||
@@ -227,9 +229,8 @@ int CmaClient::stop()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
CmaClient::setActive(false);
|
CmaClient::setActive(false);
|
||||||
cancel.lock();
|
VitaMTP_Cancel_Get_Wireless_Vita();
|
||||||
is_cancelled = true;
|
usbcondition.wakeAll();
|
||||||
cancel.unlock();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSemaphore>
|
#include <QSemaphore>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QWaitCondition>
|
||||||
|
|
||||||
#include <vitamtp.h>
|
#include <vitamtp.h>
|
||||||
|
|
||||||
@@ -59,11 +60,11 @@ private:
|
|||||||
//TODO: move all the control variables to the client manager class
|
//TODO: move all the control variables to the client manager class
|
||||||
static bool is_active;
|
static bool is_active;
|
||||||
static bool in_progress;
|
static bool in_progress;
|
||||||
static int is_cancelled;
|
|
||||||
static CmaClient *this_object;
|
static CmaClient *this_object;
|
||||||
static QMutex mutex;
|
static QMutex mutex;
|
||||||
static QMutex runner;
|
static QMutex runner;
|
||||||
static QMutex cancel;
|
static QMutex usbwait;
|
||||||
|
static QWaitCondition usbcondition;
|
||||||
static QSemaphore sema;
|
static QSemaphore sema;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@@ -77,7 +77,7 @@ void MainWidget::dialogResult(int result)
|
|||||||
void MainWidget::stopServer()
|
void MainWidget::stopServer()
|
||||||
{
|
{
|
||||||
setTrayTooltip(tr("Shutting down..."));
|
setTrayTooltip(tr("Shutting down..."));
|
||||||
receiveMessage(tr("Stopping QCMA..."));
|
receiveMessage(tr("Stopping QCMA (disconnect your PS Vita)"));
|
||||||
manager.stop();
|
manager.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user