-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadd.cpp
executable file
·69 lines (60 loc) · 1.41 KB
/
add.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "add.h"
#include <QGuiApplication>
#include <QProcess>
#include <QDebug>
#include "stdlib.h"
AddTransfer::AddTransfer()
{
_text = "";
}
AddTransfer::~AddTransfer()
{
}
QString AddTransfer::text()
{
return _text;
}
QString shell(QString text)
{
QProcess process;
QString shellchar;
#ifdef Q_OS_WIN32
return text.right(text.length() - 1);
#else
shellchar = "mdls -name kMDItemCFBundleIdentifier -r " + text.replace(" ", "\" \"");
#endif
process.start(shellchar);
process.waitForFinished();
return QString::fromLocal8Bit(process.readAllStandardOutput());
}
void shellWithArgumentsWithoutResponse(QString text, QStringList args)
{
QProcess* process = new QProcess;
process->start(text, args);
}
void AddTransfer::goTerminal(QString gttext)
{
if (_text != gttext)
{
_text = gttext;
emit sig_getFromTerminal(shell(_text));
}
}
void AddTransfer::slot_getFromTerminal(QString sgftext)
{
goTerminal(sgftext);
}
void AddTransfer::slot_openBlocking(QString way, QStringList listnames)
{
QStringList args;
#ifdef Q_OS_WIN32
args << way << listnames;
QString pgmptr = _pgmptr;
pgmptr = pgmptr.left(pgmptr.length() - 26);
shellWithArgumentsWithoutResponse(pgmptr + "\\mbk.exe", args);
#else
args << ((QCoreApplication::arguments().at(1) == "cn") ? "cn" : "en") << way << listnames;
shellWithArgumentsWithoutResponse("/Applications/Mr Noplay Tools/mbks", args);
qDebug() << args;
#endif
}