diff options
Diffstat (limited to '')
-rw-r--r-- | heimdall-frontend/Source/mainwindow.cpp | 52 | ||||
-rw-r--r-- | heimdall-frontend/mainwindow.ui | 6 |
2 files changed, 49 insertions, 9 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
{
diff --git a/heimdall-frontend/mainwindow.ui b/heimdall-frontend/mainwindow.ui index 984f4ba..4aaf6fa 100644 --- a/heimdall-frontend/mainwindow.ui +++ b/heimdall-frontend/mainwindow.ui @@ -414,9 +414,9 @@ </property>
<property name="geometry">
<rect>
- <x>310</x>
+ <x>320</x>
<y>130</y>
- <width>311</width>
+ <width>301</width>
<height>31</height>
</rect>
</property>
@@ -451,7 +451,7 @@ <rect>
<x>10</x>
<y>130</y>
- <width>291</width>
+ <width>301</width>
<height>21</height>
</rect>
</property>
|