From 0e215b619b32e58089cae01ecf4db5fa79f33664 Mon Sep 17 00:00:00 2001 From: Alexandre Arnt Date: Sat, 11 Jul 2015 18:13:51 -0300 Subject: [PATCH] - Added Parabola GNU/Linux-libre support (thanks to coadde). --- src/mainwindow_news.cpp | 5 +++++ src/package.cpp | 3 ++- src/strconstants.h | 15 ++++++++++++++- src/unixcommand.cpp | 4 ++++ src/unixcommand.h | 2 +- src/utils.cpp | 13 ++++++++++++- diff --git a/src/mainwindow_news.cpp b/src/mainwindow_news.cpp index da54e30..e5be94b 100644 --- a/src/mainwindow_news.cpp +++ b/src/mainwindow_news.cpp @@ -83,6 +83,11 @@ void MainWindow::refreshDistroNews(bool searchForLatestNews, bool gotoNewsTab) writeToTabOutputExt("" + StrConstants::getSearchingForDistroNews().arg("Netrunner Rolling") + ""); } + else if (gotoNewsTab && distro == ectn_PARABOLA) + { + writeToTabOutputExt("" + + StrConstants::getSearchingForDistroNews().arg("Parabola GNU/Linux-libre") + ""); + } /* * Here, we retrieve distro's latest news without diff --git a/src/package.cpp b/src/package.cpp index 9815e10..c5014db 100644 --- a/src/package.cpp +++ b/src/package.cpp @@ -1178,7 +1178,8 @@ QStringList Package::getContents(const QString& pkgName, bool isInstalled) else if (UnixCommand::getLinuxDistro() == ectn_ARCHBANGLINUX || UnixCommand::getLinuxDistro() == ectn_ARCHLINUX || UnixCommand::getLinuxDistro() == ectn_KAOS || - UnixCommand::getLinuxDistro() == ectn_MOOOSLINUX) + UnixCommand::getLinuxDistro() == ectn_MOOOSLINUX || + UnixCommand::getLinuxDistro() == ectn_PARABOLA) { result = UnixCommand::getPackageContentsUsingPkgfile(pkgName); } diff --git a/src/strconstants.h b/src/strconstants.h index 20de4b3..3f6f1ab 100644 --- a/src/strconstants.h +++ b/src/strconstants.h @@ -60,6 +60,9 @@ class StrConstants{ if (UnixCommand::getLinuxDistro() == ectn_KAOS) return QLatin1String( "KCP" ); + if (UnixCommand::getLinuxDistro() == ectn_PARABOLA) + return QLatin1String( "Custom" ); + return QLatin1String( "AUR" ); } @@ -68,6 +71,8 @@ class StrConstants{ return QLatin1String( "ccr" ); else if (UnixCommand::getLinuxDistro() == ectn_KAOS) return QLatin1String( "kcp" ); + else if (UnixCommand::getLinuxDistro() == ectn_PARABOLA) + return QLatin1String( "custom" ); return QLatin1String( "aur" ); } @@ -100,6 +105,8 @@ class StrConstants{ return QLatin1String( "Ccr" ); else if (UnixCommand::getLinuxDistro() == ectn_KAOS) return QLatin1String( "KCP" ); + else if (UnixCommand::getLinuxDistro() == ectn_PARABOLA) + return QLatin1String( "Custom" ); return QLatin1String( "AUR" ); } @@ -110,6 +117,8 @@ class StrConstants{ return QLatin1String( "ccr/" ); else if (UnixCommand::getLinuxDistro() == ectn_KAOS) return "kcp/"; + else if (UnixCommand::getLinuxDistro() == ectn_PARABOLA) + return "custom/"; return QLatin1String( "aur/" ); } @@ -142,12 +151,16 @@ class StrConstants{ return QObject::tr("Netrunner Rolling news"); } + static QString getParabolaNews(){ + return QObject::tr("Parabola GNU/Linux-libre news"); + } + static QString getNewsErrorMessage(){ return QObject::tr("No news could be found! Press Ctrl+G to download the latest news."); } static QString getIncompatibleLinuxDistroError(){ - return QObject::tr("This Linux distro seems to be incompatible with Octopi!"); + return QObject::tr("This GNU/Linux distro seems to be incompatible with Octopi!"); } static QString getInternetUnavailableError(){ diff --git a/src/unixcommand.cpp b/src/unixcommand.cpp index 5c2d9e9..43e0fbf 100644 --- a/src/unixcommand.cpp +++ b/src/unixcommand.cpp @@ -1036,6 +1036,10 @@ LinuxDistro UnixCommand::getLinuxDistro() { ret = ectn_NETRUNNER; } + else if (contents.contains(QRegExp("Parabola GNU/Linux-libre"))) + { + ret = ectn_PARABOLA; + } else { ret = ectn_UNKNOWN; diff --git a/src/unixcommand.h b/src/unixcommand.h index 3a33754..1fda5be 100644 --- a/src/unixcommand.h +++ b/src/unixcommand.h @@ -37,7 +37,7 @@ enum CommandExecuting { ectn_NONE, ectn_MIRROR_CHECK, ectn_SYNC_DATABASE, ectn_RUN_IN_TERMINAL }; enum LinuxDistro { ectn_ANTERGOS, ectn_ARCHBANGLINUX, ectn_ARCHBSD, ectn_ARCHLINUX, ectn_CHAKRA, - ectn_KAOS, ectn_MANJAROLINUX, ectn_MOOOSLINUX, ectn_NETRUNNER, ectn_UNKNOWN }; + ectn_KAOS, ectn_MANJAROLINUX, ectn_MOOOSLINUX, ectn_NETRUNNER, ectn_PARABOLA, ectn_UNKNOWN }; enum Language { ectn_LANG_ENGLISH, ectn_LANG_USER_DEFINED }; diff --git a/src/utils.cpp b/src/utils.cpp index 30ca38e..2c82811 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -278,6 +278,7 @@ QString utils::retrieveDistroNews(bool searchForLatestNews) //const QString ctn_MANJARO_LINUX_RSS_URL = "http://manjaro.org/feed/"; const QString ctn_MANJARO_LINUX_RSS_URL = "https://manjaro.github.io/feed.xml"; const QString ctn_NETRUNNER_RSS_URL = "http://www.netrunner-os.com/feed/"; + const QString ctn_PARABOLA_RSS_URL = "https://www.parabola.nu/feeds/news/"; LinuxDistro distro = UnixCommand::getLinuxDistro(); QString res; @@ -295,7 +296,7 @@ QString utils::retrieveDistroNews(bool searchForLatestNews) } if(searchForLatestNews && UnixCommand::hasInternetConnection() && distro != ectn_UNKNOWN) - { + { QString curlCommand = "curl %1 -o %2"; if (distro == ectn_ANTERGOS) @@ -326,6 +327,12 @@ QString utils::retrieveDistroNews(bool searchForLatestNews) { curlCommand = curlCommand.arg(ctn_NETRUNNER_RSS_URL).arg(tmpRssPath); } + else if (distro == ectn_PARABOLA) + { + //Parabola has a certificate which is not "trusted" by default, so we use "curl -k" + curlCommand = "curl -k %1 -o %2"; + curlCommand = curlCommand.arg(ctn_PARABOLA_RSS_URL).arg(tmpRssPath); + } if (UnixCommand::runCurlCommand(curlCommand).isEmpty()) { @@ -438,6 +445,10 @@ QString utils::parseDistroNews() { html = "

" + StrConstants::getNetrunnerNews() + "