Added backup manager.
This commit is contained in:
@@ -15,6 +15,7 @@ official CMA and also offer some features missing in the original one.
|
||||
* Basic metadata for single songs (album, artist, title, cover art).
|
||||
* Basic metadata for videos (duration, dimensions, thumbnail).
|
||||
* Basic metadata for photos (dimensions, thumbnails).
|
||||
* Simple backup browser: view and delete the backups on your PC without a Vita.
|
||||
* Easy wireless pairing (show PIN to the user when a Vita is detected).
|
||||
* Ability to restart the connection if the Vita is reconnected.
|
||||
|
||||
@@ -24,11 +25,6 @@ official CMA and also offer some features missing in the original one.
|
||||
* Fix streaming for music.
|
||||
|
||||
## Planned features
|
||||
* **Backup browser**: provide a human readable listing of the games saved on the
|
||||
computer (name, icon, side on disk) and provide some actions (delete savedata,
|
||||
patches or the whole game without need of the Vita). Also some sort of interface
|
||||
to prepare VHBL homebrew in the folder of the exploited savedata.
|
||||
|
||||
* **DLNA bridge**: connect an existing DLNA server to interface with the Vita
|
||||
using the wireless streaming feature.
|
||||
|
||||
|
@@ -15,11 +15,12 @@ public:
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
Database db;
|
||||
|
||||
private:
|
||||
int thread_count;
|
||||
QMutex mutex;
|
||||
|
||||
Database db;
|
||||
QThread *usb_thread;
|
||||
QThread *wireless_thread;
|
||||
|
||||
|
@@ -279,7 +279,7 @@ CMAObject *Database::pathToObjectInternal(const root_list &list, const char *pat
|
||||
root_list::const_iterator skipped_first = ++list.begin();
|
||||
|
||||
for(root_list::const_iterator obj = skipped_first; obj != list.end(); ++obj) {
|
||||
if(strcmp(path, (*obj)->metadata.path) == 0) {
|
||||
if(strcasecmp(path, (*obj)->metadata.path) == 0) {
|
||||
return (*obj);
|
||||
}
|
||||
}
|
||||
|
@@ -99,6 +99,7 @@ void MainWidget::connectSignals()
|
||||
connect(&manager, SIGNAL(deviceConnected(QString)), this, SLOT(receiveMessage(QString)));
|
||||
connect(&manager, SIGNAL(deviceConnected(QString)), this, SLOT(setTrayTooltip(QString)));
|
||||
connect(&manager, SIGNAL(deviceDisconnected()), this, SLOT(deviceDisconnect()));
|
||||
form.db = &manager.db;
|
||||
}
|
||||
|
||||
void MainWidget::setTrayTooltip(QString message)
|
||||
@@ -106,19 +107,28 @@ void MainWidget::setTrayTooltip(QString message)
|
||||
trayIcon->setToolTip(message);
|
||||
}
|
||||
|
||||
void MainWidget::openManager()
|
||||
{
|
||||
form.loadBackupListing(0);
|
||||
form.show();
|
||||
}
|
||||
|
||||
void MainWidget::createTrayIcon()
|
||||
{
|
||||
options = new QAction(tr("&Settings"), this);
|
||||
reload = new QAction(tr("&Refresh database"), this);
|
||||
backup = new QAction(tr("Backup Manager"), this);
|
||||
quit = new QAction(tr("&Quit"), this);
|
||||
|
||||
connect(options, SIGNAL(triggered()), &dialog, SLOT(open()));
|
||||
connect(backup, SIGNAL(triggered()), this, SLOT(openManager()));
|
||||
connect(reload, SIGNAL(triggered()), &manager, SLOT(refreshDatabase()));
|
||||
connect(quit, SIGNAL(triggered()), this, SLOT(stopServer()));
|
||||
|
||||
QMenu *trayIconMenu = new QMenu(this);
|
||||
trayIconMenu->addAction(options);
|
||||
trayIconMenu->addAction(reload);
|
||||
trayIconMenu->addAction(backup);
|
||||
trayIconMenu->addSeparator();
|
||||
trayIconMenu->addAction(quit);
|
||||
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "configwidget.h"
|
||||
#include "clientmanager.h"
|
||||
#include "backupmanagerform.h"
|
||||
#include "cmaclient.h"
|
||||
|
||||
#include <QAction>
|
||||
@@ -46,10 +47,12 @@ private:
|
||||
|
||||
bool first_run;
|
||||
ConfigWidget dialog;
|
||||
BackupManagerForm form;
|
||||
QSystemTrayIcon *trayIcon;
|
||||
QAction *quit;
|
||||
QAction *reload;
|
||||
QAction *options;
|
||||
QAction *backup;
|
||||
ClientManager manager;
|
||||
const static QStringList path_list;
|
||||
|
||||
@@ -60,6 +63,7 @@ private slots:
|
||||
void setTrayTooltip(QString message);
|
||||
void showPin(int pin);
|
||||
void stopServer();
|
||||
void openManager();
|
||||
};
|
||||
|
||||
#endif // MAINWIDGET_H
|
||||
|
15
qcma.pro
15
qcma.pro
@@ -28,7 +28,10 @@ SOURCES += main.cpp \
|
||||
cmabroadcast.cpp \
|
||||
avdecoder.cpp \
|
||||
cmaevent.cpp \
|
||||
clientmanager.cpp
|
||||
clientmanager.cpp \
|
||||
backupmanagerform.cpp \
|
||||
backupitem.cpp \
|
||||
confirmdialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
capability.h \
|
||||
@@ -45,7 +48,10 @@ HEADERS += \
|
||||
cmabroadcast.h \
|
||||
avdecoder.h \
|
||||
cmaevent.h \
|
||||
clientmanager.h
|
||||
clientmanager.h \
|
||||
backupmanagerform.h \
|
||||
backupitem.h \
|
||||
confirmdialog.h
|
||||
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += libvitamtp libavformat libavcodec libavutil libswscale
|
||||
@@ -61,6 +67,9 @@ OTHER_FILES += \
|
||||
README.md
|
||||
|
||||
FORMS += \
|
||||
configwidget.ui
|
||||
configwidget.ui \
|
||||
backupmanagerform.ui \
|
||||
backupitem.ui \
|
||||
confirmdialog.ui
|
||||
|
||||
|
||||
|
20
utils.cpp
20
utils.cpp
@@ -155,3 +155,23 @@ QByteArray getThumbnail(const QString &path, DataType type, metadata_t *metadata
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
QString readable_size(quint64 size, bool use_gib)
|
||||
{
|
||||
QStringList list;
|
||||
list << "KiB" << "MiB";
|
||||
if(use_gib) {
|
||||
list << "GiB";
|
||||
}
|
||||
|
||||
QStringListIterator i(list);
|
||||
QString unit("bytes");
|
||||
|
||||
float size_f = size;
|
||||
|
||||
while(size_f >= 1024.0 && i.hasNext()) {
|
||||
unit = i.next();
|
||||
size_f /= 1024.0;
|
||||
}
|
||||
return QString().setNum(size_f,'f',2) + " " + unit;
|
||||
}
|
||||
|
1
utils.h
1
utils.h
@@ -48,5 +48,6 @@ public:
|
||||
bool removeRecursively(const QString &dirName);
|
||||
bool getDiskSpace(const QString &dir, quint64 *free, quint64 *total);
|
||||
QByteArray getThumbnail(const QString &path, DataType type, metadata_t *metadata);
|
||||
QString readable_size(quint64 size, bool use_gib = false);
|
||||
|
||||
#endif // UTILS_H
|
||||
|
Reference in New Issue
Block a user