下一步完善旋转等画面功能
This commit is contained in:
109
homewindow.cpp
109
homewindow.cpp
@@ -43,6 +43,7 @@ HomeWindow::HomeWindow(QWidget *parent) :
|
||||
bIsFull(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowIcon(QIcon(":/logo/res/logo.png"));
|
||||
ui->playList->Init();
|
||||
QString str = QString("%1:%2:%3").arg(0, 2, 10, QLatin1Char('0')).arg(0, 2, 10, QLatin1Char('0')).arg(0, 2, 10, QLatin1Char('0'));
|
||||
ui->curPosition->setText(str);
|
||||
@@ -94,6 +95,8 @@ int HomeWindow::InitSignalsAndSlots()
|
||||
connect(ui->openUrlAction, &QAction::triggered, this, &HomeWindow::on_openNetworkUrl);
|
||||
connect(this, &HomeWindow::sig_updatePlayOrPause, this, &HomeWindow::on_updatePlayOrPause);
|
||||
connect(this, &HomeWindow::sig_troggleFull, ui->display, &DisplayWind::onToggleFullScreen);
|
||||
connect(&setting_wid_, &Setting::sig_bufDurationBox_currentIndexChanged, this, &HomeWindow::on_bufDurationBox_currentIndexChanged);
|
||||
connect(&setting_wid_, &Setting::sig_jitterBufBox_currentIndexChanged, this, &HomeWindow::on_jitterBufBox_currentIndexChanged);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -188,49 +191,52 @@ void HomeWindow::resizeEvent(QResizeEvent *event)
|
||||
|
||||
void HomeWindow::resizeUI()
|
||||
{
|
||||
int width = this->width();
|
||||
int height = this->height();
|
||||
LOG(INFO) << "width: " << width;
|
||||
// 获取当前ctrlwidget的位置
|
||||
QRect rect = ui->ctrlBar->geometry();
|
||||
rect.setY(height - ui->menuBar->height() - rect.height());
|
||||
// LOG(INFO) << "rect: " << rect;
|
||||
rect.setWidth(width);
|
||||
ui->ctrlBar->setGeometry(rect);
|
||||
// 设置setting和listbutton的位置
|
||||
rect = ui->settingBtn->geometry();
|
||||
// 获取 ctrlBar的大小 计算list的 x位置
|
||||
int x1 = ui->ctrlBar->width() - rect.width() - rect.width() / 8 * 2;
|
||||
ui->listBtn->setGeometry(x1, rect.y(), rect.width(), rect.height());
|
||||
// LOG(INFO) << "listBtn: " << ui->listBtn->geometry();
|
||||
// 设置setting button的位置,在listbutton左侧
|
||||
rect = ui->listBtn->geometry();
|
||||
x1 = rect.x() - rect.width() - rect.width() / 8 ;
|
||||
ui->settingBtn->setGeometry(x1, rect.y(), rect.width(), rect.height());
|
||||
// LOG(INFO) << "settingBtn: " << ui->settingBtn->geometry();
|
||||
// 设置 显示画面
|
||||
if(is_show_file_list_) {
|
||||
width = this->width() - ui->playList->width();
|
||||
} else {
|
||||
width = this->width();
|
||||
}
|
||||
height = this->height() - ui->ctrlBar->height() - ui->menuBar->height();
|
||||
// int y1 = ui->menuBar->height();
|
||||
int y1 = 0;
|
||||
ui->display->setGeometry(0, y1, width, height);
|
||||
// 设置文件列表 list
|
||||
if(is_show_file_list_) {
|
||||
ui->playList->setGeometry(ui->display->width(), y1, ui->playList->width(), height);
|
||||
}
|
||||
// 设置播放进度条的长度,设置成和显示控件宽度一致
|
||||
rect = ui->playSlider->geometry();
|
||||
width = ui->display->width() - 5 - 5;
|
||||
rect.setWidth(width);
|
||||
ui->playSlider->setGeometry(5, rect.y(), rect.width(), rect.height());
|
||||
// 设置音量条位置
|
||||
x1 = this->width() - 5 - ui->volumeSlider->width();
|
||||
rect = ui->volumeSlider->geometry();
|
||||
ui->volumeSlider->setGeometry(x1, rect.y(), rect.width(), rect.height());
|
||||
int width = ui->playwidget->width();
|
||||
int height = ui->playwidget->height();
|
||||
QRect rect = ui->playwidget->geometry();
|
||||
qDebug() << rect;
|
||||
ui->display->setGeometry(rect);
|
||||
// LOG(INFO) << "width: " << width;
|
||||
// // 获取当前ctrlwidget的位置
|
||||
// QRect rect = ui->ctrlBar->geometry();
|
||||
// rect.setY(height - ui->menuBar->height() - rect.height());
|
||||
// // LOG(INFO) << "rect: " << rect;
|
||||
// rect.setWidth(width);
|
||||
// ui->ctrlBar->setGeometry(rect);
|
||||
// // 设置setting和listbutton的位置
|
||||
// rect = ui->settingBtn->geometry();
|
||||
// // 获取 ctrlBar的大小 计算list的 x位置
|
||||
// int x1 = ui->ctrlBar->width() - rect.width() - rect.width() / 8 * 2;
|
||||
// ui->listBtn->setGeometry(x1, rect.y(), rect.width(), rect.height());
|
||||
// // LOG(INFO) << "listBtn: " << ui->listBtn->geometry();
|
||||
// // 设置setting button的位置,在listbutton左侧
|
||||
// rect = ui->listBtn->geometry();
|
||||
// x1 = rect.x() - rect.width() - rect.width() / 8 ;
|
||||
// ui->settingBtn->setGeometry(x1, rect.y(), rect.width(), rect.height());
|
||||
// // LOG(INFO) << "settingBtn: " << ui->settingBtn->geometry();
|
||||
// // 设置 显示画面
|
||||
// if(is_show_file_list_) {
|
||||
// width = this->width() - ui->playList->width();
|
||||
// } else {
|
||||
// width = this->width();
|
||||
// }
|
||||
// height = this->height() - ui->ctrlBar->height() - ui->menuBar->height();
|
||||
// // int y1 = ui->menuBar->height();
|
||||
// int y1 = 0;
|
||||
// ui->display->setGeometry(0, y1, width, height);
|
||||
// // 设置文件列表 list
|
||||
// if(is_show_file_list_) {
|
||||
// ui->playList->setGeometry(ui->display->width(), y1, ui->playList->width(), height);
|
||||
// }
|
||||
// // 设置播放进度条的长度,设置成和显示控件宽度一致
|
||||
// rect = ui->playSlider->geometry();
|
||||
// width = ui->display->width() - 5 - 5;
|
||||
// rect.setWidth(width);
|
||||
// ui->playSlider->setGeometry(5, rect.y(), rect.width(), rect.height());
|
||||
// // 设置音量条位置
|
||||
// x1 = this->width() - 5 - ui->volumeSlider->width();
|
||||
// rect = ui->volumeSlider->geometry();
|
||||
// ui->volumeSlider->setGeometry(x1, rect.y(), rect.width(), rect.height());
|
||||
}
|
||||
|
||||
void HomeWindow::closeEvent(QCloseEvent *event)
|
||||
@@ -448,9 +454,10 @@ void HomeWindow::on_playOrPauseBtn_clicked()
|
||||
void HomeWindow::on_updatePlayOrPause(int state)
|
||||
{
|
||||
if(state == MP_STATE_STARTED) {
|
||||
ui->playOrPauseBtn->setText("暂停");
|
||||
// ui->playOrPauseBtn->setText("暂停");
|
||||
GlobalHelper::SetToolbuttonIcon(ui->playOrPauseBtn, ":/icon/res/icon/pause.png");
|
||||
} else {
|
||||
ui->playOrPauseBtn->setText("播放");
|
||||
GlobalHelper::SetToolbuttonIcon(ui->playOrPauseBtn, ":/icon/res/icon/play.png");
|
||||
}
|
||||
LOG(INFO) << "play state: " << state;
|
||||
}
|
||||
@@ -566,7 +573,7 @@ bool HomeWindow::stop()
|
||||
real_time_ = 0;
|
||||
is_accelerate_speed_ = false;
|
||||
ui->display->StopPlay(); // 停止渲染,后续刷黑屏
|
||||
ui->playOrPauseBtn->setText("播放");
|
||||
GlobalHelper::SetToolbuttonIcon(ui->playOrPauseBtn, ":/icon/res/icon/play.png");
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
@@ -747,6 +754,14 @@ void HomeWindow::on_backFastBtn_clicked()
|
||||
|
||||
void HomeWindow::on_fullBtn_clicked()
|
||||
{
|
||||
emit sig_troggleFull(true);
|
||||
if (mp_ && ((mp_->ijkmp_get_state() == MP_STATE_STARTED) || (mp_->ijkmp_get_state() == MP_STATE_PAUSED))) {
|
||||
emit sig_troggleFull(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HomeWindow::on_settingBtn_clicked()
|
||||
{
|
||||
setting_wid_.show();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user