mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-02 07:46:07 +00:00
Correcting for PR comments
This commit is contained in:
parent
de88176995
commit
0802609fd8
@ -541,18 +541,22 @@ void ListCommandLineParser::parse(const QStringList &args)
|
|||||||
parser.setupCommonOptions();
|
parser.setupCommonOptions();
|
||||||
parser.setApplicationDescription(
|
parser.setApplicationDescription(
|
||||||
"\n"
|
"\n"
|
||||||
"List the available apps on the given host as CSV:\n"
|
"List the available apps on the given host."
|
||||||
"\tName, ID, HDR Support, App Collection Game, Hidden, Direct Launch, Path to Boxart"
|
|
||||||
);
|
);
|
||||||
parser.addPositionalArgument("list", "list available apps");
|
parser.addPositionalArgument("list", "list available apps");
|
||||||
parser.addPositionalArgument("host", "Host computer name, UUID, or IP address", "<host>");
|
parser.addPositionalArgument("host", "Host computer name, UUID, or IP address", "<host>");
|
||||||
|
|
||||||
|
parser.addFlagOption("csv", "Print as CSV with additional information");
|
||||||
|
|
||||||
if (!parser.parse(args)) {
|
if (!parser.parse(args)) {
|
||||||
parser.showError(parser.errorText());
|
parser.showError(parser.errorText());
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.handleUnknownOptions();
|
parser.handleUnknownOptions();
|
||||||
|
|
||||||
|
|
||||||
|
m_PrintCSV = parser.isSet("csv");
|
||||||
|
|
||||||
// This method will not return and terminates the process if --version or
|
// This method will not return and terminates the process if --version or
|
||||||
// --help is specified
|
// --help is specified
|
||||||
parser.handleHelpAndVersionOptions();
|
parser.handleHelpAndVersionOptions();
|
||||||
@ -569,3 +573,8 @@ QString ListCommandLineParser::getHost() const
|
|||||||
{
|
{
|
||||||
return m_Host;
|
return m_Host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ListCommandLineParser::isPrintCSV() const
|
||||||
|
{
|
||||||
|
return m_PrintCSV;
|
||||||
|
}
|
||||||
|
@ -83,7 +83,9 @@ public:
|
|||||||
void parse(const QStringList &args);
|
void parse(const QStringList &args);
|
||||||
|
|
||||||
QString getHost() const;
|
QString getHost() const;
|
||||||
|
bool isPrintCSV() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_Host;
|
QString m_Host;
|
||||||
|
bool m_PrintCSV;
|
||||||
};
|
};
|
||||||
|
@ -102,9 +102,7 @@ public:
|
|||||||
// Occurs when a computer is updated
|
// Occurs when a computer is updated
|
||||||
case Event::ComputerUpdated:
|
case Event::ComputerUpdated:
|
||||||
if (m_State == StateSeekApp) {
|
if (m_State == StateSeekApp) {
|
||||||
for (int i = 0; i < m_Computer->appList.length(); i++) {
|
m_PrintCSV ? printAppsCSV(m_Computer->appList) : printApps(m_Computer->appList);
|
||||||
printApp(m_Computer->appList[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
QCoreApplication::exit(0);
|
QCoreApplication::exit(0);
|
||||||
}
|
}
|
||||||
@ -112,9 +110,22 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printApp(NvApp app) const
|
void printApps(QVector<NvApp> apps) {
|
||||||
|
for (int i = 0; i < apps.length(); i++) {
|
||||||
|
fprintf(stdout, "%s\n", qPrintable(apps[i].name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void printAppsCSV(QVector<NvApp> apps) {
|
||||||
|
fprintf(stdout, "Name, ID, HDR Support, App Collection Game, Hidden, Direct Launch, Boxart URL\n");
|
||||||
|
for (int i = 0; i < apps.length(); i++) {
|
||||||
|
printAppCSV(apps[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void printAppCSV(NvApp app) const
|
||||||
{
|
{
|
||||||
fprintf(stdout, "%s,%d,%s,%s,%s,%s,%s\n", qPrintable(app.name),
|
fprintf(stdout, "\"%s\",%d,%s,%s,%s,%s,\"%s\"\n", qPrintable(app.name),
|
||||||
app.id,
|
app.id,
|
||||||
app.hdrSupported ? "true" : "false",
|
app.hdrSupported ? "true" : "false",
|
||||||
app.isAppCollectorGame ? "true" : "false",
|
app.isAppCollectorGame ? "true" : "false",
|
||||||
@ -131,9 +142,10 @@ public:
|
|||||||
NvComputer *m_Computer;
|
NvComputer *m_Computer;
|
||||||
State m_State;
|
State m_State;
|
||||||
QTimer *m_TimeoutTimer;
|
QTimer *m_TimeoutTimer;
|
||||||
|
bool m_PrintCSV;
|
||||||
};
|
};
|
||||||
|
|
||||||
Launcher::Launcher(QString computer, QObject *parent)
|
Launcher::Launcher(QString computer, bool printCSV, QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
m_DPtr(new LauncherPrivate(this))
|
m_DPtr(new LauncherPrivate(this))
|
||||||
{
|
{
|
||||||
@ -142,6 +154,7 @@ Launcher::Launcher(QString computer, QObject *parent)
|
|||||||
d->m_State = StateInit;
|
d->m_State = StateInit;
|
||||||
d->m_TimeoutTimer = new QTimer(this);
|
d->m_TimeoutTimer = new QTimer(this);
|
||||||
d->m_TimeoutTimer->setSingleShot(true);
|
d->m_TimeoutTimer->setSingleShot(true);
|
||||||
|
d->m_PrintCSV = printCSV;
|
||||||
connect(d->m_TimeoutTimer, &QTimer::timeout,
|
connect(d->m_TimeoutTimer, &QTimer::timeout,
|
||||||
this, &Launcher::onComputerSeekTimeout);
|
this, &Launcher::onComputerSeekTimeout);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class Launcher : public QObject
|
|||||||
Q_DECLARE_PRIVATE_D(m_DPtr, Launcher)
|
Q_DECLARE_PRIVATE_D(m_DPtr, Launcher)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Launcher(QString computer, QObject *parent = nullptr);
|
explicit Launcher(QString computer, bool printCSV, QObject *parent = nullptr);
|
||||||
~Launcher();
|
~Launcher();
|
||||||
|
|
||||||
Q_INVOKABLE void execute(ComputerManager *manager);
|
Q_INVOKABLE void execute(ComputerManager *manager);
|
||||||
@ -35,6 +35,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<LauncherPrivate> m_DPtr;
|
QScopedPointer<LauncherPrivate> m_DPtr;
|
||||||
|
bool m_Print_CSV;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onSearchingApps() {
|
function onSearchingApps() {
|
||||||
stageLabel.text = qsTr("Searching for Apps...")
|
stageLabel.text = qsTr("Loading app list...")
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFailure(message) {
|
function onFailure(message) {
|
||||||
|
@ -626,7 +626,7 @@ int main(int argc, char *argv[])
|
|||||||
initialView = "qrc:/gui/CliListAppsSegue.qml";
|
initialView = "qrc:/gui/CliListAppsSegue.qml";
|
||||||
ListCommandLineParser listParser;
|
ListCommandLineParser listParser;
|
||||||
listParser.parse(app.arguments());
|
listParser.parse(app.arguments());
|
||||||
auto launcher = new CliListApps::Launcher(listParser.getHost(), &app);
|
auto launcher = new CliListApps::Launcher(listParser.getHost(), listParser.isPrintCSV(), &app);
|
||||||
engine.rootContext()->setContextProperty("launcher", launcher);
|
engine.rootContext()->setContextProperty("launcher", launcher);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user