Skip to content

Commit

Permalink
Made wallpaper changeable
Browse files Browse the repository at this point in the history
  • Loading branch information
procount committed Aug 17, 2018
1 parent d3f775e commit 6a139b4
Show file tree
Hide file tree
Showing 23 changed files with 174 additions and 150 deletions.
9 changes: 7 additions & 2 deletions buildroot/package/recovery/init
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ if [ -e /sys/devices/platform/rpi_ft5406 ]; then
fi

#Check for user init script

pinndrive=
mkdir -p /tmp/mnt
cd /sys/class/block
for d in *1/;
Expand All @@ -79,6 +79,7 @@ do
mount /dev/$d /tmp/mnt 2>/dev/null
if [ $? -eq 0 ]; then
if [ -f "/tmp/mnt/recovery.rfs" ]; then
pinndrive=/dev/$d
if [ -f "/tmp/mnt/pinn_init.sh" ]; then
sh -c "/tmp/mnt/pinn_init.sh"
fi
Expand Down Expand Up @@ -114,6 +115,7 @@ fi
EXTRA_REPOS=
REPO_LIST=
DEFAULT_STYLE=
DEFAULT_DRIVE=

if grep -q runinstaller /proc/cmdline; then
RUN_INSTALLER=-runinstaller
Expand Down Expand Up @@ -158,6 +160,9 @@ fi
if [ "${p%%=*}" == "style" ] ; then
DEFAULT_STYLE="-style=${p#*=}"
fi
if [ -n "$pinndrive" ] ; then
DEFAULT_DRIVE="-pinndrive=$pinndrive"
fi
done

if grep -q vncinstall /proc/cmdline; then
Expand All @@ -168,7 +173,7 @@ fi
echo
fi

/usr/bin/recovery $RUN_INSTALLER $GPIO_TRIGGER $KEYBOARD_NO_TRIGGER $FORCE_TRIGGER $DEFAULT_KBD $DEFAULT_LANG $DEFAULT_DISPLAY $DEFAULT_PARTITION $DEFAULT_NOCONFIG $DEFAULT_DSI $DEFAULT_REPOS $EXTRA_REPOS $REPO_LIST $DEFAULT_STYLE -qws 2>/tmp/debug
/usr/bin/recovery $RUN_INSTALLER $GPIO_TRIGGER $KEYBOARD_NO_TRIGGER $FORCE_TRIGGER $DEFAULT_KBD $DEFAULT_LANG $DEFAULT_DISPLAY $DEFAULT_PARTITION $DEFAULT_NOCONFIG $DEFAULT_DSI $DEFAULT_REPOS $EXTRA_REPOS $REPO_LIST $DEFAULT_STYLE $DEFAULT_DRIVE -qws 2>/tmp/debug


# Recovery should have rebooted
Expand Down
105 changes: 62 additions & 43 deletions recovery/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ int main(int argc, char *argv[])
GpioInput *gpio=NULL;
cec = enableCEC();

QString drive;
bool driveReady = false;

bool runinstaller = false;
bool keyboard_trigger = true;
bool force_trigger = false;
Expand Down Expand Up @@ -248,6 +251,11 @@ int main(int argc, char *argv[])
if (argc > i+1)
defaultPartition = argv[i+1];
}
else if (strcmp(argv[i], "-pinndrive") == 0)
{
if (argc > i+1)
drive = argv[i+1];
}
// Allow default repos to be specified in commandline
else if (strcmp(argv[i], "-no_default_source") == 0)
{
Expand All @@ -273,6 +281,47 @@ int main(int argc, char *argv[])
}
}

//==========================
// Wait for drive device to show up
QTime t;
t.start();

while (t.elapsed() < 10000)
{
if (drive.isEmpty())
{
/* We do not know the exact drive name to wait for */
drive = findRecoveryDrive();
if (!drive.isEmpty())
{
driveReady = true;
break;
}
}
else if (drive.startsWith("/dev"))
{
if (QFile::exists(drive))
{
driveReady = true;
break;
}
}

QApplication::processEvents(QEventLoop::WaitForMoreEvents, 100);
}
if (!driveReady)
{
QMessageBox::critical(NULL, "Files not found", QString("Cannot find the drive with PINN files %1").arg(drive), QMessageBox::Close);
return 1;
}
qDebug() << "PINN drive:" << drive;

QProcess::execute("mount -o ro -t vfat "+partdev(drive, 1)+" /mnt");
cec->loadCECmap("/mnt/cec_keys.json");

