📄 home_terminel_form.cpp
字号:
ovenmin_spinBox = new QSpinBox( tab_6, "ovenmin_spinBox" ); ovenmin_spinBox->setEnabled( TRUE ); ovenmin_spinBox->setGeometry( QRect( 390, 100, 80, 40 ) ); ovenmin_spinBox->setMaxValue( 30 ); ovensec_spinBox = new QSpinBox( tab_6, "ovensec_spinBox" ); ovensec_spinBox->setGeometry( QRect( 390, 170, 80, 40 ) ); ovensec_spinBox->setMaxValue( 59 ); textLabel2_5 = new QLabel( tab_6, "textLabel2_5" ); textLabel2_5->setGeometry( QRect( 485, 181, 60, 20 ) ); textLabel1_4 = new QLabel( tab_6, "textLabel1_4" ); textLabel1_4->setGeometry( QRect( 480, 110, 60, 20 ) ); pixmapLabel1 = new QLabel( tab_6, "pixmapLabel1" ); pixmapLabel1->setGeometry( QRect( 90, 60, 290, 150 ) ); pixmapLabel1->setScaledContents( TRUE ); oven_stop = new QPushButton( tab_6, "oven_stop" ); oven_stop->setGeometry( QRect( 210, 250, 101, 41 ) ); oven_reset = new QPushButton( tab_6, "oven_reset" ); oven_reset->setGeometry( QRect( 360, 250, 100, 40 ) ); oven_start = new QPushButton( tab_6, "oven_start" ); oven_start->setGeometry( QRect( 60, 250, 100, 40 ) ); electric_appliance_tab->insertTab( tab_6, "" ); tab_7 = new QWidget( electric_appliance_tab, "tab_7" ); hang_out = new QPushButton( tab_7, "hang_out" ); hang_out->setGeometry( QRect( 210, 250, 101, 41 ) ); collect = new QPushButton( tab_7, "collect" ); collect->setGeometry( QRect( 50, 250, 101, 41 ) ); collect_stop = new QPushButton( tab_7, "collect_stop" ); collect_stop->setGeometry( QRect( 365, 251, 101, 41 ) ); electric_appliance_tab->insertTab( tab_7, "" ); home_terminel_tab->insertTab( tab_5, "" ); tab_8 = new QWidget( home_terminel_tab, "tab_8" ); textLabel1_5 = new QLabel( tab_8, "textLabel1_5" ); textLabel1_5->setGeometry( QRect( 398, 25, 91, 21 ) ); textLabel2_6 = new QLabel( tab_8, "textLabel2_6" ); textLabel2_6->setGeometry( QRect( 398, 85, 91, 21 ) ); textLabel3_5 = new QLabel( tab_8, "textLabel3_5" ); textLabel3_5->setGeometry( QRect( 398, 145, 91, 21 ) ); getLogButton = new QPushButton( tab_8, "getLogButton" ); getLogButton->setGeometry( QRect( 390, 230, 110, 50 ) ); resetDayButton = new QPushButton( tab_8, "resetDayButton" ); resetDayButton->setGeometry( QRect( 390, 300, 111, 51 ) ); logDayBox = new QSpinBox( tab_8, "logDayBox" ); logDayBox->setGeometry( QRect( 390, 170, 101, 30 ) ); logDayBox->setMaxValue( 31 ); logDayBox->setMinValue( 1 ); logYearBox = new QSpinBox( tab_8, "logYearBox" ); logYearBox->setGeometry( QRect( 390, 50, 101, 30 ) ); logYearBox->setMaxValue( 2118 ); logYearBox->setMinValue( 1990 ); logYearBox->setValue( 2008 ); logMonthBox = new QSpinBox( tab_8, "logMonthBox" ); logMonthBox->setGeometry( QRect( 390, 110, 101, 30 ) ); logMonthBox->setMaxValue( 12 ); logMonthBox->setMinValue( 1 ); logtable = new QTable( tab_8, "logtable" );// logtable->setNumRows( logtable->numRows() + 1 );// logtable->horizontalHeader()->setLabel( logtable->numRows() - 1, tr( "1" ) ); logtable->setGeometry( QRect( 10, 10, 370, 341 ) ); logtable->setNumRows( 1 ); logtable->setNumCols( 3 ); logtable->setColumnWidth ( 0, 80 ); logtable->setColumnWidth ( 1, 80 ); logtable->setColumnWidth ( 2, 175 ); home_terminel_tab->insertTab( tab_8, "" ); tab_9 = new QWidget( home_terminel_tab, "tab_9" ); home_terminel_tab->insertTab( tab_9, "" ); tab_10 = new QWidget( home_terminel_tab, "tab_10" ); home_terminel_tab->insertTab( tab_10, "" ); buttonGroup4 = new QButtonGroup( this, "buttonGroup4" ); buttonGroup4->setGeometry( QRect( 0, 390, 510, 70 ) ); opendoorButton = new QPushButton( buttonGroup4, "opendoorButton" ); opendoorButton->setGeometry( QRect( 50, 20, 81, 40 ) ); closedoorButton = new QPushButton( buttonGroup4, "closedoorButton" ); closedoorButton->setGeometry( QRect( 220, 20, 81, 40 ) ); close_button = new QPushButton( buttonGroup4, "close_button" ); close_button->setGeometry( QRect( 390, 20, 81, 40 ) ); languageChange(); resize( QSize(640, 480).expandedTo(minimumSizeHint()) ); // signals and slots connections connect( close_button, SIGNAL( clicked() ), this, SLOT( close() ) ); connect( set_lum_step10, SIGNAL( clicked() ), this, SLOT( setLumStep10() ) ); connect( set_lum_step50, SIGNAL( clicked() ), this, SLOT( setLumStep50() ) ); connect( set_lum_step1, SIGNAL( clicked() ), this, SLOT( setLumstep1() ) ); connect( getLogButton, SIGNAL( clicked() ), this, SLOT( getLog() ) ); connect( resetDayButton, SIGNAL( clicked() ), this, SLOT( resetLogDate() ) ); connect( opendoorButton, SIGNAL( clicked() ), this, SLOT( openDoor() ) ); connect( closedoorButton, SIGNAL( clicked() ), this, SLOT( closeDoor() ) ); connect( saveUeserModeButton, SIGNAL( clicked() ), this, SLOT( saveMode() ) ); connect( setUserModeButton, SIGNAL( clicked() ), this, SLOT( setUserMode() ) ); connect( coolMode1Button, SIGNAL( clicked() ), this, SLOT( setCoolMode1() ) ); connect( coolMode2Button, SIGNAL( clicked() ), this, SLOT( setCoolMode2() ) ); connect( warmMode1Button, SIGNAL( clicked() ), this, SLOT( setWarmMode1() ) ); connect( warmMode2Button, SIGNAL( clicked() ), this, SLOT( setWarmMode2() ) ); connect( luminosity_Box, SIGNAL( valueChanged(int) ), this, SLOT( changeLum() ) ); connect( temperature_Box, SIGNAL( valueChanged(int) ), this, SLOT( changeTem() ) ); connect( humidity_Box, SIGNAL( valueChanged(int) ), this, SLOT( changeHum() ) ); connect( hang_out, SIGNAL( clicked() ), this, SLOT( hangClothes() ) ); connect( collect, SIGNAL( clicked() ), this, SLOT( collectClothes() ) ); connect( collect_stop, SIGNAL( clicked() ), this, SLOT( stopClothes() ) ); connect( oven_stop, SIGNAL( clicked() ), this, SLOT( stopOven() ) ); connect( oven_reset, SIGNAL( clicked() ), this, SLOT( resetOven() ) ); connect( oven_start, SIGNAL( clicked() ), this, SLOT( startOven() ) ); // tab order setTabOrder( opendoorButton, closedoorButton ); setTabOrder( closedoorButton, close_button ); setTabOrder( close_button, saveUeserModeButton ); setTabOrder( saveUeserModeButton, setUserModeButton ); setTabOrder( setUserModeButton, oven_start ); setTabOrder( oven_start, oven_stop ); setTabOrder( oven_stop, oven_reset ); setTabOrder( oven_reset, coolMode1Button ); setTabOrder( coolMode1Button, coolMode2Button ); setTabOrder( coolMode2Button, warmMode1Button ); setTabOrder( warmMode1Button, warmMode2Button ); setTabOrder( warmMode2Button, home_terminel_tab ); setTabOrder( home_terminel_tab, electric_appliance_tab ); setTabOrder( electric_appliance_tab, doorStateLight ); setTabOrder( doorStateLight, cameraStateLight ); setTabOrder( cameraStateLight, audioStateLight ); setTabOrder( audioStateLight, ovenmin_spinBox ); setTabOrder( ovenmin_spinBox, ovensec_spinBox ); setTabOrder( ovensec_spinBox, hang_out ); setTabOrder( hang_out, collect ); setTabOrder( collect, collect_stop ); setTabOrder( collect_stop, set_lum_step1 ); setTabOrder( set_lum_step1, set_lum_step10 ); setTabOrder( set_lum_step10, set_lum_step50 ); setTabOrder( set_lum_step50, humidity_Box ); setTabOrder( humidity_Box, luminosity_Box ); setTabOrder( luminosity_Box, temperature_Box ); setTabOrder( temperature_Box, tem_in_light ); setTabOrder( tem_in_light, tem_ap_light ); setTabOrder( tem_ap_light, tem_de_light ); setTabOrder( tem_de_light, lum_in_light ); setTabOrder( lum_in_light, lum_ap_light ); setTabOrder( lum_ap_light, lum_de_light ); setTabOrder( lum_de_light, hum_in_light ); setTabOrder( hum_in_light, hum_ap_light ); setTabOrder( hum_ap_light, hum_de_light ); setTabOrder( hum_de_light, environment_tab ); //init QLabel *label; QPixmap pm("oven.png"); label = new QLabel("",pixmapLabel1); label->setGeometry(QRect(20,20,220,140)); label->setPixmap(pm); label->show(); resetLogDate(); QTimer *date_timer = new QTimer(this); connect(date_timer, SIGNAL(timeout()), this, SLOT(showTime())); connect(date_timer, SIGNAL(timeout()), this, SLOT(showDate())); date_timer->start(200); QTimer *environ_timer = new QTimer(this); connect(environ_timer, SIGNAL(timeout()), this, SLOT(getenviron())); environ_timer->start(600000);}/* * Destroys the object and frees any allocated resources */home_terminel_Form::~home_terminel_Form(){ // no need to delete child widgets, Qt does it all for us}/* * Sets the strings of the subwidgets using the current * language. */void home_terminel_Form::languageChange(){ setCaption( tr( "The Home Terminel of Intelligence Residential System" ) ); groupBox1_2_2->setTitle( tr( "carborn state" ) ); textLabel3_4_2_2->setText( tr( "camera" ) ); textLabel4_2_2->setText( tr( "audio" ) ); textLabel2_4_2_2->setText( tr( "door" ) ); doorStateLight->setText( QString::null ); cameraStateLight->setText( QString::null ); audioStateLight->setText( QString::null ); groupBox9->setTitle( tr( "environ state" ) ); textLabel2->setText( tr( "temperature" ) ); textLabel5->setText( tr( "<h3>o</h3>" ) ); textLabel2_3->setText( tr( "<h1>C</h1>" ) ); textLabel3->setText( tr( "humidity" ) ); textLabel3_3->setText( tr( "<h2>%RH</h2>" ) ); textLabel1_3->setText( tr( "<h1>lux</h1>" ) ); textLabel1->setText( tr( "luminosity" ) ); textLabel5_2->setText( tr( "<h3>o</h3>" ) ); textLabel3_3_2->setText( tr( "<h2>%RH</h2>" ) ); textLabel1_2->setText( tr( "luminosity adjusting" ) ); set_lum_step1->setText( tr( "1" ) ); set_lum_step10->setText( tr( "10" ) ); set_lum_step50->setText( tr( "50" ) ); textLabel1_3_2->setText( tr( "<h1>lux</h1>" ) ); textLabel2_2->setText( tr( "temperature adjusting" ) ); textLabel5_3->setText( tr( "<h3>o</h3>" ) ); textLabel2_3_2->setText( tr( "<h1>C</h1>" ) ); textLabel3_2->setText( tr( "humidity adjusting" ) ); textLabel3_3_3->setText( tr( "<h2>%RH</h2>" ) ); groupBox1->setTitle( tr( "temperature" ) ); tem_in_light->setText( QString::null ); tem_ap_light->setText( QString::null ); tem_de_light->setText( QString::null ); textLabel3_4->setText( tr( "appropriate" ) ); textLabel4->setText( tr( "decreasing" ) ); textLabel2_4->setText( tr( "increasing" ) ); groupBox1_2->setTitle( tr( "luminosity" ) ); textLabel4_2->setText( tr( "decreasing" ) ); lum_in_light->setText( QString::null ); lum_ap_light->setText( QString::null ); lum_de_light->setText( QString::null ); textLabel3_4_2->setText( tr( "appropriate" ) ); textLabel2_4_2->setText( tr( "increasing" ) ); groupBox1_3->setTitle( tr( "humidity" ) ); textLabel3_4_3->setText( tr( "appropriate" ) ); textLabel4_3->setText( tr( "decreasing" ) ); hum_in_light->setText( QString::null ); hum_ap_light->setText( QString::null ); hum_de_light->setText( QString::null ); textLabel2_4_3->setText( tr( "increasing" ) ); saveUeserModeButton->setText( tr( "save nonce mode" ) ); setUserModeButton->setText( tr( "set user-defined mode" ) ); environment_tab->changeTab( tab_2, tr( "User-defined Mode" ) ); coolMode2Button->setText( tr( "cool mode 2" ) ); coolMode1Button->setText( tr( "cool mode 1" ) ); environment_tab->changeTab( tab_3, tr( "Cool Mode" ) ); warmMode1Button->setText( tr( "warm mode 1" ) ); warmMode2Button->setText( tr( "warm mode 2" ) ); environment_tab->changeTab( tab_4, tr( "Warm Mode" ) ); home_terminel_tab->changeTab( tab, tr( "environment" ) ); textLabel2_5->setText( tr( "s" ) ); textLabel1_4->setText( tr( "min" ) ); oven_stop->setText( tr( "oven_stop" ) ); oven_reset->setText( tr( "reset" ) ); oven_start->setText( tr( "oven_start" ) ); electric_appliance_tab->changeTab( tab_6, tr( "micro-wave oven" ) ); hang_out->setText( tr( "hang out" ) ); collect->setText( tr( "collect" ) ); collect_stop->setText( tr( "stop" ) ); electric_appliance_tab->changeTab( tab_7, tr( "collecting closes" ) ); home_terminel_tab->changeTab( tab_5, tr( "electric appliance" ) ); textLabel1_5->setText( tr( "year" ) ); textLabel2_6->setText( tr( "month" ) ); textLabel3_5->setText( tr( "day" ) ); getLogButton->setText( tr( "get log data" ) ); resetDayButton->setText( tr( "reset" ) ); logtable->horizontalHeader()->setLabel( 0, tr( "cmd time" ) ); logtable->horizontalHeader()->setLabel( 1, tr( "cmd number" ) ); logtable->horizontalHeader()->setLabel( 2, tr( "cmd content" ) ); home_terminel_tab->changeTab( tab_8, tr( "log database" ) ); home_terminel_tab->changeTab( tab_9, tr( "setting" ) ); home_terminel_tab->changeTab( tab_10, tr( "help" ) ); buttonGroup4->setTitle( tr( "shortcut menu" ) ); opendoorButton->setText( tr( "Open door" ) ); closedoorButton->setText( tr( "Close door" ) ); close_button->setText( tr( "Close" ) );}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -