void ChatForm::startCounter() { if (!callDurationTimer) { callDurationTimer = new QTimer(); connect(callDurationTimer, SIGNAL(timeout()), this, SLOT(onUpdateTime())); callDurationTimer->start(1000); timeElapsed.start(); callDuration->show(); } }
connect(ui->buttonBackToResults, SIGNAL(clicked()), this, SLOT(backToResults())); connect(ui->buttonBackToTrailers, SIGNAL(clicked()), this, SLOT(backToTrailers())); connect(ui->buttonDownload, SIGNAL(clicked()), this, SLOT(startDownload())); connect(ui->buttonCancelDownload, SIGNAL(clicked()), this, SLOT(cancelDownload())); connect(ui->stackedWidget, SIGNAL(animationFinished()), this, SLOT(onAnimationFinished())); m_mediaPlayer = new QMediaPlayer(); m_videoWidget = new QVideoWidget(this); m_mediaPlayer->setVideoOutput(m_videoWidget); QVBoxLayout *layout = new QVBoxLayout(ui->video); layout->addWidget(m_videoWidget); ui->video->setLayout(layout); connect(m_mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(onStateChanged(QMediaPlayer::State))); connect(m_mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(onNewTotalTime(qint64))); connect(m_mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(onUpdateTime(qint64))); connect(ui->btnPlayPause, SIGNAL(clicked()), this, SLOT(onPlayPause())); connect(ui->seekSlider, SIGNAL(sliderReleased()), this, SLOT(onSliderPositionChanged())); } TrailerDialog::~TrailerDialog() { m_mediaPlayer->deleteLater(); delete ui; } TrailerDialog* TrailerDialog::instance(QWidget *parent) { static TrailerDialog *m_instance = 0; if (m_instance == 0) { m_instance = new TrailerDialog(parent);
MainWindow::MainWindow(AppListInterface * pList,QWidget *parent) : QWidget(parent), m_bInVideoStream(false) { m_pList = pList; int title_height=40; int status_height=ui_res_width/9; int center_height=ui_res_height-status_height-title_height; int margin=10; int inter=5; setWindowFlags(Qt::FramelessWindowHint);// setGeometry(0,0,ui_res_width,ui_res_height); this->setAutoFillBackground(true); QPixmap pixmap(":/images/mainmenu.png"); QPixmap fitpixmap=pixmap.scaled(this->width(),this->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); QPalette palette; palette.setBrush(QPalette::Background, QBrush(fitpixmap)); this->setPalette(palette); m_pIcon=new QLabel(this); m_pIcon->setGeometry(margin*2,inter,title_height-inter*2,title_height-inter*2); m_pIcon->setStyleSheet(QString::fromUtf8("border-image:url(:/images/home.png)")); m_pTime=new QLabel(this); m_pTime->setGeometry(ui_res_width*1/3,inter,ui_res_width/3,title_height-inter*2); m_pTime->setAlignment(Qt::AlignCenter); m_pTime->setStyleSheet("font: 32px \"Liberation Serif\";color:rgb(255,255,255);background:transparent;border: 0px"); m_pTime->setText(QTime::currentTime().toString("HH:mm")); m_pNetStatus=new QLabel(this); m_pNetStatus->setGeometry(ui_res_width-title_height-margin,inter,title_height-2*inter,title_height-inter*2); m_pNetStatus->setStyleSheet(QString::fromUtf8("border-image:url(:/images/wifi.png)")); m_pCenter=new QWidget(this); m_pCenter->setGeometry(margin,title_height,ui_res_width-2*margin,center_height); //m_pCenter->setStyleSheet(QString::fromUtf8("border-image:url(:/images/applinkmain.png)")); int y=title_height+center_height; m_pMainMenu=new QWidget(this); m_pMainMenu->setGeometry(margin,y,ui_res_width-2*margin,status_height-inter); m_pMainMenu->setStyleSheet(QString::fromUtf8("border-image:url(:/images/downmenu.png)")); QString sheet_on[MENU_MAX]={":/images/music_on.png",":/images/key_on.png",":/images/phone_on.png", ":/images/link_on.png",":/images/list_on.png", ":/images/setting_on.png"}; QString sheet_off[MENU_MAX]={":/images/music_off.png",":/images/key_off.png",":/images/phone_off.png", ":/images/link_off.png",":/images/list_off.png", ":/images/setting_off.png"}; //QString text[MENU_MAX]={"Music","Keys","Phone","Navigation","AppList","Settings"}; QString text[MENU_MAX]={"音频","空调","电话","导航","应用程序","设置"}; for (int i=0;i<MENU_MAX;++i) { m_pMenuTab[i]=new MenuButton(m_pMainMenu); m_pMenuTab[i]->setGeometry((ui_res_width-2*margin)/MENU_MAX*i,0,(ui_res_width-2*margin)/MENU_MAX,status_height); m_pMenuTab[i]->setIcon(sheet_on[i],sheet_off[i]); m_pMenuTab[i]->setText(text[i]); connect(m_pMenuTab[i],SIGNAL(clicked()),SLOT(onMenuSelected())); } m_pMenuTab[4]->setActive(true); m_AppWidth=(ui_res_width-2*margin)/4; m_AppHeight=center_height/2; /* QString appsheet_on[2]={":/images/phonechild_on.png",":/images/listchild_on.png"}; QString appsheet_off[2]={":/images/phonechild_off.png",":/images/listchild_off.png"}; QString childText[2]={"Find New App","App Setting"}; int funcId[2]={-1,-2}; for(int i=0;i<2;++i) { InsertChildApp(i,funcId[i],childText[i],appsheet_on[i],appsheet_off[i]); } */ m_pTimer=new QTimer(this); m_pTimer->start(1000);//分钟 connect(m_pTimer,SIGNAL(timeout()),SLOT(onUpdateTime())); //videoWidget = new VideoStream(ui_res_width,ui_res_height,this); //connect(videoWidget,SIGNAL(ClickMenuBtn()),this,SLOT(OnVideoStreamMenuBtnClicked())); }