opkg_manager: make progress reports on startup more practical

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
Stefan Seyfried
2016-01-04 21:22:46 +01:00
committed by svenhoefer
parent f8fc83c496
commit 0d6fd4c7d7
5 changed files with 24 additions and 5 deletions

View File

@@ -1875,6 +1875,8 @@ opkg.messagebox.size.error Nicht genügend freier Speicher für Paketinstallatio
opkg.messagebox.updates.available Aktualisierungen verfügbar!
opkg.success.install Installation erfolgreich!\nNeustart von Neutrino kann erforderlich sein. Jetzt neu starten?
opkg.title Paketverwaltung
opkg.update.check Prüfe auf Updates...
opkg.update.reading_lists Paketlisten werden eingelesen...
opkg.upgrade Installierte Pakete aktualisieren
opkg.warning_3rdparty_packages Drittanbieter-Pakete könnten Ihr System beschädigen! Sind Sie sicher, dieses Paket zu installieren?
options.default Voreinstellungen benutzen

View File

@@ -1875,6 +1875,8 @@ opkg.messagebox.size.error Not enough free memory available for this package!
opkg.messagebox.updates.available Updates available!
opkg.success.install Install successful!\n restart of Neutrino might be required. Restart now?
opkg.title Package Management
opkg.update.check Checking for updates...
opkg.update.reading_lists Reading package lists...
opkg.upgrade Upgrade installed packages
opkg.warning_3rdparty_packages 3rd party packages could damage your system! Are you sure install this package?
options.default Reset to defaults

View File

@@ -43,6 +43,7 @@
#include <gui/widget/messagebox.h>
#include <gui/widget/progresswindow.h>
#include <gui/widget/hintbox.h>
#include <gui/widget/keyboard_input.h>
#include <driver/screen_max.h>
#include <gui/filebrowser.h>
@@ -428,23 +429,30 @@ bool COPKGManager::checkUpdates(const std::string & package_name, bool show_prog
bool ret = false;
getPkgData(OM_LIST);
getPkgData(OM_LIST_UPGRADEABLE);
size_t i = 0;
CProgressWindow status;
status.showHeader(false);
if (show_progress){
status.paint();
status.showStatus(i);
status.showStatusMessageUTF(g_Locale->getText(LOCALE_OPKG_UPDATE_READING_LISTS));
status.showStatus(25); /* after do_update, we have actually done the hardest work already */
}
getPkgData(OM_LIST);
if (show_progress)
status.showStatus(50);
getPkgData(OM_LIST_UPGRADEABLE);
if (show_progress)
status.showStatus(75);
for (map<string, struct pkg>::iterator it = pkg_map.begin(); it != pkg_map.end(); it++){
dprintf(DEBUG_INFO, "[COPKGManager] [%s - %d] Update check for...%s\n", __func__, __LINE__, it->second.name.c_str());
if (show_progress){
/* showing the names only makes things *much* slower...
status.showStatusMessageUTF(it->second.name);
status.showStatus(100*i / pkg_map.size());
*/
status.showStatus(75 + 25*i / pkg_map.size());
}
if (it->second.upgradable){
@@ -473,7 +481,10 @@ bool COPKGManager::checkUpdates(const std::string & package_name, bool show_prog
int COPKGManager::doUpdate()
{
CHintBox *hb = new CHintBox(LOCALE_MESSAGEBOX_INFO, LOCALE_OPKG_UPDATE_CHECK);
hb->paint();
int r = execCmd(pkg_types[OM_UPDATE], CShellWindow::QUIET);
delete hb;
if (r) {
string msg = string(g_Locale->getText(LOCALE_OPKG_FAILURE_UPDATE));
msg += '\n' + tmp_str;

View File

@@ -1902,6 +1902,8 @@ typedef enum
LOCALE_OPKG_MESSAGEBOX_UPDATES_AVAILABLE,
LOCALE_OPKG_SUCCESS_INSTALL,
LOCALE_OPKG_TITLE,
LOCALE_OPKG_UPDATE_CHECK,
LOCALE_OPKG_UPDATE_READING_LISTS,
LOCALE_OPKG_UPGRADE,
LOCALE_OPKG_WARNING_3RDPARTY_PACKAGES,
LOCALE_OPTIONS_DEFAULT,

View File

@@ -1902,6 +1902,8 @@ const char * locale_real_names[] =
"opkg.messagebox.updates.available",
"opkg.success.install",
"opkg.title",
"opkg.update.check",
"opkg.update.reading_lists",
"opkg.upgrade",
"opkg.warning_3rdparty_packages",
"options.default",