~feng-kylin/youker-assistant/youker-assistant

« back to all changes in this revision

Viewing changes to mainui/cameramanager.h

  • Committer: lixiang
  • Date: 2018-03-06 03:13:06 UTC
  • Revision ID: lixiang@kylinos.cn-20180306031306-fd7qnru3vm4a1xjd
Rewrite with Qt5, and add system monitor

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & Kylin Ltd.
3
 
 *
4
 
 * Authors:
5
 
 *  Kobe Lee    xiangli@ubuntukylin.com/kobe24_lixiang@126.com
6
 
 *
7
 
 * This program is free software; you can redistribute it and/or modify
8
 
 * it under the terms of the GNU General Public License as published by
9
 
 * the Free Software Foundation; version 3.
10
 
 *
11
 
 * This program is distributed in the hope that it will be useful,
12
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 * GNU General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU General Public License
17
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 
 */
19
 
 
20
 
#ifndef CAMERAMANAGER_H
21
 
#define CAMERAMANAGER_H
22
 
//sudo apt-get install libcv-dev libopencv-highgui-dev libopencv-dev libhighgui-dev
23
 
#include <QDialog>
24
 
#include "../component/kylintitlebar.h"
25
 
#include <QImage>
26
 
#include <QTimer>// 设置采集数据的间隔时间
27
 
#include <highgui.h>  //包含opencv库头文件
28
 
#include <cv.h>
29
 
//#include <opencv2/highgui.hpp> //1710opencv库
30
 
//#include <cvaux.h>
31
 
//#include <ml.h>
32
 
#include <QDateTime>
33
 
#include <QDir>
34
 
#include <stdio.h>
35
 
#include <ctype.h>
36
 
#include  <time.h>
37
 
 
38
 
class SessionDispatcher;
39
 
class MainWindow;
40
 
class ToolButton;
41
 
 
42
 
class CameraManager :public QDialog
43
 
{
44
 
  Q_OBJECT
45
 
public:
46
 
    CameraManager(QWidget *parent = 0, SessionDispatcher *proxy = 0, QString skin = ":/background/res/skin/1.png");
47
 
//    ~CameraManager();
48
 
    void setParentWindow(MainWindow *From) { mainwindow = From;}
49
 
    void initConnect();
50
 
    void setOKButtonEnable(bool enable);
51
 
    void resetTitleSkin(QString skin);
52
 
    void initCamera();
53
 
    IplImage* DoPyrDown(IplImage* image, int filter);
54
 
    QString getCurrentDateTime();
55
 
    QString getHomePath();
56
 
    int countCamaras();
57
 
 
58
 
public slots:
59
 
    void readFarme();//读取当前帧信息
60
 
    void onCloseButtonClicked();
61
 
    void onOKButtonClicked();
62
 
    void onViewButtonClicked();
63
 
    void refreshCamera();
64
 
 
65
 
//protected:
66
 
//    void keyPressEvent( QKeyEvent *k );
67
 
 
68
 
private:
69
 
    void initTitleBar(QString skin);
70
 
 
71
 
private:
72
 
    MainWindow *mainwindow;
73
 
    SessionDispatcher *sessionproxy;
74
 
    QTimer *timer;
75
 
    QImage *imag;
76
 
    CvCapture *cam;// 视频获取结构, 用来作为视频获取函数的一个参数
77
 
    IplImage  *frame;//申请IplImage类型指针,就是申请内存空间来存放每一帧图像
78
 
    KylinTitleBar *title_bar;
79
 
    QLabel *camera_label;
80
 
    QWidget *baseWidget;
81
 
    QLabel *catch_label;
82
 
    QLabel *disable_icon;
83
 
    QPushButton *okBtn;
84
 
    ToolButton *viewBtn;
85
 
    QLabel *error_icon;
86
 
    QLabel *error_label;
87
 
};
88
 
 
89
 
#endif // CAMERAMANAGER_H