Delay the progress dialog by one second so it doesn't show on quick scans.
Do not show the disconnect message if no connection is established. Show correct directory separators on Windows.
This commit is contained in:
@@ -38,6 +38,7 @@ ClientManager::~ClientManager()
|
||||
|
||||
void ClientManager::databaseUpdated(int count)
|
||||
{
|
||||
progress.interruptShow();
|
||||
progress.hide();
|
||||
if(count >= 0) {
|
||||
emit messageSent(tr("Added %1 items to the database").arg(count));
|
||||
@@ -130,7 +131,7 @@ void ClientManager::refreshDatabase()
|
||||
emit messageSent(tr("No PS Vita system has been registered"));
|
||||
}
|
||||
} else {
|
||||
progress.show();
|
||||
progress.showDelayed(1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -251,3 +251,15 @@ void CmaClient::setActive(bool state)
|
||||
is_active = state;
|
||||
}
|
||||
|
||||
bool CmaClient::isRunning()
|
||||
{
|
||||
bool ret;
|
||||
if(mutex.tryLock()) {
|
||||
ret = in_progress;
|
||||
mutex.unlock();
|
||||
} else {
|
||||
ret = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -38,6 +38,7 @@ class CmaClient : public QObject
|
||||
public:
|
||||
explicit CmaClient(QObject *parent = 0);
|
||||
|
||||
static bool isRunning();
|
||||
void launch();
|
||||
|
||||
private:
|
||||
|
@@ -67,17 +67,17 @@ void ConfigWidget::setDefaultData()
|
||||
QString defaultdir;
|
||||
QSettings settings;
|
||||
defaultdir = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
||||
ui->photoPath->setText(settings.value("photoPath", defaultdir).toString());
|
||||
ui->photoPath->setText(QDir::toNativeSeparators(settings.value("photoPath", defaultdir).toString()));
|
||||
defaultdir = QStandardPaths::writableLocation(QStandardPaths::MusicLocation);
|
||||
ui->musicPath->setText(settings.value("musicPath", defaultdir).toString());
|
||||
ui->musicPath->setText(QDir::toNativeSeparators(settings.value("musicPath", defaultdir).toString()));
|
||||
defaultdir = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
|
||||
ui->videoPath->setText(settings.value("videoPath", defaultdir).toString());
|
||||
ui->videoPath->setText(QDir::toNativeSeparators(settings.value("videoPath", defaultdir).toString()));
|
||||
defaultdir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||
defaultdir.append(QDir::separator()).append("PS Vita");
|
||||
ui->appPath->setText(settings.value("appsPath", defaultdir).toString());
|
||||
ui->appPath->setText(QDir::toNativeSeparators(settings.value("appsPath", defaultdir).toString()));
|
||||
defaultdir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||
defaultdir.append(QDir::separator()).append("PSV Updates");
|
||||
ui->urlPath->setText(settings.value("urlPath", defaultdir).toString());
|
||||
ui->urlPath->setText(QDir::toNativeSeparators(settings.value("urlPath", defaultdir).toString()));
|
||||
|
||||
ui->offlineCheck->setChecked(settings.value("offlineMode", true).toBool());
|
||||
ui->metadataCheck->setChecked(settings.value("skipMetadata", false).toBool());
|
||||
@@ -128,7 +128,7 @@ void ConfigWidget::browseBtnPressed(int btn)
|
||||
QString selected = QFileDialog::getExistingDirectory(this, msg, lineedit->text(), QFileDialog::ShowDirsOnly);
|
||||
|
||||
if(!selected.isEmpty()) {
|
||||
lineedit->setText(selected);
|
||||
lineedit->setText(QDir::toNativeSeparators((selected)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ void ConfigWidget::savePath(QSettings &settings, const QLineEdit *edit, const QS
|
||||
if(path.endsWith(QDir::separator())) {
|
||||
path.chop(1);
|
||||
}
|
||||
settings.setValue(key, path);
|
||||
settings.setValue(key, QDir::fromNativeSeparators(path));
|
||||
QDir(QDir::root()).mkpath(path);
|
||||
}
|
||||
|
||||
|
@@ -62,3 +62,16 @@ void ProgressForm::setDirectoryName(QString dir)
|
||||
QString elided = ui->directoryLabel->fontMetrics().elidedText(dir, Qt::ElideMiddle, ui->directoryLabel->width(), 0);
|
||||
ui->directoryLabel->setText(elided);
|
||||
}
|
||||
|
||||
void ProgressForm::showDelayed(int msec)
|
||||
{
|
||||
timer.setSingleShot(true);
|
||||
timer.setInterval(msec);
|
||||
connect(&timer, SIGNAL(timeout()), this, SLOT(show()));
|
||||
timer.start();
|
||||
}
|
||||
|
||||
void ProgressForm::interruptShow()
|
||||
{
|
||||
timer.stop();
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#ifndef PROGRESSFORM_H
|
||||
#define PROGRESSFORM_H
|
||||
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
@@ -34,9 +35,14 @@ public:
|
||||
explicit ProgressForm(QWidget *parent = 0);
|
||||
~ProgressForm();
|
||||
|
||||
void showDelayed(int msec = 1000);
|
||||
void interruptShow();
|
||||
|
||||
private:
|
||||
Ui::ProgressForm *ui;
|
||||
|
||||
QTimer timer;
|
||||
|
||||
signals:
|
||||
void canceled();
|
||||
|
||||
|
@@ -77,7 +77,9 @@ void MainWidget::dialogResult(int result)
|
||||
void MainWidget::stopServer()
|
||||
{
|
||||
setTrayTooltip(tr("Shutting down..."));
|
||||
receiveMessage(tr("Stopping QCMA (disconnect your PS Vita)"));
|
||||
if(CmaClient::isRunning()) {
|
||||
receiveMessage(tr("Stopping QCMA (disconnect your PS Vita)"));
|
||||
}
|
||||
manager.stop();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user