Added selector to override the default protocol version.

This commit is contained in:
codestation
2014-10-10 20:42:16 -04:30
parent 0ab3206d18
commit caf5dc2d4e
10 changed files with 235 additions and 115 deletions

View File

@@ -24,6 +24,7 @@
#include <QDebug>
#include <QDir>
#include <QImage>
#include <QSettings>
#ifdef Q_OS_WIN32
#include <windows.h>
@@ -184,3 +185,51 @@ QString readable_size(qint64 size, bool use_gib)
}
return QString().setNum(size_f,'f',2) + " " + unit;
}
int getProtocolVersion()
{
bool useCustom = QSettings().value("useCustomProtocol").toBool();
if(useCustom)
{
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:
protocol = VITAMTP_PROTOCOL_FW_3_30;
break;
case 1:
protocol = VITAMTP_PROTOCOL_FW_3_10;
break;
case 2:
protocol = VITAMTP_PROTOCOL_FW_3_00;
break;
case 3:
protocol = VITAMTP_PROTOCOL_FW_2_60;
break;
case 4:
protocol = VITAMTP_PROTOCOL_FW_2_10;
break;
case 5:
protocol = VITAMTP_PROTOCOL_FW_2_00;
break;
case 6:
protocol = VITAMTP_WIRELESS_FW_2_00;
break;
default:
protocol = VITAMTP_PROTOCOL_MAX_VERSION;
break;
}
return protocol;
}
}