Skip to content

Commit

Permalink
Fixed re-install
Browse files Browse the repository at this point in the history
  • Loading branch information
procount committed Jan 28, 2018
1 parent d94cbe4 commit 2730490
Show file tree
Hide file tree
Showing 27 changed files with 2,228 additions and 2,364 deletions.
555 changes: 200 additions & 355 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions recovery/ceclistener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ void CecListener::cec_callback(uint32_t reason, uint32_t param1, uint32_t, uint3
int cec_buttoncode = CEC_CB_OPERAND1(param1);
keyPressed=1;
emit keyPress(cec_buttoncode);
qDebug() << "CEC key: " << cec_buttoncode;
}
#else
qDebug() << "CEC:" << reason << param1;
Expand Down
2 changes: 1 addition & 1 deletion recovery/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define CONFIG_H

/* Version number displayed in the title bar */
#define VERSION_NUMBER "2.4.5c"
#define VERSION_NUMBER "2.4.5d"

/* Color of the background */
// #define BACKGROUND_COLOR Qt::white
Expand Down
28 changes: 15 additions & 13 deletions recovery/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,9 @@ void MainWindow::on_actionReinstall_triggered()
}
}

//
if (!installedEntry.contains("folder"))
installedEntry = witem->data(Qt::UserRole).toMap();

if ((!installedEntry.contains("folder")) || (installedEntry.value("folder").toString().startsWith("/settings")))
{
QDir d;
QString folder = "/settings/os/"+installedEntry.value("name").toString();
Expand Down Expand Up @@ -2050,7 +2051,7 @@ void MainWindow::on_list_itemChanged(QListWidgetItem *item)

void MainWindow::downloadMetaFile(const QString &urlstring, const QString &saveAs)
{
qDebug() << "Downloading" << urlstring << "to" << saveAs;
//qDebug() << "Downloading" << urlstring << "to" << saveAs;
_numMetaFilesToDownload++;
QUrl url(urlstring);
QNetworkRequest request(url);
Expand Down Expand Up @@ -2377,13 +2378,19 @@ void MainWindow::startImageReinstall()
QList<QListWidgetItem *> selected = ug->selectedInstalledItems();
foreach (QListWidgetItem * item, selected)
{
QVariantMap entry = item->data(Qt::UserRole).toMap();

if (entry.value("name")=="PINN")
QVariantMap installedEntry = item->data(Qt::UserRole).toMap();
QString name = installedEntry.value("name").toString();
if (name=="PINN")
{
continue; //Do not reinstall PINN - it's just a dummy os.
}

QListWidgetItem *witem = findItemByName(name);
if (!witem)
continue;

QVariantMap entry = witem->data(Qt::UserRole).toMap();

if (entry.contains("folder"))
{
/* Local image */
Expand Down Expand Up @@ -2424,7 +2431,7 @@ void MainWindow::startImageReinstall()
slidesFolder = folder+"/slides_vga";
}

imageWriteThread->addInstalledImage(folder, entry.value("name").toString(), entry); //@@
imageWriteThread->addInstalledImage(folder, entry.value("name").toString(), installedEntry); //@@

if (!slidesFolder.isEmpty())
slidesFolders.append(slidesFolder);
Expand Down Expand Up @@ -2907,7 +2914,7 @@ void MainWindow::addImage(QVariantMap& m, QIcon &icon, bool &bInstalled)
ug->listInstalled->addItem(witem);
//ug->listInstalled->update();

#if 1
#if 0
//Clone image to new list if not already known
if (!witemNew)

Expand Down Expand Up @@ -3447,9 +3454,6 @@ void MainWindow::on_actionInfo_triggered()
lang = "en";
proc->start("arora -lang "+lang+" "+m.value("url").toString());
}
//else
//qDebug() << m;

}

void MainWindow::on_actionInfoInstalled_triggered()
Expand All @@ -3472,8 +3476,6 @@ void MainWindow::on_actionInfoInstalled_triggered()
lang = "en";
proc->start("arora -lang "+lang+" "+m.value("url").toString());
}
//else
// qDebug() << m;
}

