mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
add Pony() call <3
helper and library refatoring
This commit is contained in:
parent
d166668feb
commit
61d814d9a2
@ -76,6 +76,11 @@ th.sub {
|
||||
<td>returns path to the library documentation</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QString Pony()</td>
|
||||
<td>prints Pinkie Pie to stdout. Really, just try</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QString SecurityDocs()</td>
|
||||
<td>returns path to the security documentation</td>
|
||||
@ -272,6 +277,11 @@ th.sub {
|
||||
<td>opens the library documentation</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>QString Pony()</td>
|
||||
<td>prints Pinkie Pie to stdout. Really, just try</td>
|
||||
<td>no</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bool Restore()</td>
|
||||
<td><code>true</code> and restores the application</td>
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include "netctlguiadaptor.h"
|
||||
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
@ -57,6 +59,19 @@ void NetctlGuiAdaptor::LibraryDocs()
|
||||
}
|
||||
|
||||
|
||||
QString NetctlGuiAdaptor::Pony()
|
||||
{
|
||||
QString pony;
|
||||
QFile ponyFile(QString(":pinkiepie"));
|
||||
if (!ponyFile.open(QIODevice::ReadOnly))
|
||||
return pony;
|
||||
pony = QTextCodec::codecForMib(106)->toUnicode(ponyFile.readAll());
|
||||
ponyFile.close();
|
||||
|
||||
return pony;
|
||||
}
|
||||
|
||||
|
||||
bool NetctlGuiAdaptor::Restore()
|
||||
{
|
||||
mainWindow->show();
|
||||
|
@ -38,6 +38,7 @@ public slots:
|
||||
bool Close();
|
||||
QStringList Information();
|
||||
void LibraryDocs();
|
||||
QString Pony();
|
||||
bool Restore();
|
||||
void SecurityDocs();
|
||||
QStringList Settings();
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include "controladaptor.h"
|
||||
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "netctlhelper.h"
|
||||
#include "version.h"
|
||||
|
||||
@ -66,6 +68,19 @@ QString ControlAdaptor::LibraryDocs()
|
||||
}
|
||||
|
||||
|
||||
QString ControlAdaptor::Pony()
|
||||
{
|
||||
QString pony;
|
||||
QFile ponyFile(QString(":pinkiepie"));
|
||||
if (!ponyFile.open(QIODevice::ReadOnly))
|
||||
return pony;
|
||||
pony = QTextCodec::codecForMib(106)->toUnicode(ponyFile.readAll());
|
||||
ponyFile.close();
|
||||
|
||||
return pony;
|
||||
}
|
||||
|
||||
|
||||
QString ControlAdaptor::SecurityDocs()
|
||||
{
|
||||
return (QString(DOCS_PATH) + QString("netctl-gui-security-notes.html"));
|
||||
|
@ -41,6 +41,7 @@ public slots:
|
||||
QString ApiDocs();
|
||||
bool Close();
|
||||
QString LibraryDocs();
|
||||
QString Pony();
|
||||
QString SecurityDocs();
|
||||
QStringList Settings();
|
||||
bool Update();
|
||||
|
@ -37,10 +37,8 @@ using namespace std;
|
||||
bool checkExistSession()
|
||||
{
|
||||
QDBusConnection bus = QDBusConnection::systemBus();
|
||||
QDBusMessage request = QDBusMessage::createMethodCall(DBUS_HELPER_SERVICE,
|
||||
DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE,
|
||||
QString("Active"));
|
||||
QDBusMessage request = QDBusMessage::createMethodCall(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("Active"));
|
||||
QDBusMessage response = bus.call(request);
|
||||
QList<QVariant> arguments = response.arguments();
|
||||
return !arguments.isEmpty();
|
||||
@ -52,33 +50,26 @@ int main(int argc, char *argv[])
|
||||
QMap<QString, QVariant> args = getArgs();
|
||||
// reading
|
||||
for (int i=1; i<argc; i++) {
|
||||
// config path
|
||||
if ((QString(argv[i]) == QString("-c")) || (QString(argv[i]) == QString("--config"))) {
|
||||
// config path
|
||||
args[QString("config")] = QDir().absoluteFilePath(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
} else if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug"))) {
|
||||
// debug
|
||||
else if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug"))) {
|
||||
args[QString("debug")] = true;
|
||||
}
|
||||
} else if (QString(argv[i]) == QString("--nodaemon")) {
|
||||
// daemonized
|
||||
else if (QString(argv[i]) == QString("--nodaemon")) {
|
||||
args[QString("nodaemon")] = true;
|
||||
}
|
||||
// messages
|
||||
} else if ((QString(argv[i]) == QString("-h")) || (QString(argv[i]) == QString("--help"))) {
|
||||
// help message
|
||||
else if ((QString(argv[i]) == QString("-h")) || (QString(argv[i]) == QString("--help"))) {
|
||||
args[QString("help")] = true;
|
||||
}
|
||||
} else if ((QString(argv[i]) == QString("-i")) || (QString(argv[i]) == QString("--info"))) {
|
||||
// info message
|
||||
else if ((QString(argv[i]) == QString("-i")) || (QString(argv[i]) == QString("--info"))) {
|
||||
args[QString("info")] = true;
|
||||
}
|
||||
} else if ((QString(argv[i]) == QString("-v")) || (QString(argv[i]) == QString("--version"))) {
|
||||
// version message
|
||||
else if ((QString(argv[i]) == QString("-v")) || (QString(argv[i]) == QString("--version"))) {
|
||||
args[QString("version")] = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
args[QString("error")] = true;
|
||||
}
|
||||
}
|
||||
|
@ -166,9 +166,7 @@ void NetctlHelper::updateConfiguration()
|
||||
if (debug) qDebug() << "[NetctlHelper]" << "[updateConfiguration]";
|
||||
|
||||
deleteInterface();
|
||||
|
||||
configuration = getSettings();
|
||||
|
||||
createInterface();
|
||||
}
|
||||
|
||||
|
@ -93,9 +93,11 @@ bool Netctl::cmdCall(const bool sudo, const QString command, const QString comma
|
||||
}
|
||||
|
||||
QString cmd = QString("");
|
||||
if (sudo) cmd = sudoCommand + QString(" ");
|
||||
if (sudo)
|
||||
cmd = sudoCommand + QString(" ");
|
||||
cmd += command + QString(" ") + commandLine;
|
||||
if (argument != 0) cmd += QString(" ") + argument;
|
||||
if (argument != 0)
|
||||
cmd += QString(" ") + argument;
|
||||
if (debug) qDebug() << "[Netctl]" << "[cmdCall]" << ":" << "Run cmd" << cmd;
|
||||
TaskResult process = runTask(cmd, (useSuid && sudo));
|
||||
if (debug) qDebug() << "[Netctl]" << "[cmdCall]" << ":" << "Cmd returns" << process.exitCode;
|
||||
@ -122,9 +124,11 @@ QString Netctl::getCmdOutput(const bool sudo, const QString command, const QStri
|
||||
}
|
||||
|
||||
QString cmd = QString("");
|
||||
if (sudo) cmd = sudoCommand + QString(" ");
|
||||
if (sudo)
|
||||
cmd = sudoCommand + QString(" ");
|
||||
cmd += command + QString(" ") + commandLine;
|
||||
if (argument != 0) cmd += QString(" ") + argument;
|
||||
if (argument != 0)
|
||||
cmd += QString(" ") + argument;
|
||||
if (debug) qDebug() << "[Netctl]" << "[getCmdOutput]" << ":" << "Run cmd" << cmd;
|
||||
TaskResult process = runTask(cmd, (useSuid && sudo));
|
||||
if (debug) qDebug() << "[Netctl]" << "[getCmdOutput]" << ":" << "Cmd returns" << process.exitCode;
|
||||
@ -255,9 +259,9 @@ QString Netctl::getProfileStatus(const QString profile)
|
||||
else
|
||||
status = QString("inactive");
|
||||
if (isProfileEnabled(profile))
|
||||
status = status + QString(" (enabled)");
|
||||
status += QString(" (enabled)");
|
||||
else
|
||||
status = status + QString(" (static)");
|
||||
status += QString(" (static)");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -100,8 +100,7 @@ QString NetctlProfile::createProfile(const QString profile, const QMap<QString,
|
||||
if (debug) qDebug() << "[NetctlProfile]" << "[createProfile]";
|
||||
if (debug) qDebug() << "[NetctlProfile]" << "[createProfile]" << ":" << "Profile" << profile;
|
||||
|
||||
QString profileTempName = QDir::homePath() + QDir::separator() +
|
||||
QString(".cache") + QDir::separator() + QFileInfo(profile).fileName();
|
||||
QString profileTempName = QDir::homePath() + QString("/.cache/") + QFileInfo(profile).fileName();
|
||||
QFile profileFile(profileTempName);
|
||||
if (debug) qDebug() << "[NetctlProfile]" << "[createProfile]" << ":" << "Save to" << profileTempName;
|
||||
if (!profileFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
|
21
sources/resources/pinkiepie
Normal file
21
sources/resources/pinkiepie
Normal file
@ -0,0 +1,21 @@
|
||||
[0m [00m
|
||||
[38;5;161m▄[48;5;161m██[38;5;204m▄▄[49;38;5;161m▄[39m [38;5;161m▄▄▄[39m [00m
|
||||
[48;5;161;38;5;161m█[48;5;204;38;5;204m██[48;5;161m▄[48;5;204;38;5;161m▄[38;5;204m█[48;5;161m▄[49;38;5;161m▄[48;5;161;38;5;204m▄[48;5;204;38;5;175m▄▄▄[48;5;161;38;5;204m▄▄[49;38;5;161m▄[39m [00m
|
||||
[38;5;161m▄[48;5;161;38;5;204m▄▄[38;5;161m█[48;5;204;38;5;204m██[48;5;161m▄[48;5;204;38;5;161m▄[38;5;204m██[48;5;161m▄[48;5;204m█[48;5;175;38;5;175m█[48;5;218;38;5;218m██[48;5;175;38;5;175m█[48;5;204;38;5;204m█[48;5;161m▄[49;38;5;161m▄[39m [00m
|
||||
[38;5;161m▄[48;5;161;38;5;204m▄▄▄[38;5;161m█[38;5;204m▄[48;5;204;38;5;161m▄[38;5;204m██[38;5;161m▄▄[48;5;161;38;5;218m▄▄▄▄▄[48;5;175m▄[48;5;218m█[48;5;211;38;5;175m▄[48;5;218;38;5;218m█[48;5;175;38;5;175m█[48;5;204;38;5;204m█[48;5;161;38;5;161m█[49;39m [00m
|
||||
[48;5;161;38;5;161m█[48;5;204;38;5;204m███[38;5;161m▄▄[48;5;161m█[48;5;204;38;5;204m█[38;5;161m▄[48;5;161;38;5;218m▄[48;5;218m██[38;5;175m▄[38;5;16m▄▄[38;5;218m█[38;5;16m▄[38;5;218m██[48;5;175m▄[48;5;218m█[48;5;175;38;5;175m█[48;5;204;38;5;204m█[48;5;161;38;5;161m█[49;39m [38;5;161m▄[48;5;161m█[38;5;204m▄▄▄[49;38;5;161m▄[39m [00m
|
||||
[48;5;161;38;5;161m█[48;5;204;38;5;204m██[48;5;161;38;5;161m█[49;39m [48;5;175;38;5;175m█[48;5;161;38;5;16m▄[48;5;218;38;5;218m██[38;5;16m▄[48;5;16;38;5;218m▄[48;5;218m███[48;5;16m▄[48;5;218;38;5;16m▄▄[38;5;218m█[38;5;175m▄[38;5;161m▄[48;5;161;38;5;204m▄[48;5;204m█[48;5;161;38;5;161m█[49;39m [38;5;161m▄[48;5;161;38;5;204m▄▄▄▄[49;38;5;161m▄[48;5;161m█[38;5;204m▄[48;5;204m█[38;5;161m▄▄▄[38;5;204m█[48;5;161m▄[49;38;5;161m▄[39m [00m
|
||||
[48;5;161;38;5;161m█[48;5;204;38;5;204m█[48;5;161;38;5;161m█[49;39m [48;5;175;38;5;175m█[48;5;16;38;5;16m█[48;5;218;38;5;218m██[48;5;16;38;5;16m█[48;5;218;38;5;218m█████[48;5;175;38;5;16m▄[48;5;218;38;5;218m██[48;5;175;38;5;175m█[48;5;161;38;5;161m█[48;5;204;38;5;204m█[48;5;161;38;5;161m█[49;39m [48;5;161;38;5;161m█[48;5;204;38;5;204m█[38;5;161m▄▄▄▄[38;5;204m█[48;5;161m▄[48;5;204;38;5;161m▄[48;5;161;38;5;204m▄[48;5;204m███[48;5;161;38;5;161m█[48;5;204;38;5;204m█[48;5;161;38;5;161m█[49;39m [00m
|
||||
[38;5;161m▀[48;5;204m▄[38;5;204m█[48;5;161;38;5;161m█[49;39m [38;5;175m▄[48;5;175m█[48;5;16m▄[48;5;175;38;5;218m▄[48;5;218m█[48;5;175m▄[48;5;218m████[38;5;175m▄[48;5;175;38;5;218m▄[48;5;218m█[38;5;161m▄[48;5;161;38;5;204m▄▄[48;5;204m█[48;5;161m▄▄▄[49;38;5;161m▄[48;5;161m█[48;5;204m▄[48;5;161;38;5;204m▄[48;5;204m████[48;5;161;38;5;161m█[48;5;204m▄[48;5;161;38;5;204m▄[48;5;204m█████[48;5;161;38;5;161m█[48;5;204;38;5;204m█[48;5;161;38;5;161m█[49;39m [00m
|
||||
[38;5;161m▀[48;5;161m█[49;39m [48;5;175;38;5;175m█[48;5;218;38;5;218m██[48;5;211;38;5;175m▄[48;5;218;38;5;218m████████[48;5;161;38;5;161m█[48;5;204;38;5;204m█[38;5;161m▄▄[38;5;204m███[38;5;161m▄[48;5;161m██[38;5;204m▄[48;5;204;38;5;161m▄[48;5;161m█[48;5;204;38;5;204m█████[38;5;161m▄▄[38;5;204m████[48;5;161;38;5;161m█[48;5;204;38;5;204m█[48;5;161;38;5;161m█[49;39m [00m
|
||||
[38;5;161m▄▀[39m [38;5;175m▀▀[48;5;175m█[48;5;218m▄▄▄▄▄[38;5;218m███[38;5;161m▄[48;5;161;38;5;204m▄[48;5;204;38;5;161m▄▄[48;5;161;38;5;204m▄[48;5;204;38;5;161m▄[48;5;161;38;5;204m▄[48;5;204m█[48;5;161;38;5;161m█[38;5;175m▄[48;5;204;38;5;204m█[48;5;161;38;5;161m██[48;5;204m▄[38;5;204m███[38;5;161m▄[48;5;161;38;5;204m▄[48;5;204m█[48;5;161;38;5;161m█[48;5;204;38;5;204m██[48;5;161;38;5;161m█[48;5;204;38;5;204m█[38;5;161m▄[49m▀[39m [00m
|
||||
[38;5;204m▀[39m [48;5;175;38;5;175m█[48;5;218;38;5;218m█[38;5;161m▄[48;5;161;38;5;204m▄[48;5;204m██[38;5;161m▄▄[48;5;161m█[48;5;204m▄[48;5;161;38;5;218m▄▄[48;5;218;38;5;228m▄▄[48;5;175;38;5;218m▄[49;38;5;175m▄[39m [38;5;161m▀▀[48;5;204m▄▄[48;5;161m█[48;5;204m▄▄[48;5;161;38;5;204m▄[48;5;204m█[48;5;161;38;5;161m█[48;5;204;38;5;204m█[48;5;161m▄[49;38;5;161m▄[39m [00m
|
||||
[48;5;175;38;5;175m█[48;5;218;38;5;218m█[48;5;161;38;5;161m█[48;5;204;38;5;204m██[48;5;161m▄[48;5;204;38;5;161m▄[38;5;204m█[48;5;161m▄[48;5;218;38;5;161m▄[38;5;218m███[48;5;228m▄[48;5;218;38;5;81m▄[48;5;175m▄[38;5;175m█[49;39m [48;5;161;38;5;161m█[48;5;204;38;5;204m███[38;5;161m▄[48;5;161;38;5;204m▄[48;5;204m███[48;5;161m▄[49;38;5;161m▄[39m[00m
|
||||
[48;5;175;38;5;175m█[48;5;161;38;5;218m▄[48;5;204;38;5;161m▄[38;5;204m█[38;5;161m▄[48;5;161;38;5;204m▄[48;5;204;38;5;161m▄▄[48;5;161;38;5;218m▄[48;5;218m█[38;5;175m▄[48;5;81;38;5;81m█[48;5;218;38;5;218m█[48;5;81;38;5;228m▄[38;5;218m▄[48;5;175;38;5;175m█[49;39m [48;5;161;38;5;161m█[48;5;204;38;5;204m██[48;5;161m▄[38;5;161m█[38;5;204m▄▄▄[38;5;161m█[48;5;204m▄[38;5;204m█[48;5;161;38;5;161m█[49;39m[00m
|
||||
[48;5;175;38;5;169m▄[48;5;218m▄[48;5;161;38;5;218m▄[38;5;161m█[38;5;204m▄[48;5;218;38;5;218m████[48;5;175;38;5;175m█[48;5;228;38;5;218m▄[48;5;218m███[48;5;175;38;5;175m█[49;39m [38;5;161m▀[48;5;204m▄[38;5;204m███[48;5;161;38;5;161m██[48;5;204m▄▄[48;5;161m██[49m▀[39m[00m
|
||||
[38;5;169m▄[48;5;169m█[38;5;175m▄[48;5;175;38;5;218m▄▄[48;5;161m▄[38;5;161m█[48;5;218;38;5;218m█[48;5;175;38;5;175m█[49m▀[48;5;175;38;5;169m▄[38;5;175m█[48;5;218m▄[38;5;218m███[48;5;175;38;5;175m█[38;5;218m▄[38;5;175m█[49;39m [38;5;161m▀[48;5;204m▄[48;5;161m█[48;5;204m▄▄[38;5;204m██[48;5;161;38;5;161m█[49;39m [38;5;161m▄[39m[00m
|
||||
[38;5;169m▄[48;5;169;38;5;211m▄[48;5;211m█[48;5;175;38;5;175m█[38;5;218m▄[48;5;218m██[38;5;175m▄▄[48;5;161m▄[49m▀[48;5;169;38;5;169m█[38;5;211m▄[48;5;211m██[48;5;175;38;5;175m█[38;5;218m▄[48;5;218m██[38;5;175m▄[49m▀[39m [38;5;161m▄[48;5;161;38;5;204m▄[48;5;204m█[38;5;161m▄[48;5;161m█[49m▄▄[48;5;161m█[49;39m[00m
|
||||
[48;5;169;38;5;169m█[48;5;211m▄[48;5;175;38;5;175m█[48;5;218;38;5;218m████[48;5;175;38;5;175m█[49;39m [48;5;169;38;5;169m█[48;5;211;38;5;211m██[38;5;175m▄[48;5;175;38;5;218m▄[48;5;218m███[38;5;175m▄[49m▀[39m [38;5;161m▀[48;5;204m▄▄▄▄[49m▀▀[39m [00m
|
||||
[48;5;175;38;5;175m█[48;5;218;38;5;218m████[48;5;175;38;5;175m█[49;39m [38;5;169m▀▀[48;5;175;38;5;175m█[48;5;218;38;5;218m█████[48;5;175;38;5;175m█[49;39m [00m
|
||||
[38;5;175m▀▀▀▀▀▀[39m [38;5;175m▀▀▀▀▀▀[39m [00m
|
||||
[00m
|
@ -3,5 +3,7 @@
|
||||
<!-- helper translations -->
|
||||
<file>translations-helper/en.qm</file>
|
||||
<file>translations-helper/ru.qm</file>
|
||||
<!-- pony <3 -->
|
||||
<file>pinkiepie</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -8,5 +8,7 @@
|
||||
<file>wifi.png</file>
|
||||
<file>network-idle-64x64.png</file>
|
||||
<file>network-offline-64x64.png</file>
|
||||
<!-- pony <3 -->
|
||||
<file>pinkiepie</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define TRANSLATORS ""
|
||||
#define EMAIL "@PROJECT_CONTACT@"
|
||||
#define LICENSE "@PROJECT_LICENSE@"
|
||||
#define TRDPARTY_LICENSE "tasks,BSD,https://github.com/mhogomchungu/tasks;"
|
||||
#define TRDPARTY_LICENSE "tasks,BSD,https://github.com/mhogomchungu/tasks;ponysay,GPLv3,http://erkin.co/ponysay"
|
||||
|
||||
#define HOMEPAGE "http://arcanis.name/projects/netctl-gui/"
|
||||
#define REPOSITORY "https://github.com/arcan1s/netctl-gui"
|
||||
|
Loading…
Reference in New Issue
Block a user