-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
102 lines (67 loc) · 2.18 KB
/
main.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include <QSettings>
#include <QList>
#include <QString>
#include <QCoreApplication>
#include <QStandardPaths>
#include <QDebug>
#include "dokan/dokan.h"
#include "common.h"
#include "QtServiceController"
#include <QThread>
#include <QUuid>
//#include "../seamless_smb_service/daemon.h"
#include "daemon.h"
typedef QList<MountInfo> mlist;
int main(int argc, char *argv[])
{
QCoreApplication app(argc,argv);
if(QtServiceController::install("G:\\Dokan Library-1.5.0\\sample\\build-mirror-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\\bin\\seamless_smb_service.exe"))
qDebug("service installed");
else{
qDebug("Service not installed!");
return -1;
}
// qRegisterMetaTypeStreamOperators<MountInfo>("MountInfo");
// qRegisterMetaTypeStreamOperators<mlist>("mlist");
qApp->setOrganizationDomain("Seamless smb");
qApp->setApplicationName("seamless_smb_service");
QStringList plist = QStandardPaths::standardLocations(QStandardPaths::AppConfigLocation);
QString path; //= QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
foreach(QString p, plist ){
if(p.contains("ProgramData")){
path = p;
break;
}
}
QSettings settings(path+"/mounts.ini", QSettings::IniFormat);
qDebug() << path;
mlist mounts;
MountInfo info;
info.uuid = QUuid::createUuid();
info.MountPoint = "Z:";
info.RootDirectory = R"(\\192.168.1.4\temp)";
info.volname = "temp";
info.options |= DOKAN_OPTION_MOUNT_MANAGER;
info.debug = true;
info.enabled = true;
info.keepAlive = true;
mounts << info;
settings.setValue("Mounts",QVariant::fromValue(mounts));
settings.sync();
// QThread daemonThread;
// Daemon *d;
// d = new Daemon();
//// daemonThread.connect(&daemonThread,&QThread::started,[&](){
//// d = new Daemon();
//// d->moveToThread(&daemonThread);
//// });
// d->moveToThread(&daemonThread);
// daemonThread.start();
// QtServiceController controller("Seamless smb");
// controller.start();
// controller.uninstall();
int ret = app.exec();
// delete d;
// daemonThread.exit();
return ret;
}