void MainWindow::loadOverrides(const QString &filename)
Expand Down
82 changes: 49 additions & 33 deletions recovery/multiimagewritethread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,11 @@ void MultiImageWriteThread::run()
emit parsedImagesize(qint64(totaluncompressedsize)*1024*1024);
}

if (!_partition)
{ //If we are re-installing, then re-read the OSes that are already installed.
installed_os = Json::loadFromFile("/settings/installed_os.json").toList();
}

/* Install each operating system */
foreach (OsInfo *image, _images)
{
Expand Down Expand Up @@ -814,44 +819,55 @@ bool MultiImageWriteThread::processImage(OsInfo *image)
}


if (_partition)
/* Save information about installed operating systems in installed_os.json */
QVariantMap ventry;
ventry["name"] = image->flavour();
ventry["description"] = description;
ventry["folder"] = image->folder();
ventry["release_date"]= image->releaseDate();
ventry["partitions"] = vpartitions;
ventry["bootable"] = image->bootable();
if (!image->supportedModels().isEmpty())
ventry["supported_models"] = image->supportedModels();
ventry["username"] = image->username();
ventry["password"] = image->password();
ventry["url"] = image->url();
ventry["group"] = image->group();
QString iconfilename = image->folder()+"/"+image->flavour()+".png";
iconfilename.replace(" ", "_");
if (QFile::exists(iconfilename))
{
/* Save information about installed operating systems in installed_os.json */
QVariantMap ventry;
ventry["name"] = image->flavour();
ventry["description"] = description;
ventry["folder"] = image->folder();
ventry["release_date"]= image->releaseDate();
ventry["partitions"] = vpartitions;
ventry["bootable"] = image->bootable();
if (!image->supportedModels().isEmpty())
ventry["supported_models"] = image->supportedModels();
ventry["username"] = image->username();
ventry["password"] = image->password();
ventry["url"] = image->url();
ventry["group"] = image->group();
QString iconfilename = image->folder()+"/"+image->flavour()+".png";
iconfilename.replace(" ", "_");
if (QFile::exists(iconfilename))
if (iconfilename.startsWith("/tmp/media/"))
{
if (iconfilename.startsWith("/tmp/media/"))
{
/* Copy icon to settings folder, as USB storage may take longer to get ready on boot */
QDir dir;
QString dirname = "/settings/os/"+image->flavour().replace(" ", "_");
dir.mkpath(dirname);
QFile::copy(iconfilename, dirname+"/icon.png");
iconfilename = dirname+"/icon.png";
}

ventry["icon"] = iconfilename;
/* Copy icon to settings folder, as USB storage may take longer to get ready on boot */
QDir dir;
QString dirname = "/settings/os/"+image->flavour().replace(" ", "_");
dir.mkpath(dirname);
QFile::copy(iconfilename, dirname+"/icon.png");
iconfilename = dirname+"/icon.png";
}
else if (QFile::exists(image->folder()+"/icon.png"))
ventry["icon"] = image->folder()+"/icon.png";
installed_os.append(ventry);

Json::saveToFile("/settings/installed_os.json", installed_os);
ventry["icon"] = iconfilename;
}
else if (QFile::exists(image->folder()+"/icon.png"))
ventry["icon"] = image->folder()+"/icon.png";

if (_partition)
{
installed_os.append(ventry);
}
else
{
int i=0;
foreach (QVariant v, installed_os)
{
QVariantMap m = v.toMap();
if (m.value("name").toString() == image->flavour())
installed_os.replace(i,ventry);
i++;
}
}
Json::saveToFile("/settings/installed_os.json", installed_os);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion recovery/mydebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <QDebug>

//Conditional flags
#define DO_DBG 1 //global debug enabler
#define DO_DBG 0 //global debug enabler
#define DBG_FUNC 1 //Debug entry/exit of functions
#define DBG_OUT 1 //Debug output strings

Expand Down
2 changes: 1 addition & 1 deletion recovery/progressslideshowdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ProgressSlideshowDialog::ProgressSlideshowDialog(const QStringList &slidesDirect
}
}
}
qDebug() << "Available slides" << _slides;
//qDebug() << "Available slides" << _slides;

if (_slides.isEmpty())
{
Expand Down
Loading

0 comments on commit 2730490

Please sign in to comment.