summaryrefslogtreecommitdiffstats
path: root/heimdall-frontend/Source/mainwindow.cpp
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell@glassechidna.com.au>2011-07-20 18:43:49 +0200
committerBenjamin Dobell <benjamin.dobell@glassechidna.com.au>2011-07-20 18:43:49 +0200
commitbabef8e580c4b9d2daae1bd7b4092b59b5fa70be (patch)
tree87155afe8e797d1d0b6a24f12725c07c6d23995f /heimdall-frontend/Source/mainwindow.cpp
parentDocumentation update. (diff)
downloadHeimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.tar
Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.tar.gz
Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.tar.bz2
Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.tar.lz
Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.tar.xz
Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.tar.zst
Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.zip
Diffstat (limited to 'heimdall-frontend/Source/mainwindow.cpp')
-rw-r--r--heimdall-frontend/Source/mainwindow.cpp52
1 files changed, 46 insertions, 6 deletions
diff --git a/heimdall-frontend/Source/mainwindow.cpp b/heimdall-frontend/Source/mainwindow.cpp
index b71aef1..f3732c4 100644
--- a/heimdall-frontend/Source/mainwindow.cpp
+++ b/heimdall-frontend/Source/mainwindow.cpp
@@ -571,9 +571,26 @@ void MainWindow::SelectPartitionName(int index)
unsigned int newPartitionIndex = unusedPartitionIds[index];
unusedPartitionIds.removeAt(index);
- FileInfo& partitionInfo = workingPackageData.GetFirmwareInfo().GetFileInfos()[partitionsListWidget->currentRow()];
- unusedPartitionIds.append(partitionInfo.GetPartitionId());
- partitionInfo.SetPartitionId(newPartitionIndex);
+ FileInfo& fileInfo = workingPackageData.GetFirmwareInfo().GetFileInfos()[partitionsListWidget->currentRow()];
+ unusedPartitionIds.append(fileInfo.GetPartitionId());
+ fileInfo.SetPartitionId(newPartitionIndex);
+
+ if (!fileInfo.GetFilename().isEmpty())
+ {
+ PitEntry *pitEntry = currentPitData.FindEntry(newPartitionIndex);
+ QString partitionFilename = pitEntry->GetFilename();
+ int lastPeriod = partitionFilename.lastIndexOf(QChar('.'));
+
+ if (lastPeriod >= 0)
+ {
+ QString partitionFileExtension = partitionFilename.mid(lastPeriod + 1);
+
+ lastPeriod = fileInfo.GetFilename().lastIndexOf(QChar('.'));
+
+ if (lastPeriod < 0 || fileInfo.GetFilename().mid(lastPeriod + 1) != partitionFileExtension)
+ Alerts::DisplayWarning(QString("%1 partition expects files with file extension \"%2\".").arg(pitEntry->GetPartitionName(), partitionFileExtension));
+ }
+ }
partitionNameComboBox->clear();
@@ -588,9 +605,25 @@ void MainWindow::SelectPartitionFile(void)
{
QString path = PromptFileSelection();
- if (path != "" && !IsArchive(path))
+ if (path != "")
{
- workingPackageData.GetFirmwareInfo().GetFileInfos()[partitionsListWidget->currentRow()].SetFilename(path);
+ FileInfo& fileInfo = workingPackageData.GetFirmwareInfo().GetFileInfos()[partitionsListWidget->currentRow()];
+ PitEntry *pitEntry = currentPitData.FindEntry(fileInfo.GetPartitionId());
+
+ QString partitionFilename = pitEntry->GetFilename();
+ int lastPeriod = partitionFilename.lastIndexOf(QChar('.'));
+
+ if (lastPeriod >= 0)
+ {
+ QString partitionFileExtension = partitionFilename.mid(lastPeriod + 1);
+
+ lastPeriod = path.lastIndexOf(QChar('.'));
+
+ if (lastPeriod < 0 || path.mid(lastPeriod + 1) != partitionFileExtension)
+ Alerts::DisplayWarning(QString("%1 partition expects files with file extension \"%2\".").arg(pitEntry->GetPartitionName(), partitionFileExtension));
+ }
+
+ fileInfo.SetFilename(path);
partitionFileLineEdit->setText(path);
pitBrowseButton->setEnabled(true);
@@ -1050,9 +1083,16 @@ void MainWindow::HandleHeimdallReturned(int exitCode, QProcess::ExitStatus exitS
if (exitStatus == QProcess::NormalExit && byteExitCode >= 0)
{
if (heimdallState == MainWindow::kHeimdallStateFlashing)
- flashLabel->setText("Flash completed sucessfully!");
+ {
+ if (byteExitCode == 1)
+ flashLabel->setText("Failed to detect compatible device!");
+ else
+ flashLabel->setText("Flash completed sucessfully!");
+ }
else if (heimdallState == MainWindow::kHeimdallStateDetectingDevice)
+ {
deviceDetectedRadioButton->setChecked(byteExitCode == 0);
+ }
}
else
{