// do some stuff at start in background.
runCustomScript(drive, 1,"background.sh", true);

if (use_default_source)
{
QStringList urls = QString(DEFAULT_REPO_SERVER).split(' ', QString::SkipEmptyParts);
Expand Down Expand Up @@ -302,7 +351,16 @@ int main(int argc, char *argv[])

int r,g,b;
int newBGnd;
QPixmap pixmap(":/wallpaper.png");

QPixmap pixmap;
if (QFile::exists("/mnt/wallpaper.png"))
{
pixmap.load("/mnt/wallpaper.png");
}
else
{
pixmap.load(":/wallpaper.png");
}
QString cmdline = getFileContents("/proc/cmdline");
QStringList args = cmdline.split(QChar(' '),QString::SkipEmptyParts);
foreach (QString s, args)
Expand Down Expand Up @@ -356,48 +414,7 @@ int main(int argc, char *argv[])
splash->show();
QApplication::processEvents();

// Wait for drive device to show up
QString drive;
bool driveReady = false;
QTime t;
t.start();

while (t.elapsed() < 10000)
{
if (drive.isEmpty())
{
/* We do not know the exact drive name to wait for */
drive = findRecoveryDrive();
if (!drive.isEmpty())
{
driveReady = true;
break;
}
}
else if (drive.startsWith("/dev"))
{
if (QFile::exists(drive))
{
driveReady = true;
break;
}
}

QApplication::processEvents(QEventLoop::WaitForMoreEvents, 100);
}
if (!driveReady)
{
QMessageBox::critical(NULL, "Files not found", QString("Cannot find the drive with PINN files %1").arg(drive), QMessageBox::Close);
return 1;
}
qDebug() << "PINN drive:" << drive;

QProcess::execute("mount -o ro -t vfat "+partdev(drive, 1)+" /mnt");
cec->loadCECmap("/mnt/cec_keys.json");
QProcess::execute("umount /mnt");

// do some stuff at start in background.
runCustomScript(drive, 1,"background.sh", true);
//------------------------------------------------

// If -runinstaller is not specified, only continue if SHIFT is pressed, GPIO is triggered,
// or no OS is installed (/settings/installed_os.json does not exist)
Expand Down Expand Up @@ -434,6 +451,8 @@ int main(int argc, char *argv[])
}
}

QProcess::execute("umount /mnt"); //restore mounted behaviour

cec->clearKeyPressed();

