Added selector to override the default protocol version.
This commit is contained in:
@@ -62,7 +62,6 @@ 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->resetProtocolButton, SIGNAL(clicked()), this, SLOT(resetButtonPressed()));
|
||||
}
|
||||
|
||||
void ConfigWidget::setDefaultData()
|
||||
@@ -100,8 +99,16 @@ void ConfigWidget::setDefaultData()
|
||||
ui->videoSkipCheck->setChecked(settings.value("videoSkip", false).toBool());
|
||||
ui->musicSkipCheck->setChecked(settings.value("musicSkip", false).toBool());
|
||||
|
||||
int protocol_version = settings.value("protocolVersion", VITAMTP_PROTOCOL_MAX_VERSION).toInt();
|
||||
ui->protocolEdit->setText(QString::number(protocol_version));
|
||||
ui->customProtocolCheckBox->setChecked(settings.value("useCustomProtocol", false).toBool());
|
||||
ui->protocolBox->setCurrentIndex(settings.value("protocolIndex", 0).toInt());
|
||||
|
||||
bool ok;
|
||||
int protocol_version = settings.value("protocolVersion", VITAMTP_PROTOCOL_MAX_VERSION).toInt(&ok);
|
||||
|
||||
if(ok && protocol_version > 0)
|
||||
ui->protocolEdit->setText(QString::number(protocol_version));
|
||||
else
|
||||
ui->protocolEdit->setText(QString::number(VITAMTP_PROTOCOL_MAX_VERSION));
|
||||
}
|
||||
|
||||
ConfigWidget::~ConfigWidget()
|
||||
@@ -109,11 +116,6 @@ ConfigWidget::~ConfigWidget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ConfigWidget::resetButtonPressed()
|
||||
{
|
||||
ui->protocolEdit->setText(QString::number(VITAMTP_PROTOCOL_MAX_VERSION));
|
||||
}
|
||||
|
||||
void ConfigWidget::browseBtnPressed(int btn)
|
||||
{
|
||||
QString msg;
|
||||
@@ -188,7 +190,17 @@ void ConfigWidget::accept()
|
||||
settings.setValue("photoSkip", ui->photoSkipCheck->isChecked());
|
||||
settings.setValue("videoSkip", ui->videoSkipCheck->isChecked());
|
||||
settings.setValue("musicSkip", ui->musicSkipCheck->isChecked());
|
||||
settings.setValue("protocolVersion", ui->protocolEdit->text().toInt());
|
||||
settings.setValue("useCustomProtocol", ui->customProtocolCheckBox->isChecked());
|
||||
settings.setValue("protocolIndex", ui->protocolBox->currentIndex());
|
||||
|
||||
bool ok;
|
||||
int protocol = ui->protocolEdit->text().toInt(&ok);
|
||||
|
||||
if(ok && protocol > 0)
|
||||
settings.setValue("protocolVersion", protocol);
|
||||
else
|
||||
settings.setValue("protocolVersion", VITAMTP_PROTOCOL_MAX_VERSION);
|
||||
|
||||
settings.sync();
|
||||
|
||||
done(Accepted);
|
||||
|
||||
@@ -48,7 +48,6 @@ private:
|
||||
|
||||
private slots:
|
||||
void browseBtnPressed(int from);
|
||||
void resetButtonPressed();
|
||||
void accept();
|
||||
};
|
||||
|
||||
|
||||
@@ -368,25 +368,82 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>CMA Protocol version</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="protocolBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">FW 3.30 - 1900010</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">FW 3.10 - 1800010</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">FW 3.00 - 1700010</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">FW 2.60 - 1600010</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">FW 2.10 - 1500010</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">FW 2.00 - 1400010</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">FW 1.00 - 1000000</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="customProtocolCheckBox">
|
||||
<property name="text">
|
||||
<string>Use custom version</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="protocolEdit">
|
||||
<property name="inputMask">
|
||||
<string notr="true">9999999</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetProtocolButton">
|
||||
<property name="text">
|
||||
<string>Reset to default</string>
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user