Merge pull request #2611 from Cacodemon345/qt-cylinderfix
qt: large sizes when entered no longer decrement by 1MB
This commit is contained in:
@@ -39,6 +39,7 @@ extern "C" {
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include "qt_harddrive_common.hpp"
|
#include "qt_harddrive_common.hpp"
|
||||||
#include "qt_settings_bus_tracking.hpp"
|
#include "qt_settings_bus_tracking.hpp"
|
||||||
@@ -608,6 +609,7 @@ void HarddiskDialog::onExistingFileSelected(const QString &fileName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HarddiskDialog::recalcSize() {
|
void HarddiskDialog::recalcSize() {
|
||||||
|
if (disallowSizeModifications) return;
|
||||||
uint64_t size = (static_cast<uint64_t>(cylinders_) * static_cast<uint64_t>(heads_) * static_cast<uint64_t>(sectors_)) << 9;
|
uint64_t size = (static_cast<uint64_t>(cylinders_) * static_cast<uint64_t>(heads_) * static_cast<uint64_t>(sectors_)) << 9;
|
||||||
ui->lineEditSize->setText(QString::number(size >> 20));
|
ui->lineEditSize->setText(QString::number(size >> 20));
|
||||||
}
|
}
|
||||||
@@ -731,6 +733,7 @@ void HarddiskDialog::on_comboBoxBus_currentIndexChanged(int index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HarddiskDialog::on_lineEditSize_textEdited(const QString &text) {
|
void HarddiskDialog::on_lineEditSize_textEdited(const QString &text) {
|
||||||
|
disallowSizeModifications = true;
|
||||||
uint32_t size = text.toUInt();
|
uint32_t size = text.toUInt();
|
||||||
/* This is needed to ensure VHD standard compliance. */
|
/* This is needed to ensure VHD standard compliance. */
|
||||||
hdd_image_calc_chs(&cylinders_, &heads_, §ors_, size);
|
hdd_image_calc_chs(&cylinders_, &heads_, §ors_, size);
|
||||||
@@ -742,6 +745,8 @@ void HarddiskDialog::on_lineEditSize_textEdited(const QString &text) {
|
|||||||
checkAndAdjustCylinders();
|
checkAndAdjustCylinders();
|
||||||
checkAndAdjustHeads();
|
checkAndAdjustHeads();
|
||||||
checkAndAdjustSectors();
|
checkAndAdjustSectors();
|
||||||
|
|
||||||
|
disallowSizeModifications = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HarddiskDialog::on_lineEditCylinders_textEdited(const QString &text) {
|
void HarddiskDialog::on_lineEditCylinders_textEdited(const QString &text) {
|
||||||
|
@@ -50,6 +50,8 @@ private:
|
|||||||
uint32_t max_heads = 0;
|
uint32_t max_heads = 0;
|
||||||
uint32_t max_cylinders = 0;
|
uint32_t max_cylinders = 0;
|
||||||
|
|
||||||
|
bool disallowSizeModifications = false;
|
||||||
|
|
||||||
bool checkAndAdjustCylinders();
|
bool checkAndAdjustCylinders();
|
||||||
bool checkAndAdjustHeads();
|
bool checkAndAdjustHeads();
|
||||||
bool checkAndAdjustSectors();
|
bool checkAndAdjustSectors();
|
||||||
|
Reference in New Issue
Block a user