diff --git a/qcma_common.pri b/qcma_common.pri
index 807ea50..f7c1e28 100644
--- a/qcma_common.pri
+++ b/qcma_common.pri
@@ -24,7 +24,7 @@ SOURCES += \
src/sqlitedb.cpp \
src/httpdownloader.cpp \
src/qlistdb.cpp \
- src/database.cpp \
+ src/database.cpp
HEADERS += \
src/capability.h \
@@ -40,7 +40,7 @@ HEADERS += \
src/sqlitedb.h \
src/httpdownloader.h \
src/qlistdb.h \
- src/database.h \
+ src/database.h
OTHER_FILES += \
resources/xml/psp2-updatelist.xml \
diff --git a/src/capability.cpp b/src/capability.cpp
index 12fa0cd..b41137c 100644
--- a/src/capability.cpp
+++ b/src/capability.cpp
@@ -42,7 +42,11 @@ bool DeviceCapability::exchangeInfo(vita_device_t *device)
}
QString hostname = QHostInfo::localHostName();
+
int protocol_version = ::getVitaProtocolVersion();
+
+ qDebug() << "Sending Qcma protocol version:" << protocol_version;
+
const initiator_info_t *pc_info = VitaMTP_Data_Initiator_New(hostname.toUtf8().data(), protocol_version);
// Next, we send the client's (this program) info (discard the const here)
diff --git a/src/cmautils.cpp b/src/cmautils.cpp
index 284ffd5..bd92023 100644
--- a/src/cmautils.cpp
+++ b/src/cmautils.cpp
@@ -188,20 +188,14 @@ QString readable_size(qint64 size, bool use_gib)
int getVitaProtocolVersion()
{
- bool useCustom = QSettings().value("useCustomProtocol").toBool();
- if(useCustom)
+ QString protocol_mode = QSettings().value("protocolMode", "automatic").toString();
+
+ int protocol;
+
+ if(protocol_mode == "manual")
{
- bool ok;
- int protocol = QSettings().value("protocolVersion").toInt(&ok);
- if(ok && protocol > 0)
- return protocol;
- else
- return VITAMTP_PROTOCOL_MAX_VERSION;
- }
- else
- {
- int protocol;
int index = QSettings().value("protocolIndex").toInt();
+
switch(index)
{
case 0:
@@ -223,13 +217,32 @@ int getVitaProtocolVersion()
protocol = VITAMTP_PROTOCOL_FW_2_00;
break;
case 6:
- protocol = VITAMTP_WIRELESS_FW_2_00;
+ protocol = 1300010; // VITAMTP_PROTOCOL_FW_1_80
+ break;
+ case 7:
+ protocol = 1200010; // VITAMTP_PROTOCOL_FW_1_60
+ break;
+ case 8:
+ protocol = 1100010; // VITAMTP_PROTOCOL_FW_1_50
+ break;
+ case 9:
+ protocol = 1000010; // VITAMTP_PROTOCOL_FW_1_00
break;
default:
protocol = VITAMTP_PROTOCOL_MAX_VERSION;
break;
}
-
- return protocol;
}
+ else if(protocol_mode == "custom")
+ {
+ bool ok;
+ int protocol = QSettings().value("protocolVersion").toInt(&ok);
+
+ if(!ok || protocol <= 0)
+ protocol = VITAMTP_PROTOCOL_MAX_VERSION;
+ }
+ else
+ protocol = VITAMTP_PROTOCOL_MAX_VERSION;
+
+ return protocol;
}
diff --git a/src/forms/configwidget.cpp b/src/forms/configwidget.cpp
index 4418404..4640a08 100644
--- a/src/forms/configwidget.cpp
+++ b/src/forms/configwidget.cpp
@@ -62,6 +62,32 @@ void ConfigWidget::connectSignals()
connect(mapper, SIGNAL(mapped(int)), this, SLOT(browseBtnPressed(int)));
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+ connect(ui->protocolModeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(protocolModeChanged(int)));
+}
+
+void ConfigWidget::protocolModeChanged(int index)
+{
+ switch(index)
+ {
+ case 0:
+ ui->protocolBox->setEnabled(false);
+ ui->protocolEdit->setEnabled(false);
+ break;
+ case 1:
+ ui->protocolBox->setEnabled(true);
+ ui->protocolEdit->setEnabled(false);
+ break;
+ case 2:
+ ui->protocolBox->setEnabled(false);
+ ui->protocolEdit->setEnabled(true);
+ break;
+ default:
+ ui->protocolBox->setEnabled(false);
+ ui->protocolEdit->setEnabled(false);
+ break;
+ }
+
}
void ConfigWidget::setDefaultData()
@@ -99,7 +125,17 @@ void ConfigWidget::setDefaultData()
ui->videoSkipCheck->setChecked(settings.value("videoSkip", false).toBool());
ui->musicSkipCheck->setChecked(settings.value("musicSkip", false).toBool());
- ui->customProtocolCheckBox->setChecked(settings.value("useCustomProtocol", false).toBool());
+ QString protocol_mode = settings.value("protocolMode", "automatic").toString();
+
+ if(protocol_mode == "manual")
+ ui->protocolModeBox->setCurrentIndex(1);
+ else if(protocol_mode == "custom")
+ ui->protocolModeBox->setCurrentIndex(2);
+ else
+ ui->protocolModeBox->setCurrentIndex(0);
+
+ protocolModeChanged(ui->protocolModeBox->currentIndex());
+
ui->protocolBox->setCurrentIndex(settings.value("protocolIndex", 0).toInt());
bool ok;
@@ -190,9 +226,15 @@ void ConfigWidget::accept()
settings.setValue("photoSkip", ui->photoSkipCheck->isChecked());
settings.setValue("videoSkip", ui->videoSkipCheck->isChecked());
settings.setValue("musicSkip", ui->musicSkipCheck->isChecked());
- settings.setValue("useCustomProtocol", ui->customProtocolCheckBox->isChecked());
settings.setValue("protocolIndex", ui->protocolBox->currentIndex());
+ if(ui->protocolModeBox->currentIndex() == 0)
+ settings.setValue("protocolMode", "automatic");
+ else if(ui->protocolModeBox->currentIndex() == 1)
+ settings.setValue("protocolMode", "manual");
+ else if(ui->protocolModeBox->currentIndex() == 2)
+ settings.setValue("protocolMode", "custom");
+
bool ok;
int protocol = ui->protocolEdit->text().toInt(&ok);
diff --git a/src/forms/configwidget.h b/src/forms/configwidget.h
index eeda29e..068c044 100644
--- a/src/forms/configwidget.h
+++ b/src/forms/configwidget.h
@@ -47,6 +47,7 @@ private:
Ui::ConfigWidget *ui;
private slots:
+ void protocolModeChanged(int index);
void browseBtnPressed(int from);
void accept();
};
diff --git a/src/forms/configwidget.ui b/src/forms/configwidget.ui
index 74a9220..917df70 100644
--- a/src/forms/configwidget.ui
+++ b/src/forms/configwidget.ui
@@ -6,8 +6,8 @@
0
0
- 532
- 457
+ 519
+ 525
@@ -375,17 +375,17 @@
QFormLayout::AllNonFixedFieldsGrow
- -
+
-
- CMA Protocol version
+ CMA protocol version
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
- -
+
-
@@ -425,34 +425,27 @@
-
- FW 1.80 - 1300010
+ FW 1.80 - 1300010
-
- FW 1.60 - 1200010
+ FW 1.60 - 1200010
-
- FW 1.50 - 1100010
+ FW 1.50 - 1100010
-
- FW 1.00 - 1000010
+ FW 1.00 - 1000010
- -
-
-
- Use custom version
-
-
-
- -
+
-
9999999
@@ -462,6 +455,39 @@
+ -
+
+
+ CMA protocol selection
+
+
+
+ -
+
+
-
+
+ Latest
+
+
+ -
+
+ Manual
+
+
+ -
+
+ Custom
+
+
+
+
+ -
+
+
+ CMA custom version
+
+
+
-
diff --git a/src/gui/mainwidget.cpp b/src/gui/mainwidget.cpp
index af0ebb3..36054d5 100644
--- a/src/gui/mainwidget.cpp
+++ b/src/gui/mainwidget.cpp
@@ -215,14 +215,21 @@ void MainWidget::refreshDatabase()
TrayIndicator *MainWidget::createTrayObject(QWidget *parent)
{
TrayFunctionPointer create_tray = NULL;
+
#ifdef Q_OS_LINUX
QString desktop = getenv("XDG_CURRENT_DESKTOP");
qDebug() << "Current desktop: " << desktop;
+#ifdef QT_DEBUG
+ QString library_path = QApplication::applicationDirPath();
+#else
+ QString library_path = "/usr/lib/qcma";
+#endif
+
if(desktop.toLower() == "kde")
{
// KDENotifier
- QLibrary library("/usr/lib/qcma/libqcma_kdenotifier.so");
+ QLibrary library(library_path + "/libqcma_kdenotifier.so");
if(library.load())
create_tray = reinterpret_cast(library.resolve("createTrayIndicator"));
else
@@ -233,7 +240,7 @@ TrayIndicator *MainWidget::createTrayObject(QWidget *parent)
// if(desktop.toLower() == "unity")
{
// AppIndicator
- QLibrary library("/usr/lib/qcma/libqcma_appindicator.so");
+ QLibrary library(library_path + "/libqcma_appindicator.so");
if(library.load())
create_tray = reinterpret_cast(library.resolve("createTrayIndicator"));
else
diff --git a/src/indicator/trayindicator.h b/src/indicator/trayindicator.h
index 68fd3fe..a0d341d 100644
--- a/src/indicator/trayindicator.h
+++ b/src/indicator/trayindicator.h
@@ -35,7 +35,7 @@ class TrayIndicator : public QWidget
{
Q_OBJECT
public:
- virtual ~TrayIndicator() {}
+ ~TrayIndicator() {}
virtual void init() = 0;
virtual bool isVisible() = 0;
virtual void setIcon(const QString &icon) = 0;