1 #include "front_camera_setting.h"
2 #include "ui_front_camera_setting.h"
3 #include "preview.h"
4 #include "ui_preview.h"
5 #include <QDesktopWidget>
6 #include "settings.h"
7 extern Settings* pStatic_settings;
8 #if 0
9 extern int startA,startB,widthA,heightA;
10 #endif
11 static int interval=50;
Front_camera_setting(QWidget * parent)12 Front_camera_setting::Front_camera_setting(QWidget *parent) :
13 QDialog(parent),
14 ui(new Ui::Front_camera_setting)
15 {
16 ui->setupUi(this);
17 FormInCenter();
18 connect(ui->returnButton,SIGNAL(clicked()),this,SLOT(on_returnButton_clicked()));
19 connect(ui->upperButton,SIGNAL(clicked()),this,SLOT(on_upperButton_clicked()),Qt::UniqueConnection);
20 connect(ui->downButton,SIGNAL(clicked()),this,SLOT(on_downButton_clicked()),Qt::UniqueConnection);
21 connect(ui->sureButton,SIGNAL(clicked()),this,SLOT(on_sureButton_clicked()),Qt::UniqueConnection);
22 }
FormInCenter()23 void Front_camera_setting::FormInCenter()
24 {
25 QDesktopWidget w;
26 int deskWidth = w.width();
27 int deskHeight = w.height();
28 this->resize(deskWidth*3/4,deskHeight*3/4);
29 QPoint movePoint(deskWidth / 2 - this->width() / 2, deskHeight / 2 - this->height() / 2);
30 this->move(movePoint);
31 }
~Front_camera_setting()32 Front_camera_setting::~Front_camera_setting()
33 {
34 delete ui;
35 }
on_returnButton_clicked()36 void Front_camera_setting::on_returnButton_clicked()
37 {
38 this->close();
39 pStatic_settings->setHidden(false);
40 }
on_upperButton_clicked()41 void Front_camera_setting::on_upperButton_clicked()
42 {
43 qDebug()<<"camer upper";
44 connect(ui->downButton,SIGNAL(clicked()),this,SLOT(on_downButton_clicked()),Qt::UniqueConnection);
45 ui->downButton->setEnabled(true);
46 #if defined(Q_OS_LINUX)
47 printf("camera upper view\n");
48 #if 0
49 startA=0;widthA=1024;heightA=300;
50
51
52 if(startB>0){
53 // interval+=50;
54 startB-=interval;
55 printf("now startB is %d \n",startB);
56
57 }else{
58 disconnect(ui->upperButton,SIGNAL(clicked()),this,SLOT(on_upperButton_clicked()));
59 ui->upperButton->setEnabled(false);
60 }
61 #endif
62 #endif
63 }
on_downButton_clicked()64 void Front_camera_setting::on_downButton_clicked()
65 {
66 qDebug()<<"camera down";
67 connect(ui->upperButton,SIGNAL(clicked()),this,SLOT(on_upperButton_clicked()),Qt::UniqueConnection);
68 ui->upperButton->setEnabled(true);
69 #if defined(Q_OS_LINUX)
70 printf("camera down view\n");
71 #if 0
72 // interval-=50;
73 // printf("now interval is %d \n",interval);
74 startA=0;widthA=1024;heightA=300;
75 if( startB<300){
76 startB+=interval;
77 printf("now startB is %d \n",startB);
78 }else{
79 disconnect(ui->downButton,SIGNAL(clicked()),this,SLOT(on_downButton_clicked()));
80 ui->downButton->setEnabled(false);
81 }
82 #endif
83 #endif
84 }
on_sureButton_clicked()85 void Front_camera_setting::on_sureButton_clicked()
86 {
87 qDebug()<<"sure camera adjust";
88 this->close();
89 pStatic_settings->setHidden(false);
90 }
91