if (bailout)
Expand Down
10 changes: 5 additions & 5 deletions recovery/translation_ae.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@
<translation>خطا في تركيب قسم إعدادات</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="304"/>
<location filename="bootselectiondialog.cpp" line="322"/>
<source>HDMI safe mode</source>
<translation>HDMI الوضع الأمن</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="308"/>
<location filename="bootselectiondialog.cpp" line="326"/>
<source>composite PAL mode</source>
<translation>وضع PAL المركب</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="312"/>
<location filename="bootselectiondialog.cpp" line="330"/>
<source>composite NTSC mode</source>
<translation>وضع NTSC المركب</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="353"/>
<location filename="bootselectiondialog.cpp" line="371"/>
<source>PINN - Previously selected OS will boot in %1 seconds</source>
<translation>PINN - سيتم اختيار نظام التشغيل المحدد سابقا في %1 ثانية</translation>
</message>
<message>
<location filename="bootselectiondialog.ui" line="25"/>
<location filename="bootselectiondialog.cpp" line="355"/>
<location filename="bootselectiondialog.cpp" line="373"/>
<source>PINN - Select OS to boot</source>
<translation>PINN - حدد نظام التشغيل للاقلاع</translation>
</message>
Expand Down
10 changes: 5 additions & 5 deletions recovery/translation_ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@
<translation>Fallu montando la partición d&apos;axustes</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="304"/>
<location filename="bootselectiondialog.cpp" line="322"/>
<source>HDMI safe mode</source>
<translation>Mou seguru HDMI</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="308"/>
<location filename="bootselectiondialog.cpp" line="326"/>
<source>composite PAL mode</source>
<translation>Mou compuestu PAL</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="312"/>
<location filename="bootselectiondialog.cpp" line="330"/>
<source>composite NTSC mode</source>
<translation>mou compuestu NTSC</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="353"/>
<location filename="bootselectiondialog.cpp" line="371"/>
<source>PINN - Previously selected OS will boot in %1 seconds</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="bootselectiondialog.ui" line="25"/>
<location filename="bootselectiondialog.cpp" line="355"/>
<location filename="bootselectiondialog.cpp" line="373"/>
<source>PINN - Select OS to boot</source>
<translation type="unfinished"></translation>
</message>
Expand Down
10 changes: 5 additions & 5 deletions recovery/translation_ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="304"/>
<location filename="bootselectiondialog.cpp" line="322"/>
<source>HDMI safe mode</source>
<translation>mode HDMI segur</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="308"/>
<location filename="bootselectiondialog.cpp" line="326"/>
<source>composite PAL mode</source>
<translation>mode PAL compost</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="312"/>
<location filename="bootselectiondialog.cpp" line="330"/>
<source>composite NTSC mode</source>
<translation>mode NTSC compost</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="353"/>
<location filename="bootselectiondialog.cpp" line="371"/>
<source>PINN - Previously selected OS will boot in %1 seconds</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="bootselectiondialog.ui" line="25"/>
<location filename="bootselectiondialog.cpp" line="355"/>
<location filename="bootselectiondialog.cpp" line="373"/>
<source>PINN - Select OS to boot</source>
<translation type="unfinished"></translation>
</message>
Expand Down
10 changes: 5 additions & 5 deletions recovery/translation_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@
<translation>Fehler beim Einbinden der Einstellungspartition</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="304"/>
<location filename="bootselectiondialog.cpp" line="322"/>
<source>HDMI safe mode</source>
<translation>HDMI-Modus (sicher)</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="308"/>
<location filename="bootselectiondialog.cpp" line="326"/>
<source>composite PAL mode</source>
<translation>Composite-PAL-Modus</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="312"/>
<location filename="bootselectiondialog.cpp" line="330"/>
<source>composite NTSC mode</source>
<translation>Composite-NTSC-Modus</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="353"/>
<location filename="bootselectiondialog.cpp" line="371"/>
<source>PINN - Previously selected OS will boot in %1 seconds</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="bootselectiondialog.ui" line="25"/>
<location filename="bootselectiondialog.cpp" line="355"/>
<location filename="bootselectiondialog.cpp" line="373"/>
<source>PINN - Select OS to boot</source>
<translation type="unfinished"></translation>
</message>
Expand Down
10 changes: 5 additions & 5 deletions recovery/translation_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<name>BootSelectionDialog</name>
<message>
<location filename="bootselectiondialog.ui" line="25"/>
<location filename="bootselectiondialog.cpp" line="355"/>
<location filename="bootselectiondialog.cpp" line="373"/>
<source>PINN - Select OS to boot</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -30,22 +30,22 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="304"/>
<location filename="bootselectiondialog.cpp" line="322"/>
<source>HDMI safe mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="308"/>
<location filename="bootselectiondialog.cpp" line="326"/>
<source>composite PAL mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="312"/>
<location filename="bootselectiondialog.cpp" line="330"/>
<source>composite NTSC mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="353"/>
<location filename="bootselectiondialog.cpp" line="371"/>
<source>PINN - Previously selected OS will boot in %1 seconds</source>
<translation type="unfinished"></translation>
</message>
Expand Down
10 changes: 5 additions & 5 deletions recovery/translation_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@
<translation>Error al montar la partición Settings</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="304"/>
<location filename="bootselectiondialog.cpp" line="322"/>
<source>HDMI safe mode</source>
<translation>Modo HDMI seguro (safe)</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="308"/>
<location filename="bootselectiondialog.cpp" line="326"/>
<source>composite PAL mode</source>
<translation>Modo PAL compuesto</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="312"/>
<location filename="bootselectiondialog.cpp" line="330"/>
<source>composite NTSC mode</source>
<translation>Modo NTSC compuesto</translation>
</message>
<message>
<location filename="bootselectiondialog.cpp" line="353"/>
<location filename="bootselectiondialog.cpp" line="371"/>
<source>PINN - Previously selected OS will boot in %1 seconds</source>
<translation>PINN - El SO previamente seleccionado se iniciara en %1 segundos</translation>
</message>
<message>
<location filename="bootselectiondialog.ui" line="25"/>
<location filename="bootselectiondialog.cpp" line="355"/>
<location filename="bootselectiondialog.cpp" line="373"/>
<source>PINN - Select OS to boot</source>
<translation>PINN - Seleccione el SO qué desea iniciar</translation>
</message>
Expand Down
Loading

0 comments on commit 6a139b4

Please sign in to comment.