Something went wrong. Try again.
Bring Windows XP themes to your KDE Plasma environment! xplasma.hotsocket.fyi
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103// SPDX-License-Identifier: GPL-3.0-or-later#pragma once// First-run setup: what XPlasma needs on this machine. None of it ships with// XPlasma -- XP's media, its styles and fonts are Microsoft's -- so it's taken// from media the user has, or fetched from archive.org://// * XP's install media (an ISO, or a folder holding I386): the fonts, the// Luna style, every .theme preset, the wallpapers. Only what's used is// taken out (a few MB of ~600), and the media is recorded, for the files// taken from it later (the Start flag, the icons).// * archive.org: XP's media itself, and the official theme packs (Royale,// Royale Noir, Zune, Embedded). Items are named; their files are read from// archive.org's metadata, not hardcoded.//// A cancelled or failed step removes what it added.#include <QHash>#include <QList>#include <QString>
#include <atomic>#include <functional>
namespace xpl::setup {
using Progress = std::function<void(const QString &line)>;using Bytes = std::function<void(qint64 done, qint64 total)>;
// Is this a running Plasma 6 session? (and what it said it was)bool plasmaSession(QString *detail = nullptr);
struct Check{ QString tool, purpose, found; // found: its path, or empty bool neededToApply = false; bool ok() const { return !found.isEmpty(); }};QList<Check> preflight();
struct Imported{ int fonts = 0, styles = 0, themes = 0, wallpapers = 0;};// XP's desktop wallpapers, as its setup INFs install them (SHL_IMG.INF's// Web\Wallpaper, ACCESSOR.INF's "Desktop Wallpaper" component): each one's// file name on the media, lower case ("stoneh.jpg"), to the name XP gave it// ("Stonehenge.jpg").QHash<QString, QString> wallpaperNames(const QList<QByteArray> &infs);
// Whether `iso` is a disc image of a Windows XP CD that includes Service// Pack 3 -- its I386 folder, and the tag file SP3's CDs have at their root// (WIN51IP.SP3 for Professional, WIN51IC.SP3 for Home); else why not.bool checkMedia(const QString &iso, QString *why = nullptr);
// XP's install media. Cancelled or failed, nothing it added stays. Its// wallpapers are XP's own list, by XP's names; files an older XPlasma// imported by their 8.3 names are renamed (and what refers to them -- the// desktop, saved themes -- follows), or removed if XP never listed them.bool importMedia(const QString &path, Imported *counts, const Progress &progress, const std::atomic_bool *cancel = nullptr, QString *error = nullptr);
struct Download{ QString item; // archive.org item QString file; // its file, or "*.ext" (the largest such) QString label; bool optional = false; bool media = false; // XP's install media: imported, not unpacked QStringList leaveOut; // the archive's top-level folders not unpacked // Top-level folders unpacked under another name, and the files in them // named as they are ("Royale Noir/Royale Noir.msstyles" -> "Royale/Royale.msstyles"). QList<std::pair<QString, QString>> rename;};// XP's media, and the official packs.QList<Download> downloads();
// The packs as release 1 unpacked them, put as fetch() unpacks them now: a// folder a download renames (Royale Noir/, and its Royale Noir.msstyles) takes// its new name, in place of one it leaves out (Royale/, the Media Center// style), and the applied look and saved themes naming what moved follow. Run// again, there's nothing left to do. (migrate() is what runs it.)void tidyPacks(const Progress &progress = {});
// Release 6's layout: data()/assets (themes, wallpapers) and what's been// taken off the media into data()/Windows (Themes, Wallpapers, Cursors,// Sounds); saved themes and Classic schemes into the user's own// (paths::userFiles()). Links are left where the folders were; the applied// look and themes naming moved files follow. Run again, nothing to do.void moveToWindowsLayout(const Progress &progress = {});
// What release `from` of XPlasma left on disk, brought up to this one's: each// later release's migration, in order. Only where both releases are known --// Setup and install.sh, about to replace `from` (0: none installed; every// migration runs, each finding what's there).void migrate(int from, const Progress &progress = {});
// Fetched (unless the downloads cache has it), then unpacked into the theme// library -- or, for the media, imported. archive.org's address is// $XPLASMA_ARCHIVE_URL when set (the tests' own server).bool fetch(const Download &download, const Progress &progress, const Bytes &bytes = {}, const std::atomic_bool *cancel = nullptr, QString *error = nullptr);
} // namespace xpl::setup