diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2007-07-31 19:11:44 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2007-07-31 19:11:44 +0000 |
commit | 5df9fc5c4086f8349d41c3c3f6d57050b0fdce40 (patch) | |
tree | 69a7e44c92295f74a5652b820f1138d9a4d7edc0 /rbutil | |
parent | c3a72f1b0a90436b92d68a8da2c2544dc4d581ad (diff) |
rbutilQt: the progressloggergui now uses little icons along the text.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14105 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r-- | rbutil/rbutilqt/icons/log-error.png | bin | 0 -> 784 bytes | |||
-rw-r--r-- | rbutil/rbutilqt/icons/log-info.png | bin | 0 -> 543 bytes | |||
-rw-r--r-- | rbutil/rbutilqt/icons/log-ok.png | bin | 0 -> 652 bytes | |||
-rw-r--r-- | rbutil/rbutilqt/icons/log-warning.png | bin | 0 -> 809 bytes | |||
-rw-r--r-- | rbutil/rbutilqt/install.cpp | 2 | ||||
-rw-r--r-- | rbutil/rbutilqt/installbl.cpp | 8 | ||||
-rw-r--r-- | rbutil/rbutilqt/installbl.h | 1 | ||||
-rw-r--r-- | rbutil/rbutilqt/installbootloader.cpp | 168 | ||||
-rw-r--r-- | rbutil/rbutilqt/installzip.cpp | 18 | ||||
-rw-r--r-- | rbutil/rbutilqt/installzipwindow.cpp | 8 | ||||
-rw-r--r-- | rbutil/rbutilqt/irivertools/irivertools.cpp | 44 | ||||
-rw-r--r-- | rbutil/rbutilqt/progressloggergui.cpp | 25 | ||||
-rw-r--r-- | rbutil/rbutilqt/progressloggergui.h | 2 | ||||
-rw-r--r-- | rbutil/rbutilqt/progressloggerinterface.h | 7 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.qrc | 11 |
15 files changed, 166 insertions, 128 deletions
diff --git a/rbutil/rbutilqt/icons/log-error.png b/rbutil/rbutilqt/icons/log-error.png Binary files differnew file mode 100644 index 0000000000..4c485f75b1 --- /dev/null +++ b/rbutil/rbutilqt/icons/log-error.png diff --git a/rbutil/rbutilqt/icons/log-info.png b/rbutil/rbutilqt/icons/log-info.png Binary files differnew file mode 100644 index 0000000000..bbd5dbaf5e --- /dev/null +++ b/rbutil/rbutilqt/icons/log-info.png diff --git a/rbutil/rbutilqt/icons/log-ok.png b/rbutil/rbutilqt/icons/log-ok.png Binary files differnew file mode 100644 index 0000000000..5e0c2b5d6f --- /dev/null +++ b/rbutil/rbutilqt/icons/log-ok.png diff --git a/rbutil/rbutilqt/icons/log-warning.png b/rbutil/rbutilqt/icons/log-warning.png Binary files differnew file mode 100644 index 0000000000..9a8c5bb9c5 --- /dev/null +++ b/rbutil/rbutilqt/icons/log-warning.png diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp index 49bdb14c53..2818d1af61 100644 --- a/rbutil/rbutilqt/install.cpp +++ b/rbutil/rbutilqt/install.cpp @@ -105,7 +105,7 @@ void Install::accept() userSettings->setValue("defaults/mountpoint", mountPoint); } else { - logger->addItem(tr("Mount point is wrong!")); + logger->addItem(tr("Mount point is wrong!"),LOGERROR); logger->abort(); return; } diff --git a/rbutil/rbutilqt/installbl.cpp b/rbutil/rbutilqt/installbl.cpp index 3eaf9afdaf..627fa961b6 100644 --- a/rbutil/rbutilqt/installbl.cpp +++ b/rbutil/rbutilqt/installbl.cpp @@ -98,7 +98,7 @@ void InstallBl::accept() userSettings->setValue("defaults/mountpoint", mountPoint);
}
else {
- logger->addItem(tr("Mount point is wrong!"));
+ logger->addItem(tr("Mount point is wrong!"),LOGERROR);
logger->abort();
return;
}
@@ -107,9 +107,9 @@ void InstallBl::accept() {
m_OrigFirmware = ui.lineOriginalFirmware->text();
}
- else
+ else if(needextrafile)
{
- logger->addItem(tr("Original Firmware Path is wrong!"));
+ logger->addItem(tr("Original Firmware Path is wrong!"),LOGERROR);
logger->abort();
return;
}
@@ -160,12 +160,14 @@ void InstallBl::setDeviceSettings(QSettings *dev) ui.buttonBrowseOF->show();
ui.lineOriginalFirmware->show();
ui.label_3->show();
+ needextrafile = true;
}
else
{
ui.buttonBrowseOF->hide();
ui.lineOriginalFirmware->hide();
ui.label_3->hide();
+ needextrafile = false;
}
qDebug() << "Install::setDeviceSettings:" << devices;
}
diff --git a/rbutil/rbutilqt/installbl.h b/rbutil/rbutilqt/installbl.h index 4f38242040..09e3492e43 100644 --- a/rbutil/rbutilqt/installbl.h +++ b/rbutil/rbutilqt/installbl.h @@ -57,6 +57,7 @@ class InstallBl : public QDialog QString mountPoint; QString m_OrigFirmware; BootloaderInstaller* binstaller; + bool needextrafile; private slots: void browseFolder(void); diff --git a/rbutil/rbutilqt/installbootloader.cpp b/rbutil/rbutilqt/installbootloader.cpp index f6973259ff..e6dc302281 100644 --- a/rbutil/rbutilqt/installbootloader.cpp +++ b/rbutil/rbutilqt/installbootloader.cpp @@ -29,7 +29,7 @@ void BootloaderInstaller::install(ProgressloggerInterface* dp) { m_dp = dp; m_install = true; - m_dp->addItem(tr("Starting bootloader installation")); + m_dp->addItem(tr("Starting bootloader installation"),LOGINFO); if(m_bootloadermethod == "gigabeatf") { @@ -69,7 +69,7 @@ void BootloaderInstaller::install(ProgressloggerInterface* dp) } else { - m_dp->addItem(tr("unsupported install Method")); + m_dp->addItem(tr("unsupported install Method"),LOGERROR); emit done(true); return; } @@ -81,7 +81,7 @@ void BootloaderInstaller::uninstall(ProgressloggerInterface* dp) { m_dp = dp; m_install = false; - m_dp->addItem(tr("Starting bootloader uninstallation")); + m_dp->addItem(tr("Starting bootloader uninstallation"),LOGINFO); if(m_bootloadermethod == "gigabeatf") { @@ -90,7 +90,7 @@ void BootloaderInstaller::uninstall(ProgressloggerInterface* dp) } else if(m_bootloadermethod == "iaudio") { - m_dp->addItem(tr("No uninstallation possible")); + m_dp->addItem(tr("No uninstallation possible"),LOGWARNING); emit done(true); return; } @@ -111,13 +111,13 @@ void BootloaderInstaller::uninstall(ProgressloggerInterface* dp) } else if(m_bootloadermethod == "fwpatcher") { - m_dp->addItem(tr("No uninstallation possible")); + m_dp->addItem(tr("No uninstallation possible"),LOGWARNING); emit done(true); return; } else { - m_dp->addItem(tr("unsupported install Method")); + m_dp->addItem(tr("unsupported install Method"),LOGERROR); emit done(true); return; } @@ -146,18 +146,18 @@ void BootloaderInstaller::downloadDone(bool error) } m_dp->setProgressValue(max); if(getter->httpResponse() != 200) { - m_dp->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse())); + m_dp->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse()),LOGERROR); m_dp->abort(); emit done(true); return; } if(error) { - m_dp->addItem(tr("Download error: %1").arg(getter->errorString())); + m_dp->addItem(tr("Download error: %1").arg(getter->errorString()),LOGERROR); m_dp->abort(); emit done(true); return; } - else m_dp->addItem(tr("Download finished.")); + else m_dp->addItem(tr("Download finished."),LOGOK); emit finish(); @@ -182,7 +182,7 @@ void BootloaderInstaller::gigabeatPrepare() QString url = m_bootloaderUrlBase + "/gigabeat/" + m_bootloadername; m_dp->addItem(tr("Downloading file %1.%2") - .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); + .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); // temporary file needs to be opened to get the filename downloadFile.open(); @@ -209,7 +209,7 @@ void BootloaderInstaller::gigabeatPrepare() if(!firmwareOrigFI.exists()) { m_dp->addItem(tr("Could not find the Original Firmware at: %1") - .arg(firmwareOrig)); + .arg(firmwareOrig),LOGERROR); emit done(true); return; } @@ -221,7 +221,7 @@ void BootloaderInstaller::gigabeatPrepare() if(!firmwareFile.remove()) { m_dp->addItem(tr("Could not remove the Firmware at: %1") - .arg(firmware)); + .arg(firmware),LOGERROR); emit done(true); return; } @@ -230,7 +230,7 @@ void BootloaderInstaller::gigabeatPrepare() if(!firmwareOrigFile.copy(firmware)) { m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2") - .arg(firmwareOrig,firmware)); + .arg(firmwareOrig,firmware),LOGERROR); emit done(true); return; } @@ -244,7 +244,7 @@ void BootloaderInstaller::gigabeatFinish() { // this step is only need for installation, so no code for uninstall here - m_dp->addItem(tr("Finishing bootloader install")); + m_dp->addItem(tr("Finishing bootloader install"),LOGINFO); QString firmware = m_mountpoint + "/GBSYSTEM/FWIMG/" + m_bootloadername; @@ -254,7 +254,7 @@ void BootloaderInstaller::gigabeatFinish() if(!firmwareFI.exists()) { m_dp->addItem(tr("Could not find the Firmware at: %1") - .arg(firmware)); + .arg(firmware),LOGERROR); emit done(true); return; } @@ -270,7 +270,7 @@ void BootloaderInstaller::gigabeatFinish() if(!firmwareFile.rename(firmwareOrig)) { m_dp->addItem(tr("Could not rename: %1 to %2") - .arg(firmware,firmwareOrig)); + .arg(firmware,firmwareOrig),LOGERROR); emit done(true); return; } @@ -285,14 +285,14 @@ void BootloaderInstaller::gigabeatFinish() if(!downloadFile.copy(firmware)) { m_dp->addItem(tr("Could not copy: %1 to %2") - .arg(m_tempfilename,firmware)); + .arg(m_tempfilename,firmware),LOGERROR); emit done(true); return; } downloadFile.remove(); - m_dp->addItem(tr("Bootloader install finished successfully.")); + m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK); m_dp->abort(); emit done(false); // success @@ -308,7 +308,7 @@ void BootloaderInstaller::iaudioPrepare() QString url = m_bootloaderUrlBase + "/iaudio/" + m_bootloadername; m_dp->addItem(tr("Downloading file %1.%2") - .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); + .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); // temporary file needs to be opened to get the filename downloadFile.open(); @@ -333,14 +333,14 @@ void BootloaderInstaller::iaudioFinish() if(!downloadFile.copy(firmware)) { m_dp->addItem(tr("Could not copy: %1 to %2") - .arg(m_tempfilename,firmware)); + .arg(m_tempfilename,firmware),LOGERROR); emit done(true); return; } downloadFile.remove(); - m_dp->addItem(tr("Bootloader install finished successfully.")); + m_dp->addItem(tr("Bootloader install finished successfully."),LOGERROR); m_dp->abort(); emit done(false); // success @@ -358,7 +358,7 @@ void BootloaderInstaller::h10Prepare() QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername; m_dp->addItem(tr("Downloading file %1.%2") - .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); + .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); // temporary file needs to be opened to get the filename downloadFile.open(); @@ -390,7 +390,7 @@ void BootloaderInstaller::h10Prepare() if(!firmwareFI.exists()) //Firmware dosent exists on player { m_dp->addItem(tr("Firmware doesn not exist: %1") - .arg(firmware)); + .arg(firmware),LOGERROR); emit done(true); return; } @@ -400,7 +400,7 @@ void BootloaderInstaller::h10Prepare() if(!firmwareOrigFI.exists()) //Original Firmware dosent exists on player { m_dp->addItem(tr("Original Firmware doesn not exist: %1") - .arg(firmwareOrig)); + .arg(firmwareOrig),LOGERROR); emit done(true); return; } @@ -412,7 +412,7 @@ void BootloaderInstaller::h10Prepare() if(!firmwareFile.remove()) { m_dp->addItem(tr("Could not remove the Firmware at: %1") - .arg(firmware)); + .arg(firmware),LOGERROR); emit done(true); return; } @@ -421,7 +421,7 @@ void BootloaderInstaller::h10Prepare() if(!firmwareOrigFile.copy(firmware)) { m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2") - .arg(firmwareOrig,firmware)); + .arg(firmwareOrig,firmware),LOGERROR); emit done(true); return; } @@ -447,7 +447,7 @@ void BootloaderInstaller::h10Finish() if(!firmwareFI.exists()) //Firmware dosent exists on player { m_dp->addItem(tr("Firmware does not exist: %1") - .arg(firmware)); + .arg(firmware),LOGERROR); emit done(true); return; } @@ -461,7 +461,7 @@ void BootloaderInstaller::h10Finish() if(!firmwareFile.rename(firmwareOrig)) //rename Firmware to Original { m_dp->addItem(tr("Could not rename: %1 to %2") - .arg(firmware,firmwareOrig)); + .arg(firmware,firmwareOrig),LOGERROR); emit done(true); return; } @@ -475,14 +475,14 @@ void BootloaderInstaller::h10Finish() if(!downloadFile.copy(firmware)) { m_dp->addItem(tr("Could not copy: %1 to %2") - .arg(m_tempfilename,firmware)); + .arg(m_tempfilename,firmware),LOGERROR); emit done(true); return; } downloadFile.remove(); - m_dp->addItem(tr("Bootloader install finished successfully.")); + m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK); m_dp->abort(); emit done(false); // success @@ -502,19 +502,19 @@ bool initIpodpatcher() void BootloaderInstaller::ipodPrepare() { - m_dp->addItem(tr("Searching for ipods")); + m_dp->addItem(tr("Searching for ipods"),LOGINFO); struct ipod_t ipod; int n = ipod_scan(&ipod); if (n == 0) { - m_dp->addItem(tr("No Ipods found")); + m_dp->addItem(tr("No Ipods found"),LOGERROR); emit done(true); return; } if (n > 1) { - m_dp->addItem(tr("Too many Ipods found")); + m_dp->addItem(tr("Too many Ipods found"),LOGERROR); emit done(true); } @@ -524,7 +524,7 @@ void BootloaderInstaller::ipodPrepare() QString url = m_bootloaderUrlBase + "/ipod/bootloader-" + m_bootloadername + ".ipod"; m_dp->addItem(tr("Downloading file %1.%2") - .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); + .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); // temporary file needs to be opened to get the filename downloadFile.open(); @@ -544,25 +544,25 @@ void BootloaderInstaller::ipodPrepare() { if (ipod_open(&ipod, 0) < 0) { - m_dp->addItem(tr("could not open ipod")); + m_dp->addItem(tr("could not open ipod"),LOGERROR); emit done(true); return; } if (read_partinfo(&ipod,0) < 0) { - m_dp->addItem(tr("could not read partitiontable")); + m_dp->addItem(tr("could not read partitiontable"),LOGERROR); emit done(true); return; } if (ipod.pinfo[0].start==0) { - m_dp->addItem(tr("No partition 0 on disk")); + m_dp->addItem(tr("No partition 0 on disk"),LOGERROR); int i; double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size; - m_dp->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n")); + m_dp->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n"),LOGINFO); for ( i = 0; i < 4; i++ ) { if (ipod.pinfo[i].start != 0) @@ -573,7 +573,7 @@ void BootloaderInstaller::ipodPrepare() ipod.pinfo[i].start+ipod.pinfo[i].size-1).arg( ipod.pinfo[i].size/sectors_per_MB).arg( get_parttype(ipod.pinfo[i].type)).arg( - ipod.pinfo[i].type)); + ipod.pinfo[i].type),LOGINFO); } } emit done(true); @@ -584,46 +584,46 @@ void BootloaderInstaller::ipodPrepare() if (ipod.nimages <= 0) { - m_dp->addItem(tr("Failed to read firmware directory")); + m_dp->addItem(tr("Failed to read firmware directory"),LOGERROR); emit done(true); return; } if (getmodel(&ipod,(ipod.ipod_directory[0].vers>>8)) < 0) { m_dp->addItem(tr("Unknown version number in firmware (%1)").arg( - ipod.ipod_directory[0].vers)); + ipod.ipod_directory[0].vers),LOGERROR); emit done(true); return; } if (ipod.macpod) { - m_dp->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod")); + m_dp->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod"),LOGWARNING); } if (ipod_reopen_rw(&ipod) < 0) { - m_dp->addItem(tr("Could not open Ipod in RW mode")); + m_dp->addItem(tr("Could not open Ipod in RW mode"),LOGERROR); emit done(true); return; } if (ipod.ipod_directory[0].entryOffset==0) { - m_dp->addItem(tr("No bootloader detected.")); + m_dp->addItem(tr("No bootloader detected."),LOGERROR); emit done(true); return; } if (delete_bootloader(&ipod)==0) { - m_dp->addItem(tr("Successfully removed Bootloader")); + m_dp->addItem(tr("Successfully removed Bootloader"),LOGOK); emit done(false); ipod_close(&ipod); return; } else { - m_dp->addItem(tr("--delete-bootloader failed.")); + m_dp->addItem(tr("--delete-bootloader failed."),LOGERROR); emit done(true); ipod_close(&ipod); return; @@ -638,26 +638,26 @@ void BootloaderInstaller::ipodFinish() if (ipod_open(&ipod, 0) < 0) { - m_dp->addItem(tr("could not open ipod")); + m_dp->addItem(tr("could not open ipod"),LOGERROR); emit done(true); return; } if (read_partinfo(&ipod,0) < 0) { - m_dp->addItem(tr("could not read partitiontable")); + m_dp->addItem(tr("could not read partitiontable"),LOGERROR); emit done(true); return; } if (ipod.pinfo[0].start==0) { - m_dp->addItem(tr("No partition 0 on disk")); + m_dp->addItem(tr("No partition 0 on disk"),LOGERROR); int i; double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size; - m_dp->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n")); + m_dp->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n"),LOGINFO); for ( i = 0; i < 4; i++ ) { @@ -669,7 +669,7 @@ void BootloaderInstaller::ipodFinish() ipod.pinfo[i].start+ipod.pinfo[i].size-1).arg( ipod.pinfo[i].size/sectors_per_MB).arg( get_parttype(ipod.pinfo[i].type)).arg( - ipod.pinfo[i].type)); + ipod.pinfo[i].type),LOGWARNING); } } emit done(true); @@ -680,40 +680,40 @@ void BootloaderInstaller::ipodFinish() if (ipod.nimages <= 0) { - m_dp->addItem(tr("Failed to read firmware directory")); + m_dp->addItem(tr("Failed to read firmware directory"),LOGERROR); emit done(true); return; } if (getmodel(&ipod,(ipod.ipod_directory[0].vers>>8)) < 0) { m_dp->addItem(tr("Unknown version number in firmware (%1)").arg( - ipod.ipod_directory[0].vers)); + ipod.ipod_directory[0].vers),LOGERROR); emit done(true); return; } if (ipod.macpod) { - m_dp->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod")); + m_dp->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod"),LOGWARNING); } if (ipod_reopen_rw(&ipod) < 0) { - m_dp->addItem(tr("Could not open Ipod in RW mode")); + m_dp->addItem(tr("Could not open Ipod in RW mode"),LOGERROR); emit done(true); return; } if (add_bootloader(&ipod, m_tempfilename.toLatin1().data(), FILETYPE_DOT_IPOD)==0) { - m_dp->addItem(tr("Successfully added Bootloader")); + m_dp->addItem(tr("Successfully added Bootloader"),LOGOK); emit done(false); ipod_close(&ipod); return; } else { - m_dp->addItem(tr("failed to add Bootloader")); + m_dp->addItem(tr("failed to add Bootloader"),LOGERROR); ipod_close(&ipod); emit done(true); return; @@ -733,19 +733,19 @@ bool initSansaPatcher() void BootloaderInstaller::sansaPrepare() { - m_dp->addItem(tr("Searching for sansas")); + m_dp->addItem(tr("Searching for sansas"),LOGINFO); struct sansa_t sansa; int n = sansa_scan(&sansa); if (n == 0) { - m_dp->addItem(tr("No Sansa found")); + m_dp->addItem(tr("No Sansa found"),LOGERROR); emit done(true); return; } if (n > 1) { - m_dp->addItem(tr("Too many Sansas found")); + m_dp->addItem(tr("Too many Sansas found"),LOGERROR); emit done(true); } @@ -754,7 +754,7 @@ void BootloaderInstaller::sansaPrepare() QString url = m_bootloaderUrlBase + "/sandisk-sansa/e200/" + m_bootloadername; m_dp->addItem(tr("Downloading file %1.%2") - .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); + .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); // temporary file needs to be opened to get the filename downloadFile.open(); @@ -775,21 +775,21 @@ void BootloaderInstaller::sansaPrepare() if (sansa_open(&sansa, 0) < 0) { - m_dp->addItem(tr("could not open Sansa")); + m_dp->addItem(tr("could not open Sansa"),LOGERROR); emit done(true); return; } if (sansa_read_partinfo(&sansa,0) < 0) { - m_dp->addItem(tr("could not read partitiontable")); + m_dp->addItem(tr("could not read partitiontable"),LOGERROR); emit done(true); return; } int i = is_e200(&sansa); if (i < 0) { - m_dp->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i)); + m_dp->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i),LOGERROR); emit done(true); return; } @@ -801,7 +801,7 @@ void BootloaderInstaller::sansaPrepare() "You must reinstall the original Sansa firmware before running\n" "sansapatcher for the first time.\n" "See http://www.rockbox.org/twiki/bin/view/Main/SansaE200Install\n" - "*********************************************\n")); + "*********************************************\n"),LOGERROR); emit done(true); return; } @@ -809,21 +809,21 @@ void BootloaderInstaller::sansaPrepare() if (sansa_reopen_rw(&sansa) < 0) { - m_dp->addItem(tr("Could not open Sansa in RW mode")); + m_dp->addItem(tr("Could not open Sansa in RW mode"),LOGERROR); emit done(true); return; } if (sansa_delete_bootloader(&sansa)==0) { - m_dp->addItem(tr("Successfully removed Bootloader")); + m_dp->addItem(tr("Successfully removed Bootloader"),LOGOK); emit done(false); sansa_close(&sansa); return; } else { - m_dp->addItem(tr("--delete-bootloader failed.")); + m_dp->addItem(tr("--delete-bootloader failed."),LOGERROR); emit done(true); sansa_close(&sansa); return; @@ -838,14 +838,14 @@ void BootloaderInstaller::sansaFinish() if (sansa_open(&sansa, 0) < 0) { - m_dp->addItem(tr("could not open Sansa")); + m_dp->addItem(tr("could not open Sansa"),LOGERROR); emit done(true); return; } if (sansa_read_partinfo(&sansa,0) < 0) { - m_dp->addItem(tr("could not read partitiontable")); + m_dp->addItem(tr("could not read partitiontable"),LOGERROR); emit done(true); return; } @@ -854,7 +854,7 @@ void BootloaderInstaller::sansaFinish() int i = is_e200(&sansa); if (i < 0) { - m_dp->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i)); + m_dp->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i),LOGERROR); emit done(true); return; } @@ -866,28 +866,28 @@ void BootloaderInstaller::sansaFinish() "You must reinstall the original Sansa firmware before running\n" "sansapatcher for the first time.\n" "See http://www.rockbox.org/twiki/bin/view/Main/SansaE200Install\n" - "*********************************************\n")); + "*********************************************\n"),LOGERROR); emit done(true); return; } if (sansa_reopen_rw(&sansa) < 0) { - m_dp->addItem(tr("Could not open Sansa in RW mode")); + m_dp->addItem(tr("Could not open Sansa in RW mode"),LOGERROR); emit done(true); return; } if (sansa_add_bootloader(&sansa, m_tempfilename.toLatin1().data(), FILETYPE_MI4)==0) { - m_dp->addItem(tr("Successfully added Bootloader")); + m_dp->addItem(tr("Successfully added Bootloader"),LOGOK); emit done(false); sansa_close(&sansa); return; } else { - m_dp->addItem(tr("failed to add Bootloader")); + m_dp->addItem(tr("failed to add Bootloader"),LOGERROR); sansa_close(&sansa); emit done(true); return; @@ -903,7 +903,7 @@ void BootloaderInstaller::iriverPrepare() { char md5sum_str[32]; if (!FileMD5(m_origfirmware, md5sum_str)) { - m_dp->addItem(tr("Could not MD5Sum original firmware")); + m_dp->addItem(tr("Could not MD5Sum original firmware"),LOGERROR); emit done(true); return; } @@ -933,7 +933,7 @@ void BootloaderInstaller::iriverPrepare() } if (series == 0) { - m_dp->addItem(tr("Could not detect firmware type")); + m_dp->addItem(tr("Could not detect firmware type"),LOGERROR); emit done(true); return; } @@ -941,7 +941,7 @@ void BootloaderInstaller::iriverPrepare() QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername; m_dp->addItem(tr("Downloading file %1.%2") - .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); + .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); // temporary file needs to be opened to get the filename downloadFile.open(); @@ -996,7 +996,7 @@ void BootloaderInstaller::iriverFinish() // iriver decode if (iriver_decode(m_origfirmware, firmwareBinName, FALSE, STRIP_NONE,m_dp) == -1) { - m_dp->addItem(tr("Error in descramble")); + m_dp->addItem(tr("Error in descramble"),LOGERROR); firmwareBin.remove(); newBin.remove(); newHex.remove(); @@ -1006,7 +1006,7 @@ void BootloaderInstaller::iriverFinish() // mkboot if (!mkboot(firmwareBinName, newBinName, m_tempfilename, origin,m_dp)) { - m_dp->addItem(tr("Error in patching")); + m_dp->addItem(tr("Error in patching"),LOGERROR); firmwareBin.remove(); newBin.remove(); newHex.remove(); @@ -1016,7 +1016,7 @@ void BootloaderInstaller::iriverFinish() // iriver_encode if (iriver_encode(newBinName, newHexName, FALSE,m_dp) == -1) { - m_dp->addItem(tr("Error in scramble")); + m_dp->addItem(tr("Error in scramble"),LOGERROR); firmwareBin.remove(); newBin.remove(); newHex.remove(); @@ -1027,7 +1027,7 @@ void BootloaderInstaller::iriverFinish() /* now md5sum it */ if (!FileMD5(newHexName, md5sum_str)) { - m_dp->addItem(tr("Error in checksumming")); + m_dp->addItem(tr("Error in checksumming"),LOGERROR); firmwareBin.remove(); newBin.remove(); newHex.remove(); @@ -1052,7 +1052,7 @@ void BootloaderInstaller::iriverFinish() if(!newHex.copy(dest)) { m_dp->addItem(tr("Could not copy: %1 to %2") - .arg(newHexName,dest)); + .arg(newHexName,dest),LOGERROR); emit done(true); return; } @@ -1060,7 +1060,7 @@ void BootloaderInstaller::iriverFinish() downloadFile.remove(); newHex.remove(); - m_dp->addItem(tr("Bootloader install finished successfully.")); + m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK); m_dp->abort(); emit done(false); // success diff --git a/rbutil/rbutilqt/installzip.cpp b/rbutil/rbutilqt/installzip.cpp index b947553f33..4f99d7bc31 100644 --- a/rbutil/rbutilqt/installzip.cpp +++ b/rbutil/rbutilqt/installzip.cpp @@ -33,7 +33,7 @@ void ZipInstaller::install(ProgressloggerInterface* dp) m_dp = dp; m_dp->addItem(tr("Downloading file %1.%2") - .arg(QFileInfo(m_url).baseName(), QFileInfo(m_url).completeSuffix())); + .arg(QFileInfo(m_url).baseName(), QFileInfo(m_url).completeSuffix()),LOGINFO); // temporary file needs to be opened to get the filename downloadFile.open(); @@ -72,23 +72,23 @@ void ZipInstaller::downloadDone(bool error) } m_dp->setProgressValue(max); if(getter->httpResponse() != 200) { - m_dp->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse())); + m_dp->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse()),LOGERROR); m_dp->abort(); emit done(true); return; } if(error) { - m_dp->addItem(tr("Download error: %1").arg(getter->errorString())); + m_dp->addItem(tr("Download error: %1").arg(getter->errorString()),LOGERROR); m_dp->abort(); emit done(true); return; } - else m_dp->addItem(tr("Download finished.")); + else m_dp->addItem(tr("Download finished."),LOGOK); // unzip downloaded file qDebug() << "about to unzip the downloaded file" << m_file << "to" << m_mountpoint; - m_dp->addItem(tr("Extracting file.")); + m_dp->addItem(tr("Extracting file."),LOGINFO); qDebug() << "file to unzip: " << m_file; UnZip::ErrorCode ec; @@ -96,7 +96,7 @@ void ZipInstaller::downloadDone(bool error) ec = uz.openArchive(m_file); if(ec != UnZip::Ok) { m_dp->addItem(tr("Opening archive failed: %1.") - .arg(uz.formatError(ec))); + .arg(uz.formatError(ec)),LOGERROR); m_dp->abort(); emit done(false); return; @@ -105,13 +105,13 @@ void ZipInstaller::downloadDone(bool error) ec = uz.extractAll(m_mountpoint); if(ec != UnZip::Ok) { m_dp->addItem(tr("Extracting failed: %1.") - .arg(uz.formatError(ec))); + .arg(uz.formatError(ec)),LOGERROR); m_dp->abort(); emit done(false); return; } - m_dp->addItem(tr("creating installation log")); + m_dp->addItem(tr("creating installation log"),LOGINFO); QStringList zipContents = uz.fileList(); @@ -127,7 +127,7 @@ void ZipInstaller::downloadDone(bool error) // remove temporary file downloadFile.remove(); - m_dp->addItem(tr("Extraction finished successfully.")); + m_dp->addItem(tr("Extraction finished successfully."),LOGOK); m_dp->abort(); emit done(false); } diff --git a/rbutil/rbutilqt/installzipwindow.cpp b/rbutil/rbutilqt/installzipwindow.cpp index cd85305eba..9e4381dce0 100644 --- a/rbutil/rbutilqt/installzipwindow.cpp +++ b/rbutil/rbutilqt/installzipwindow.cpp @@ -76,7 +76,7 @@ void InstallZipWindow::accept() userSettings->setValue("defaults/mountpoint", mountPoint);
}
else {
- logger->addItem(tr("Mount point is wrong!"));
+ logger->addItem(tr("Mount point is wrong!"),LOGERROR);
logger->abort();
return;
}
@@ -84,9 +84,9 @@ void InstallZipWindow::accept() userSettings->sync();
// create Zip installer
- installer = new ZipInstaller(this);
-
- QString fileName = url.section('/', -1);
+ installer = new ZipInstaller(this);
+
+ QString fileName = url.section('/', -1);
installer->setFilename(fileName);
installer->setUrl(url);
installer->setProxy(proxy);
diff --git a/rbutil/rbutilqt/irivertools/irivertools.cpp b/rbutil/rbutilqt/irivertools/irivertools.cpp index ee91193dc4..af06e86e06 100644 --- a/rbutil/rbutilqt/irivertools/irivertools.cpp +++ b/rbutil/rbutilqt/irivertools/irivertools.cpp @@ -59,12 +59,12 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Progre QFile f(infile); if(!f.open(QIODevice::ReadOnly)) { - dp->addItem("Could not open: %1" + infile); + dp->addItem("Could not open: %1" + infile,LOGERROR); return false; } i = f.read((char*)image,16); if(i < 16) { - dp->addItem("reading header failed"); + dp->addItem("reading header failed",LOGERROR); return false; } @@ -77,7 +77,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Progre len = binary_length+0x200-16; i = f.read((char*)image+16, len); if(i < len) { - dp->addItem("reading firmware failed"); + dp->addItem("reading firmware failed",LOGERROR); return false; } @@ -86,7 +86,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Progre f.setFileName(bootloader); if(!f.open(QIODevice::ReadOnly)) { - dp->addItem("Could not open: %1" + bootloader); + dp->addItem("Could not open: %1" + bootloader,LOGERROR); return false; } @@ -94,7 +94,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Progre i = f.read((char*)image+0x220 + origin, bllen); if(i < bllen) { - dp->addItem("reading bootloader failed"); + dp->addItem("reading bootloader failed",LOGERROR); return false; } @@ -102,7 +102,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Progre f.setFileName(outfile); if(!f.open(QIODevice::WriteOnly)) { - dp->addItem("Could not open: %1" + outfile); + dp->addItem("Could not open: %1" + outfile,LOGERROR); return false; } @@ -154,7 +154,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Progre i = f.write((char*)image,total_length); if(i < total_length) { - dp->addItem("writing bootloader failed"); + dp->addItem("writing bootloader failed",LOGERROR); return false; } @@ -226,19 +226,19 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify if(!infile.open(QIODevice::ReadOnly)) { - dp->addItem("Could not open: %1" + infile_name); + dp->addItem("Could not open: %1" + infile_name,LOGERROR); return -1; } if(!outfile.open(QIODevice::WriteOnly)) { - dp->addItem("Could not open: %1" + outfile_name); + dp->addItem("Could not open: %1" + outfile_name,LOGERROR); return -1; } lenread = infile.read( (char*)headerdata, 512); if( lenread != 512 ) { dp->addItem("This doesn't look like a valid encrypted iHP" - "firmware - reason: header length."); + "firmware - reason: header length.",LOGERROR); infile.close(); outfile.close(); return -1; @@ -248,7 +248,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify if( i == -1 ) { dp->addItem("This firmware is for an unknown model, or is not" - " a valid encrypted iHP firmware."); + " a valid encrypted iHP firmware.",LOGERROR); infile.close(); outfile.close(); return -1; @@ -271,7 +271,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify dwLength2+dwLength3+512 != dwLength1 ) { dp->addItem("This doesn't look like a valid encrypted " - "iHP firmware - reason: file 'length' data."); + "iHP firmware - reason: file 'length' data.",LOGERROR); infile.close(); outfile.close(); return -1; @@ -333,7 +333,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify if( fp != dwLength2 ) { dp->addItem("This doesn't look like a valid encrypted " - "iHP firmware - reason: 'length2' mismatch."); + "iHP firmware - reason: 'length2' mismatch.",LOGERROR); infile.close(); outfile.close(); return -1; @@ -350,7 +350,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify if( memcmp( ppChecksums, blockdata, lenread ) != 0 ) { dp->addItem("This doesn't look like a valid encrypted " - "iHP firmware - reason: Checksum mismatch!"); + "iHP firmware - reason: Checksum mismatch!",LOGERROR); infile.close(); outfile.close(); return -1; @@ -361,7 +361,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify if( fp != dwLength3 ) { dp->addItem("This doesn't look like a valid encrypted " - "iHP firmware - reason: 'length3' mismatch."); + "iHP firmware - reason: 'length3' mismatch.",LOGERROR); infile.close(); outfile.close(); return -1; @@ -409,12 +409,12 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify if(!infile.open(QIODevice::ReadOnly)) { - dp->addItem("Could not open: %1" + infile_name); + dp->addItem("Could not open: %1" + infile_name,LOGERROR); return -1; } if(!outfile.open(QIODevice::WriteOnly)) { - dp->addItem("Could not open: %1" + outfile_name); + dp->addItem("Could not open: %1" + outfile_name,LOGERROR); return -1; } @@ -422,7 +422,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify if( lenread != 512 ) { dp->addItem("This doesn't look like a valid decoded " - "iHP firmware - reason: header length."); + "iHP firmware - reason: header length.",LOGERROR); infile.close(); outfile.close(); }; @@ -436,7 +436,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify if( i == -1 ) { dp->addItem("This firmware is for an unknown model, or is not" - " a valid decoded iHP firmware."); + " a valid decoded iHP firmware.",LOGERROR); infile.close(); outfile.close(); }; @@ -457,7 +457,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify dwLength2+dwLength3+512 != dwLength1 ) { dp->addItem("This doesn't look like a valid decoded " - "iHP firmware - reason:file 'length' data."); + "iHP firmware - reason:file 'length' data.",LOGERROR); infile.close(); outfile.close(); }; @@ -495,7 +495,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify if( fp != dwLength2 ) { dp->addItem("This doesn't look like a valid decoded " - "iHP firmware - reason: 'length1' mismatch."); + "iHP firmware - reason: 'length1' mismatch.",LOGERROR); infile.close(); outfile.close(); }; @@ -515,7 +515,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify if( fp != dwLength3 ) { dp->addItem("This doesn't look like a valid decoded " - "iHP firmware - 'length2' mismatch."); + "iHP firmware - 'length2' mismatch.",LOGERROR); infile.close(); outfile.close(); }; diff --git a/rbutil/rbutilqt/progressloggergui.cpp b/rbutil/rbutilqt/progressloggergui.cpp index f348d5b96d..8dc3e71844 100644 --- a/rbutil/rbutilqt/progressloggergui.cpp +++ b/rbutil/rbutilqt/progressloggergui.cpp @@ -31,7 +31,30 @@ ProgressLoggerGui::ProgressLoggerGui(QObject* parent): ProgressloggerInterface(p void ProgressLoggerGui::addItem(QString text) { dp.listProgress->addItem(text); -} +} + +void ProgressLoggerGui::addItem(QString text,int flag) +{ + QListWidgetItem* item = new QListWidgetItem(text); + + switch(flag) + { + case LOGOK: + item->setIcon(QIcon(":/icons/icons/log-ok.png")); + break; + case LOGINFO: + item->setIcon(QIcon(":/icons/icons/log-info.png")); + break; + case LOGWARNING: + item->setIcon(QIcon(":/icons/icons/log-warning.png")); + break; + case LOGERROR: + item->setIcon(QIcon(":/icons/icons/log-error.png")); + break; + } + + dp.listProgress->addItem(item); +} void ProgressLoggerGui::setProgressValue(int value) { diff --git a/rbutil/rbutilqt/progressloggergui.h b/rbutil/rbutilqt/progressloggergui.h index 2290fcb080..3b70c966be 100644 --- a/rbutil/rbutilqt/progressloggergui.h +++ b/rbutil/rbutilqt/progressloggergui.h @@ -32,6 +32,8 @@ public: virtual void addItem(QString text) ; //adds a string to the list + virtual void addItem(QString text, int flag) ; //adds a string to the list + virtual void setProgressValue(int value); virtual void setProgressMax(int max); virtual int getProgressMax(); diff --git a/rbutil/rbutilqt/progressloggerinterface.h b/rbutil/rbutilqt/progressloggerinterface.h index c2075a15f4..65c2a23282 100644 --- a/rbutil/rbutilqt/progressloggerinterface.h +++ b/rbutil/rbutilqt/progressloggerinterface.h @@ -21,6 +21,12 @@ #define PROGRESSLOGGERINTERFACE_H #include <QtGui> + +#define LOGOK 1 +#define LOGINFO 2 +#define LOGWARNING 3 +#define LOGERROR 4 + class ProgressloggerInterface : public QObject { @@ -29,6 +35,7 @@ class ProgressloggerInterface : public QObject public: ProgressloggerInterface(QObject* parent) : QObject(parent) {} virtual void addItem(QString text) =0 ; //adds a string to the list + virtual void addItem(QString text,int flag) =0 ; //adds a string to the list, with icon virtual void setProgressValue(int value)=0; virtual void setProgressMax(int max)=0; diff --git a/rbutil/rbutilqt/rbutilqt.qrc b/rbutil/rbutilqt/rbutilqt.qrc index 98d8aa2fd3..913d600897 100644 --- a/rbutil/rbutilqt/rbutilqt.qrc +++ b/rbutil/rbutilqt/rbutilqt.qrc @@ -7,17 +7,20 @@ <file>icons/bootloader_btn.png</file> <file>icons/doom_btn.png</file> <file>icons/font_btn.png</file> + <file>icons/log-error.png</file> + <file>icons/log-info.png</file> + <file>icons/log-ok.png</file> + <file>icons/log-warning.png</file> <file>icons/rbinstall_btn.png</file> + <file>icons/rblogo.xpm</file> + <file>icons/rbutil.xpm</file> <file>icons/rembootloader_btn.png</file> <file>icons/remrb_btn.png</file> <file>icons/themes_btn.png</file> <file>icons/wizard.xpm</file> - <file>icons/rblogo.xpm</file> - <file>icons/rbutil.xpm</file> </qresource> <qresource prefix="/ini" > <file>rbutil.ini</file> </qresource> - <qresource prefix="/lang" > - </qresource> + <qresource prefix="/lang" /> </RCC> |