diff options
Diffstat (limited to 'rbutil/rbutilqt/installbootloader.cpp')
-rw-r--r-- | rbutil/rbutilqt/installbootloader.cpp | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/installbootloader.cpp b/rbutil/rbutilqt/installbootloader.cpp index 61655fd1f3..4b78ee484b 100644 --- a/rbutil/rbutilqt/installbootloader.cpp +++ b/rbutil/rbutilqt/installbootloader.cpp | |||
@@ -68,6 +68,12 @@ void BootloaderInstaller::install(ProgressloggerInterface* dp) | |||
68 | connect(this,SIGNAL(prepare()),this,SLOT(iriverPrepare())); | 68 | connect(this,SIGNAL(prepare()),this,SLOT(iriverPrepare())); |
69 | connect(this,SIGNAL(finish()),this,SLOT(iriverFinish())); | 69 | connect(this,SIGNAL(finish()),this,SLOT(iriverFinish())); |
70 | } | 70 | } |
71 | else if(m_bootloadermethod == "mrobe100") | ||
72 | { | ||
73 | // connect internal signal | ||
74 | connect(this,SIGNAL(prepare()),this,SLOT(mrobe100Prepare())); | ||
75 | connect(this,SIGNAL(finish()),this,SLOT(mrobe100Finish())); | ||
76 | } | ||
71 | else | 77 | else |
72 | { | 78 | { |
73 | m_dp->addItem(tr("unsupported install Method"),LOGERROR); | 79 | m_dp->addItem(tr("unsupported install Method"),LOGERROR); |
@@ -111,6 +117,16 @@ void BootloaderInstaller::uninstall(ProgressloggerInterface* dp) | |||
111 | // connect internal signal | 117 | // connect internal signal |
112 | connect(this,SIGNAL(prepare()),this,SLOT(sansaPrepare())); | 118 | connect(this,SIGNAL(prepare()),this,SLOT(sansaPrepare())); |
113 | } | 119 | } |
120 | else if(m_bootloadermethod == "h10") | ||
121 | { | ||
122 | // connect internal signal | ||
123 | connect(this,SIGNAL(prepare()),this,SLOT(h10Prepare())); | ||
124 | } | ||
125 | else if(m_bootloadermethod == "mrobe100") | ||
126 | { | ||
127 | // connect internal signal | ||
128 | connect(this,SIGNAL(prepare()),this,SLOT(mrobe100Prepare())); | ||
129 | } | ||
114 | else if(m_bootloadermethod == "fwpatcher") | 130 | else if(m_bootloadermethod == "fwpatcher") |
115 | { | 131 | { |
116 | m_dp->addItem(tr("No uninstallation possible"),LOGWARNING); | 132 | m_dp->addItem(tr("No uninstallation possible"),LOGWARNING); |
@@ -636,6 +652,149 @@ void BootloaderInstaller::h10Finish() | |||
636 | 652 | ||
637 | } | 653 | } |
638 | 654 | ||
655 | |||
656 | |||
657 | /************************************************** | ||
658 | *** mrobe100 secific code | ||
659 | ***************************************************/ | ||
660 | void BootloaderInstaller::mrobe100Prepare() | ||
661 | { | ||
662 | if(m_install) // Installation | ||
663 | { | ||
664 | QString url = m_bootloaderUrlBase + "/olympus/mrobe100/" + m_bootloadername; | ||
665 | |||
666 | m_dp->addItem(tr("Downloading file %1.%2") | ||
667 | .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); | ||
668 | |||
669 | // temporary file needs to be opened to get the filename | ||
670 | downloadFile.open(); | ||
671 | m_tempfilename = downloadFile.fileName(); | ||
672 | downloadFile.close(); | ||
673 | // get the real file. | ||
674 | getter = new HttpGet(this); | ||
675 | getter->setProxy(m_proxy); | ||
676 | getter->setFile(&downloadFile); | ||
677 | getter->getFile(QUrl(url)); | ||
678 | // connect signals from HttpGet | ||
679 | connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); | ||
680 | connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); | ||
681 | connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort())); | ||
682 | } | ||
683 | else // Uninstallation | ||
684 | { | ||
685 | |||
686 | QString firmwarename = m_bootloadername; | ||
687 | |||
688 | QString firmware = m_mountpoint + "/SYSTEM/" + firmwarename; | ||
689 | QString firmwareOrig = m_mountpoint + "/SYSTEM/OF.mi4"; | ||
690 | |||
691 | QFileInfo firmwareFI(firmware); | ||
692 | if(!firmwareFI.exists()) //Firmware dosent exists on player | ||
693 | { | ||
694 | m_dp->addItem(tr("Firmware does not exist: %1") | ||
695 | .arg(firmware),LOGERROR); | ||
696 | emit done(true); | ||
697 | return; | ||
698 | } | ||
699 | |||
700 | QFileInfo firmwareOrigFI(firmwareOrig); | ||
701 | if(!firmwareOrigFI.exists()) //Original Firmware dosent exists on player | ||
702 | { | ||
703 | m_dp->addItem(tr("Original Firmware does not exist: %1") | ||
704 | .arg(firmwareOrig),LOGERROR); | ||
705 | emit done(true); | ||
706 | return; | ||
707 | } | ||
708 | |||
709 | QFile firmwareFile(firmware); | ||
710 | QFile firmwareOrigFile(firmwareOrig); | ||
711 | |||
712 | //remove modified firmware | ||
713 | if(!firmwareFile.remove()) | ||
714 | { | ||
715 | m_dp->addItem(tr("Could not remove the Firmware at: %1") | ||
716 | .arg(firmware),LOGERROR); | ||
717 | emit done(true); | ||
718 | return; | ||
719 | } | ||
720 | |||
721 | //copy original firmware | ||
722 | if(!firmwareOrigFile.copy(firmware)) | ||
723 | { | ||
724 | m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2") | ||
725 | .arg(firmwareOrig,firmware),LOGERROR); | ||
726 | emit done(true); | ||
727 | return; | ||
728 | } | ||
729 | |||
730 | removeInstallLog(); | ||
731 | |||
732 | emit done(false); //success | ||
733 | |||
734 | } | ||
735 | } | ||
736 | |||
737 | void BootloaderInstaller::mrobe100Finish() | ||
738 | { | ||
739 | QString firmwarename = m_bootloadername; | ||
740 | |||
741 | QString firmware = m_mountpoint + "/SYSTEM/" + firmwarename; | ||
742 | QString firmwareOrig = m_mountpoint + "/SYSTEM/OF.mi4"; | ||
743 | |||
744 | QFileInfo firmwareFI(firmware); | ||
745 | |||
746 | if(!firmwareFI.exists()) //Firmware dosent exists on player | ||
747 | { | ||
748 | m_dp->addItem(tr("Firmware does not exist: %1") | ||
749 | .arg(firmware),LOGERROR); | ||
750 | emit done(true); | ||
751 | return; | ||
752 | } | ||
753 | |||
754 | QFileInfo firmwareOrigFI(firmwareOrig); | ||
755 | |||
756 | if(!firmwareOrigFI.exists()) | ||
757 | { | ||
758 | QFile firmwareFile(firmware); | ||
759 | |||
760 | //backup | ||
761 | QDir::home().mkdir("Olympus mrobe100 Original Firmware Backup"); | ||
762 | firmwareFile.copy(QDir::toNativeSeparators(QDir::homePath()) + QDir::toNativeSeparators("/Olympus mrobe100 Original Firmware Backup/") + m_bootloadername); | ||
763 | |||
764 | //rename | ||
765 | if(!firmwareFile.rename(firmwareOrig)) //rename Firmware to Original | ||
766 | { | ||
767 | m_dp->addItem(tr("Could not rename: %1 to %2") | ||
768 | .arg(firmware,firmwareOrig),LOGERROR); | ||
769 | emit done(true); | ||
770 | return; | ||
771 | } | ||
772 | } | ||
773 | else //there is already a original firmware | ||
774 | { | ||
775 | QFile firmwareFile(firmware); | ||
776 | firmwareFile.remove(); | ||
777 | } | ||
778 | //copy the firmware | ||
779 | if(!downloadFile.copy(firmware)) | ||
780 | { | ||
781 | m_dp->addItem(tr("Could not copy: %1 to %2") | ||
782 | .arg(m_tempfilename,firmware),LOGERROR); | ||
783 | emit done(true); | ||
784 | return; | ||
785 | } | ||
786 | |||
787 | downloadFile.remove(); | ||
788 | |||
789 | createInstallLog(); | ||
790 | |||
791 | m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK); | ||
792 | m_dp->abort(); | ||
793 | |||
794 | emit done(false); // success | ||
795 | } | ||
796 | |||
797 | |||
639 | /************************************************** | 798 | /************************************************** |
640 | *** ipod secific code | 799 | *** ipod secific code |
641 | ***************************************************/ | 800 | ***************************************************/ |