1 #include "mainwindow.h"
2 #include "ui_mainwindow.h"
3 #include <QMessageBox>
4 #include <QDir>
5 #include <QVBoxLayout>
6 #include <QDebug>
7
8 MainWindow::MainWindow(QWidget *parent) :
9 QMainWindow(parent),
10 ui(new Ui::MainWindow)
11 {
12 ui->setupUi(this);
13
14 //获取指定目录
15 QStringList args = qApp->arguments();
16 QString path;
17 if(args.count()>1)
18 {
19 path=args[1];
20 }
21 else
22 {
23 path = QDir::currentPath();
24 }
25
26 label = new QLabel(this);
27 label->setText("spypath"+path);
28 QVBoxLayout *layout = new QVBoxLayout(this);
29 layout->addWidget(label);
30 qDebug() << path;
31 fsspy.addPath(path);
32 connect(&fsspy,SIGNAL(directoryChanged(QString)),this,SLOT(directoryChanged(QString)));
33 }
34
35 MainWindow::~MainWindow()
36 {
37 delete ui;
38 }
39
40 //触发监视
41 void MainWindow::directoryChanged(QString path)
42 {
43 QMessageBox::information(NULL,"changes",path);
44 }